rtabmap localization current position

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

rtabmap localization current position

rasulnrasul
Hi Mathieu,

I am using RTAB-map for slam and localization in no-event way( also i am using Standalone RTAB-map not ROS version).  My query is during the localization can I use the result "getLastLocalizationPose" as the current position or is there any better way ?



------- NoEventsExample Code Snippet ---------------

while(data.isValid() && mapBuilder.isVisible())
{
        if(cameraIteration++ % odomUpdate == 0)
        {
                OdometryInfo info;
                Transform pose = odom.process(data, &info);

                if(odometryIteration++ % mapUpdate == 0)
                {
                        if(rtabmap.process(data, pose))
                        {
                                mapBuilder.processStatistics(rtabmap.getStatistics());
                                if(rtabmap.getLoopClosureId() > 0)
                                {
                                        printf("Loop closure detected!\n");
                                        rtabmap::Transform rtab_pose = rtabmap.getLastLocalizationPose();
                                        printf("Localized Pose: %s\n", rtab_pose.getLastLocalizationPose().prettyPrint().c_str());


                                }else
                                {
                                        printf("Not localized\n");
                                }
                        }
                }

                mapBuilder.processOdometry(data, pose, info);
        }

        QApplication::processEvents();

        while(mapBuilder.isPaused() && mapBuilder.isVisible())
        {
                uSleep(100);
                QApplication::processEvents();
        }

        data = camera.takeImage();
}



Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: rtabmap localization current position

matlabbe
Administrator
Hi,

These two approaches would give the same result:
Transform rtab_pose = rtabmap.getLastLocalizationPose();
Transform rtab_pose = rtabmap.getMapCorrection()*pose;
To make a comparison with ROS, "rtab_pose" will be the pose in /map frame as "pose" is the pose in /odom frame.

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: rtabmap localization current position

rasulnrasul
This post was updated on .
Thanks for your reply.

During the localization sometimes its not localizing (  rtabmap.getLoopClosureId() > 0 is not true ).  In my case about 15% of the time camera is not localized, I am using realsense camera at 30Hz). Can suggest how to better handle this case.