Re: Issues with TF when Using ROS2 Bag Files in RTAB-Map
Posted by
matlabbe on
URL: http://official-rtab-map-forum.206.s1.nabble.com/Issues-with-TF-when-Using-ROS2-Bag-Files-in-RTAB-Map-tp10836p10848.html
It depends if slam_toolbox relies on /tf, if not it may indeed just work. With rtabmap, we use /tf as input, so if you are replaying a bag, make sure to play with `--clock` option and launch all rtabmap nodes with `use_sim_time:=true` parameter.
Example using your bag:
ros2 launch rtabmap_launch rtabmap.launch.py rgb_topic:=/right/image_rect camera_info_topic:=/right/camera_info depth_topic:=/stereo/depth approx_sync:=false frame_id:=oak-d-base-frame use_sim_time:=true args:="-d"
ros2 bag play THU_W_01_0.db3 --clock
Note also when you record TF tree, use use_sim_time so that the "Recorded at time" matches to time inside the bag:
$ ros2 run tf2_tools view_frames --ros-args -p use_sim_time:=true
$ ros2 bag info THU_W_01_0.db3
Files: THU_W_01_0.db3
Bag size: 8.3 GiB
Storage id: sqlite3
Duration: 291.330804871s
Start: Nov 25 2024 07:54:40.283935768 (1732550080.283935768)
End: Nov 25 2024 07:59:31.614740639 (1732550371.614740639)
...

Is looks like the frame names are different in the bag than in the picture you shown, but look at the timestamps in the tree, they should be around the time recorded in the bag. If not, you will get TF warnings like you had in rviz.