I am just starting out with a project and I am a beginner at this.
I would be really grateful if anyone could help me out with a small query of mine.
When localization is started. How exactly does rtabmap's localization in the code work?
Which datastructure contains the localization information stating that the user is at this particular location with respect to the map.
The localization is a combination of odometry pose ("/odom -> /base_link") and odometry correction ("/map -> /odom"). The odometry correction is saved in Rtabmap::_mapCorrection member. "_mapCorrection" is updated when a loop closure happens. See Section 3.4 in this paper.
_mapCorrection is updated here in the code. "_optimizedPoses.at(signature->id())" should contain the current pose of the robot in map frame (/map -> /base_link) and "signature->getPose()" should contain the current pose of the robot in odometry frame (/odom -> /base_link). We multiply the first transform to inverse of the second to get /map -> /odom.
In ROS, to know the pose of the robot in the map, subscribe to TF and get /map -> /base_link.
Thanks for your help.
I had one more question. Let say I have the precomputed dB file of the map. Now I want to localize using that existing map but not by using a device such as Kinect. I have a ros bag file of the same location and I want to see if I can particular image from that and localize in my precomputed map. What would be a good way to go about this?
It is possible to configure rtabmap node to subscribe only to a rectified RGB image and corresponding camera info (when setting subscribe_depth to false). It will only work in localization mode when RGBD/Enabled is true (default true) and Mem/IncrementalMemory is false (default true). Also make sure that Vis/EstimationType=1 (default 1) to compute 2D->3D motion transformations.
If the camera doesn't the same resolution / field of view than the kinect, rtabmap may have more difficulty to localize. Some visual features are more invariant to scale than others, you may try different Kp/DetectorStrategy values.