@@ -14,33 +14,40 @@ int main(int argc, char** argv){
1414
1515 auto option = BackEndOption ();
1616 YAML::Node config = YAML::LoadFile (yaml_file);
17+ YAML::Node gui_config = config[" gui" ];
18+ YAML::Node io_config = config[" io" ];
19+ YAML::Node odom_config = config[" odom" ];
20+ YAML::Node loop_config = config[" loopclosure" ];
21+ YAML::Node multiway_config = config[" multiway" ];
22+ std::string output_pose_graph = io_config[" mr_graph" ].as <std::string>();
23+ std::string output_isam_poses = io_config[" isam_poses" ].as <std::string>();
24+ std::string output_mr_poses = io_config[" mr_poses" ].as <std::string>();
25+ bool save_map = io_config[" save_map" ].as <bool >();
26+ std::string map_path = io_config[" map_path" ].as <std::string>();
1727
18- std::string output_pose_graph = config[" io" ][" mr_graph" ].as <std::string>();
19- std::string output_isam_poses = config[" io" ][" isam_poses" ].as <std::string>();
20- std::string output_mr_poses = config[" io" ][" mr_poses" ].as <std::string>();
2128 assert (output_pose_graph.substr (output_pose_graph.find_last_of (' .' ) + 1 ) == " json" ); // suffix of a Posegraph must be '.json', or your effort is in vain!
2229
23- option.verborse = config[ " gui " ] [" verborse" ].as <bool >();
24- option.vis = config[ " gui " ] [" vis" ].as <bool >();
30+ option.verborse = gui_config [" verborse" ].as <bool >();
31+ option.vis = gui_config [" vis" ].as <bool >();
2532
26- option.voxel = config[ " odom " ] [" voxel" ].as <double >();
27- option.keyframeMeterGap = config[ " odom " ] [" keyframeMeterGap" ].as <double >();
28- option.keyframeRadGap = config[ " odom " ] [" keyframeRadGap" ].as <double >();
29- option.icp_corase_dist = config[ " odom " ] [" icp_corase_dist" ].as <double >();
30- option.icp_refine_dist = config[ " odom " ] [" icp_refine_dist" ].as <double >();
31- option.icp_max_iter = config[ " odom " ] [" icp_max_iter" ].as <int >();
33+ option.voxel = odom_config [" voxel" ].as <double >();
34+ option.keyframeMeterGap = odom_config [" keyframeMeterGap" ].as <double >();
35+ option.keyframeRadGap = odom_config [" keyframeRadGap" ].as <double >();
36+ option.icp_corase_dist = odom_config [" icp_corase_dist" ].as <double >();
37+ option.icp_refine_dist = odom_config [" icp_refine_dist" ].as <double >();
38+ option.icp_max_iter = odom_config [" icp_max_iter" ].as <int >();
3239
33- option.LCkeyframeMeterGap = config[ " loopclosure " ] [" LCkeyframeMeterGap" ].as <double >();
34- option.LCkeyframeRadGap = config[ " loopclosure " ] [" LCkeyframeRadGap" ].as <double >();
35- option.LCSubmapSize = config[ " loopclosure " ] [" LCSubmapSize" ].as <int >();
36- option.loopOverlapThre = config[ " loopclosure " ] [" loopOverlapThre" ].as <double >();
37- option.loopInlierRMSEThre = config[ " loopclosure " ] [" loopInlierRMSEThre" ].as <double >();
40+ option.LCkeyframeMeterGap = loop_config [" LCkeyframeMeterGap" ].as <double >();
41+ option.LCkeyframeRadGap = loop_config [" LCkeyframeRadGap" ].as <double >();
42+ option.LCSubmapSize = loop_config [" LCSubmapSize" ].as <int >();
43+ option.loopOverlapThre = loop_config [" loopOverlapThre" ].as <double >();
44+ option.loopInlierRMSEThre = loop_config [" loopInlierRMSEThre" ].as <double >();
3845
39- option.MRmaxIter = config[ " multiway " ] [" MRmaxIter" ].as <int >();
40- option.MRmaxCorrDist = config[ " multiway " ] [" MRmaxCorrDist" ].as <double >();
41- option.MREdgePruneThre = config[ " multiway " ] [" MREdgePruneThre" ].as <double >();
42- bool odom_refine = config[ " multiway " ] [" RefineOdom" ].as <bool >();
43- bool use_multiway = config[ " multiway " ] [" use" ].as <bool >();
46+ option.MRmaxIter = multiway_config [" MRmaxIter" ].as <int >();
47+ option.MRmaxCorrDist = multiway_config [" MRmaxCorrDist" ].as <double >();
48+ option.MREdgePruneThre = multiway_config [" MREdgePruneThre" ].as <double >();
49+ bool odom_refine = multiway_config [" RefineOdom" ].as <bool >();
50+ bool use_multiway = multiway_config [" use" ].as <bool >();
4451 std::cout << " Parameters have been loaded from " << yaml_file << " ." << std::endl;
4552 BackEndOptimizer optimizer (option);
4653 std::thread p (&BackEndOptimizer::LoopClosureRegThread, &optimizer);
@@ -56,4 +63,6 @@ int main(int argc, char** argv){
5663 optimizer.UpdatePosesFromPG ();
5764 optimizer.writePoses (output_mr_poses);
5865 }
66+ if (save_map){}
67+ optimizer.SaveMap (map_path);
5968}
0 commit comments