cartographer-project / cartographer

Cartographer is a system that provides real-time simultaneous localization and mapping (SLAM) in 2D and 3D across multiple platforms and sensor configurations.
Apache License 2.0
7.09k stars 2.25k forks source link

Unable to achieve global loop closure between sub-maps #1617

Open fayyazpocker opened 5 years ago

fayyazpocker commented 5 years ago

Hello guys,

I am trying to generate a map of an industry. I am not able to achieve a proper loop closure as shown below: Screenshot from 2019-07-26 10-19-54

Inter constraints between submaps: Screenshot from 2019-07-26 10-20-04

The two distinct lines you see in the image below should have been collinear: Screenshot from 2019-07-26 10-20-20

You can find the bag file related to the above image in drive named "cartographer_issue.bag". You can also find another rosbag named "complete_run.bag" which also have the same topics but with a longer time.

Please find the configuration i used for running cartographer

According to #141 and #127, i tried changing huber scale, number of scans per submap and minimum score required for loop closure detection accordingly but still am not able to get an appreciable map.

fayyazpocker commented 5 years ago

@SirVer @damienrg @wjwwood @damonkohler @ojura

Yu-Xiaoxian commented 5 years ago

Did your problem get solved?

fayyazpocker commented 5 years ago

Thanks for replying. I tried to tune the following parameters for local slam keeping the sampling ratio as zero:

Then after getting appreciable results, i tuned for global slam by tuning the following parameters:

It was a tedious process to tune these parameters as i was not able to understand the pattern of the parameters. So i had to make a bash script which runs different parameters and take screenshots of the RViz every 20s continuously for two days and finally ended up with this configuration:

TRAJECTORY_BUILDER_2D.min_range = 0.05 TRAJECTORY_BUILDER_2D.max_range = 8 TRAJECTORY_BUILDER_2D.use_online_correlative_scan_matching = false TRAJECTORY_BUILDER_2D.ceres_scan_matcher.translation_weight=1200 TRAJECTORY_BUILDER_2D.ceres_scan_matcher.rotation_weight=600 TRAJECTORY_BUILDER_2D.submaps.num_range_data = 100 POSE_GRAPH.optimize_every_n_nodes = 100 TRAJECTORY_BUILDER_2D.submaps.range_data_inserter.probability_grid_range_data_inserter.hit_probability = 0.65 TRAJECTORY_BUILDER_2D.submaps.range_data_inserter.probability_grid_range_data_inserter.miss_probability = 0.40 POSE_GRAPH.constraint_builder.min_score=0.75 POSE_GRAPH.optimization_problem.huber_scale=1 POSE_GRAPH.constraint_builder.sampling_ratio=0.3

This configuration gave me a good result as shown below: ceres_trans_1200_rot_600_score_0 7_sr_0 3_huber_1

I am not sure if this is the correct way to tune the paramters by trial and error. It would be helpful if you could suggest a more systematic way to tune the parameters. Also, if possible can you please have a look at the bag file and the new configuration?