RTABMap is awsome - I've a simple iRobot create base, with Xtion and Neato XV-11 providing laser and RGB-D, and RTABMap is able to build nice 2D map 3D point cloud. I run it in mapping mode but run navigation move_base node that maintain costmaps. I figured out that when RTABMap is in localization mode the map doesn't change nor 'move around', but in mapping mode it moves so much it completely dis-aligned with costmap in matter of seconds. I run it with laser enabled, and my odometry do need to be calibrated. Is there an option that 'nails down' maps during mapping? Does it make sense?
In mapping mode, there are some events that can trigger a map update:
Pose correction with the laser scans (if "RGBD/PoseScanMatching"="true")
Loop closure detection
Transfer/Retrieval of nodes (if "Rtabmap/TimeThr" > "0")
If "RGBD/OptimizeFromGraphEnd" = "true", the whole map is always optimized from the last pose instead of the first pose in the map. You can try to enable/disable it to see what happens. Well, if you set to false, the map will be "nailed down" on the first node of the map.
Thanks!! It was the OptimizeFromGraphEnd - when I set that to True and run RTABMap in mapping mode, the navigation local costmap will get out of alignment whenever map get updated. Setting that to false and map indeed get nailed down similar to hector mapping in slam mode.
It is still strange that with RGBD/OptimizeFromGraphEnd = true, the costmap of move_base doesn't "follow" the map published by rtabmap. For navigation though, it could be easier to use RGBD/OptimizeFromGraphEnd=false because the map's referential doesn't change.