23std::shared_ptr<JsonConf>
ParseJson(std::string conf_path) {
24 AINFO <<
"parsing json config";
25 boost::filesystem::path path(conf_path);
26 if (!boost::filesystem::exists(path)) {
27 AERROR <<
"json config file " << conf_path <<
" does not exist";
31 std::shared_ptr<JsonConf> conf(
new JsonConf);
32 boost::property_tree::ptree pt;
34 boost::property_tree::read_json(conf_path, pt);
35 conf->use_system_time = pt.get<
bool>(
"use_system_time");
36 conf->topic_rate_tolerance = pt.get<
double>(
"topic_rate_tolerance");
37 boost::property_tree::ptree children2 = pt.get_child(
"topic_list");
38 for (
auto it = children2.begin(); it != children2.end(); ++it) {
39 conf->topic_list.push_back(
40 std::make_pair(it->first, it->second.get_value<
double>()));
43 conf->solution_status = pt.get<
unsigned int>(
"solution_status");
45 boost::property_tree::ptree position_type = pt.get_child(
"position_type");
46 for (
auto it = position_type.begin(); it != position_type.end(); ++it) {
47 conf->position_type_range.insert(it->second.get_value<
unsigned int>());
50 conf->local_std_upper_limit = pt.get<
double>(
"local_std_upper_limit");
52 boost::property_tree::ptree diff_age = pt.get_child(
"diff_age");
54 auto it = diff_age.begin();
55 conf->diff_age_range.first = it->second.get_value<
float>();
57 conf->diff_age_range.second = it->second.get_value<
float>();
60 conf->channel_check_trigger_gap = pt.get<
int>(
"channel_check_trigger_gap");
61 conf->alignment_featch_pose_sleep =
62 pt.get<
int>(
"alignment_featch_pose_sleep");
63 conf->static_align_duration = pt.get<
double>(
"static_align_duration");
64 conf->static_align_tolerance = pt.get<
double>(
"static_align_tolerance");
65 conf->static_align_dist_thresh = pt.get<
double>(
"static_align_dist_thresh");
67 conf->eight_angle = pt.get<
double>(
"eight_angle");
68 conf->eight_duration = pt.get<
double>(
"eight_duration");
69 conf->eight_vel = pt.get<
double>(
"eight_vel");
70 conf->eight_bad_pose_tolerance = pt.get<
int>(
"eight_bad_pose_tolerance");
72 conf->laps_frames_thresh = pt.get<
int>(
"laps_frames_thresh");
73 conf->laps_alpha_err_thresh = pt.get<
double>(
"laps_alpha_err_thresh");
74 conf->laps_time_err_thresh = pt.get<
double>(
"laps_time_err_thresh");
75 conf->laps_search_diameter = pt.get<
int>(
"laps_search_diameter");
76 conf->laps_number = pt.get<
int>(
"laps_number");
77 conf->laps_number_additional = pt.get<
int>(
"laps_number_additional");
78 conf->laps_rate_thresh = pt.get<
double>(
"laps_rate_thresh");
79 }
catch (
const boost::property_tree::json_parser_error& e) {
82 }
catch (
const std::exception& e) {