cartographer-project / cartographer_ros

Provides ROS integration for Cartographer.
Apache License 2.0
1.64k stars 1.2k forks source link

Help required with tuning global SLAM loop closure in 2D #1119

Closed frederikscholz closed 3 years ago

frederikscholz commented 5 years ago

Hello,

after getting satisfactory results with my local SLAM, I am now having a little bit of trouble with achieving proper loop closure when procuring a larger map. I'd be grateful for any pointers towards which values seem off and should be tuned.

[Solved partially, thanks @ojura] Also, whenever I save the occupancy_grid as a map, it is somehow mirrored and the obstacles don't show up in the resulting .pgm file, does anyone know what could cause this issue, or how I could mirror the .yaml file? [edit] Saving the map from the pbstream fixed the obstacles not showing up, but unfortunately the map is still mirrored

Thanks, Frederik

rdesc commented 5 years ago

frame_id "base_link" is send on multiple topics. It was seen at least on /scan and /naoqi_driver_node/imu/torso

This needs to be fixed. Your imu sensor should have its own frame id coming down from the base_link.

Time delta histogram for consecutive messages on topic "/scan" (frame_id: "base_link")

Ideally same with your scan sensor. I'll leave it to others to comment on your .lua file.

Whats the command you use to save the occupancy grid map?

frederikscholz commented 5 years ago

frame_id "base_link" is send on multiple topics. It was seen at least on /scan and /naoqi_driver_node/imu/torso

This needs to be fixed. Your imu sensor should have its own frame id coming down from the base_link.

Time delta histogram for consecutive messages on topic "/scan" (frame_id: "base_link")

Ideally same with your scan sensor. I'll leave it to others to comment on your .lua file.

I'll look into that, thank you!

Whats the command you use to save the occupancy grid map?

rosrun map_server map_saver -f

ojura commented 5 years ago

Instead of using the map saver, I would recomend saving the Cartographer state into a .pbstream and using Cartographer's own pbstream_to_ros_map tool.

Map_saver does agressive thresholding and messes up the walls in Cartographer's maps, IIRC.

Another alternative to map saver if you have the occupancy grid node running would be saving the map message published on /map either with rosbag record /map, or rostopic echo /map -n 1 piped into a .yaml file.

frederikscholz commented 5 years ago

I didn't know about that tool, thank you! Could you tell me how to run it?

I'll try both of those approaches as well, thanks.

ojura commented 5 years ago

Try running the tool with -help. It should print out the command line options (flags).

frederikscholz commented 5 years ago

It worked, thank you! I'd been stuck on that for a while now.

ojura commented 5 years ago

The map being mirrored sounds your tracking frame-> laser frame transform is wrong. Maybe your lidar data should be interpreted as in your lidar was mounted upside down? In any case, sounds like a problem with your data.