How to integrate external map->odom transform into rtabmap?
Hi, I have a question about localization of a robot and integrating rtabmap_ros with an external localization source that provide map->odom transform.
I have an instance of the robotlocalization package that combine information from wheel encoders and visual odometry to provide the odom->baselink transform.
Then there is another custom node that combine information from landmarks with the previous localization source and output a map->odom tf. The output position is in the map frame because it is not continous.
Moreover I have the rtabmap node that generates the map, but it also output the map->odom tf.
So my questions are:
- If I disable the map->odom publishing of rtabmap, to use only the one from the custom node, will rtabmap still be able to detect loop closure and optimize the map?
- There is a way to integrate correctly the map->odom tf published by the other node into rtabmap?
I found this question that is related: https://answers.ros.org/question/225694/interfacing-rtabmap-and-robot_localization/ But it is quite old and I don't know if now there is a better way to do this.
I am using ROS Noetic
Asked by AlessioParmeggiani on 2023-02-26 03:52:47 UTC
Answers
For your first question, rtabmap will still detect loop closures, but the map frame inside of the map topic won't mean the same thing than external TF map frame. The map may look odd in rviz.
For your second question, the short answer: you can't.
The long answer, it depends what is represented by your external map->odom, thus some other data can be fed to rtabmap instead:
- If your external map->odom is coming from another SLAM system (that is working in its own reference frame), there is not that much you can do, as both SLAMs will drift differently from each other (as they won't detect the same loop closures). You would have to chose one or the other.
- If the external /map -> /odom represents a world frame (e.g., combined GPS + wheel odometry using
robot_localizationpackage), you may feed the pose /map -> /base_link of that system asglobal_poseinput topic to rtabmap node, which will use it as prior. The internal graph will optimized in that coordinate frame, thus /map -> /odom published by rtabmap will include your external global pose estimation. The TF from that external node would have to be disabled, and let rtabmap provide /map -> /odom. - If your external pose is GPS, feed it
/gps/fixas input topic of rtabmap.
In localization mode, you can disable /map -> /odom published from rtabmap, and feed its localization_pose to some other node doing fusion with other global poses.
Asked by matlabbe on 2023-03-02 21:49:52 UTC
Comments
Thanks for the answer, I'll try your suggestion :)
Asked by AlessioParmeggiani on 2023-03-06 04:48:02 UTC
Comments
Hopefully this is the answer you are looking for. AMCL and rtabmap are only to correct for errors in wheel odometry and visual odometry in your case. What you should be doing is the visual odometry + the wheel odometry node broadcasts odom -> base_link and rtabmap broadcasts map -> odom to adjust for errors. This is because rtabmap is very jumpy and would not be very reliable and wheel odometry + visual odometry is very smooth. this video explains this very well (watch starting at 3:22 ROS and SLAM video chapter. This is for ROS 2 not ROS 1) https://www.youtube.com/watch?v=ZaiA3hWaRzE
Asked by bribri123 on 2023-02-28 21:14:54 UTC