Rosanswers logo


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: https://github.com/zastrix/ROS-Launch-Files.git

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

Thanks for all the help!

Originally posted by Wagner2x on ROS Answers with karma: 3 on 2016-02-02

Post score: 0

Original comments

Comment by matlabbe on 2016-02-04:
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)?

Comment by Wagner2x on 2016-02-08:
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

Comment by Wagner2x on 2016-02-09:
I also re submitted another question for this issue titled Robot_Localization not publishing transform to odom

Comment by matlabbe on 2016-02-09:
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).

Comment by Wagner2x on 2016-02-09:
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.

Comment by Wagner2x on 2016-02-09:
Another issue has arose as well. When we try to run the scan matching rtabmap crashes and we have no idea why.

Comment by matlabbe on 2016-02-09:
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.

Comment by matlabbe on 2016-02-09:
For the crash, this may be related to this post

Comment by Wagner2x on 2016-02-09:
If we were integrating a swiftnav gps as well as the imu and visual odometry, wouldn't we need to run two instances of RL? We have set the publish_tf param to false and rtabmap is still publishing the transform. RL and rtabmap are fighting each other over this which I think is most of the issue.

Comment by matlabbe on 2016-02-09:
publish_tf to false should disable /map->/odom from rtabmap as in this code (the TF thread is not created). I'll will verify.


1 Answer 1


Rosanswers logo


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

Originally posted by matlabbe with karma: 6409 on 2016-02-09

This answer was ACCEPTED on the original site

Post score: 1

Original comments

Comment by danielsnider on 2017-04-11:
Has anyone tested this (Rtabmap, Robot_Localization, and GPS) and can say whether it worked? Is the diagram connection marked with "???" actually correct?

Comment by Delbina on 2021-07-28:
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?


Comment by Delbina on 2021-07-30:
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

Comment by Delbina on 2021-08-05:
Hi everyone, Does anyone have the tf tree of implementation of rtabmap with two instances of Robot_localization pkg?

Comment by JadTaw on 2021-12-22:
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?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.