I'm using RTAB-Map in ROS to provide a robot with global localization. When running in localization mode, RTAB-Map sometimes fails to localize the robot immediately, requiring it to be manually driven across the environment for a while before it can localize itself. Is there any way to give RTAB-Map a hint of the robot's initial global pose, so it could always be localized (even if not very accurately) from the start?
There is no way to do that right now. THe best thing to do is to make sure to finish the run in front of location with a lot of visual features so that it can relocalize on the first frame on start. I opened an issue (https://github.com/introlab/rtabmap_ros/issues/220) to add such information for convenience, when we cannot ensure that the robot will finish in front a location easily recognizable.
The easiest way is to do it with RVIZ's "2D Pose Estimate" button by remapping (Panels->Tool Properties) its topic to /rtabmap/initialpose if rtabmap has been started in rtabmap namespace. The topic name can be found with: