Re: Handling robot being lost during localization mode

Posted by matlabbe on
URL: http://official-rtab-map-forum.206.s1.nabble.com/Handling-robot-being-lost-during-localization-mode-tp10073p10079.html

Hi,

RGBD/OptimizeMaxError is quite low, I use between 2 and 4 generally. I would set 1 if I know that odometry has very very low drift.

1) In localization mode, there will be a /rtabmap/localization_pose topic published. It has covariance that can be used on your side to know if the robot is "lost" or not. Similarly, we can set parameter "loc_thr" (in meters) to rtabmap node to publish in ros diagnostics if rtabmap is localized or not (if localization error is under loc_thr, ros diagnostic will show rtabmap localized, otherwise it will say it is not).

2) You can call /rtabmap/trigger_new_map service, it will flush the current localization cache.

3) If rtabmap is constantly rejecting localization, it means there was a link added at some point with wrong covariance that makes all future graph optimization failing. The localization cache should be cleared, or the bad link will eventually be removed from the cache after RGBD/MaxOdomCacheSize updates (default 10) anyway.

If you want to dynamically adjust RGBD/OptimizeMaxError, you can can the parameter on rosparam, then call /rtabmap/update_parameters service. On ros2, you may just need to update the parameter of the node, there should be a callback called when the value is changed without having to explicitly call /rtabmap/update_parameters.

cheers,
Mathieu