ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Interfacing Rtabmap and Robot_Localization

asked 2016-02-02 11:32:11 -0600

Wagner2x gravatar image

updated 2016-02-04 10:12:11 -0600

matlabbe gravatar image


I am working to use robot_localization to take in info from a piksi gps, rp 2d lidar, and UM7 IMU and to give me a good estimate of where I am in space. I want to report this to rtabmap so I can relate this position to the 3d environment of my robot. When I run rtabmap without robot_localization everying works, however when I run robot_localization alongside rtabmap the odom frame drifts like crazy. I didn't know if this was an issue that you have seen before or not. Let me know what you need from me!

Here is my Launch file folder:

rtabmap Launch file called robo_loco.launch Robot Localization launch file called rgbd_mapping.launch

Thanks for all the help!

edit retag flag offensive close merge delete


The "odom frame drifts", do you mean /map->/odom or /odom->/base_link? Also, is it the output of robot_localization that is drifting? An IMU would drift over time (even if not moving), did you try IMU+visual odometry alone with one robot_localization (without the one for map)?

matlabbe gravatar image matlabbe  ( 2016-02-04 10:25:48 -0600 )edit

The IMU information that we had set up for RL to input was incorrect. Now that we have our launch files fixed rtabmap is working. However the instance of RL that does the tf from map to odom is not performing the transform. Running diagnostics we get /odom/filtered: no events recorded

Wagner2x gravatar image Wagner2x  ( 2016-02-08 19:20:25 -0600 )edit

I also re submitted another question for this issue titled Robot_Localization not publishing transform to odom

Wagner2x gravatar image Wagner2x  ( 2016-02-09 09:02:48 -0600 )edit

I don't think the second robot_localization node should be used for /map -> /odom transform. This transform is generally published by a node after global localization or correcting the map (after a loop closure for example) at low frequency (e.g., amcl or rtabmap nodes).

matlabbe gravatar image matlabbe  ( 2016-02-09 10:30:31 -0600 )edit

Does rtabmap provide the transform from map to odom if we only use one instance of RL? The whole reason we are using RL is to have a better representation of where we are in space so if we don't NEED to do the sensor fusion in RL to get this accuracy then that would be great.

Wagner2x gravatar image Wagner2x  ( 2016-02-09 12:21:42 -0600 )edit

Another issue has arose as well. When we try to run the scan matching rtabmap crashes and we have no idea why.

Wagner2x gravatar image Wagner2x  ( 2016-02-09 12:24:45 -0600 )edit

Yes, rtabmap node doesn't require robot_localization. robot_localization would be used to do odometry fusion of multiple sources (IMU, visual odometry, wheel odometry, etc...), giving the filtered odometry topic to rtabmap. With publish_tf=:true, rtabmap publishes /map->/odom.

matlabbe gravatar image matlabbe  ( 2016-02-09 13:36:21 -0600 )edit

For the crash, this may be related to this post

matlabbe gravatar image matlabbe  ( 2016-02-09 13:36:51 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-02-09 17:04:25 -0600

matlabbe gravatar image


I just read this page, using two robot_localization instances makes more sense now if you use a GPS.

The problem is that rtabmap doesn't know there is a GPS going on, it will generate its own /map -> /odom transform, which is the localization correction after a loop closure. This transform is relative to the starting position of the robot.

Without the GPS, a standard setup would be: image description

You could disable map optimization from rtabmap (<param name="RGBD/OptimizeIterations" type="string" value="0"/>) to avoid /map -> /odom publishing if the second robot_localization with GPS is publishing it too. Then use the output of the second robot_localization as input odometry for rtabmap node. The map will be created using poses including the GPS, so in some way the map will be already optimized (no loop closure detection required). There may be "jumps" in the generated map though when a GPS localization occurs. Note that the following is just an idea (I've never tested a system like that):

image description

cheers, Mathieu

edit flag offensive delete link more


Has anyone tested this (Rtabmap, Robot_Localization, and GPS) and can say whether it worked? Is the diagram connection marked with "???" actually correct?

danielsnider gravatar image danielsnider  ( 2017-04-11 12:46:30 -0600 )edit

Dear @matlabbe, Now that the tf: /map -> /odom is going to be created by robot_localization pkg, then from where the map will be loaded? where is the map have been stored?? and how it has been created and saved??

and Does rtabmap in this situation run in localization mode? yes? I mean we just need to launch rtabmap in localization mode, and deletd the parameter related to the database (~/.ros/database.db), am i I right?


Delbina gravatar image Delbina  ( 2021-07-28 05:19:54 -0600 )edit

and also what would happen if GPS for sometime not being available! because we have also disabled publishing tf in rtabmap. so what would happen in that case???

Kind Regards

Delbina gravatar image Delbina  ( 2021-07-30 05:01:03 -0600 )edit

Hi everyone, Does anyone have the tf tree of implementation of rtabmap with two instances of Robot_localization pkg?

Delbina gravatar image Delbina  ( 2021-08-05 01:42:05 -0600 )edit

The visual odometry source mentioned. Can this also be the rgbd_odometry node in rtabmap_ros? So the total setup includes both the rgbd_odometry and the rtabmap nodes? Would this be redundant, since both are using the same RGBD source for their computations?

JadTaw gravatar image JadTaw  ( 2021-12-22 09:39:55 -0600 )edit

Question Tools



Asked: 2016-02-02 11:32:11 -0600

Seen: 3,069 times

Last updated: Feb 09 '16