2021-09-14 15:41:50 -04:00
rtabmap_ros [](https://github.com/introlab/rtabmap_ros/actions/workflows/ros2.yml)
2014-11-25 17:51:23 -05:00
===========
2021-10-05 18:05:26 -04:00
RTAB-Map's ROS2 package (branch `ros2` ). **ROS2 Foxy minimum required** : currently most nodes are ported to ROS2, however they are not all tested yet. The interface is the same than on ROS1 (parameters and topic names should still match ROS1 documentation on [rtabmap_ros ](http://wiki.ros.org/rtabmap_ros )).
2021-10-05 18:01:30 -04:00
`rtabmap.launch` is also ported to ROS2 with same arguments. If you see [ROS1 examples ](http://wiki.ros.org/rtabmap_ros/Tutorials/HandHeldMapping ) like this:
```bash
2022-10-01 11:22:26 -07:00
roslaunch zed_wrapper zed_no_tf.launch
2021-10-05 18:01:30 -04:00
2022-10-01 11:22:26 -07:00
roslaunch rtabmap_ros rtabmap.launch \
2021-10-05 18:01:30 -04:00
rtabmap_args:= "--delete_db_on_start" \
rgb_topic:= /zed/zed_node/rgb/image_rect_color \
depth_topic:= /zed/zed_node/depth/depth_registered \
camera_info_topic:= /zed/zed_node/rgb/camera_info \
frame_id:= base_link \
2021-11-08 18:36:19 -05:00
approx_sync:= false \
wait_imu_to_init:= true \
imu_topic:= /zed_node/imu/data
2021-10-05 18:01:30 -04:00
```
The ROS2 equivalent is (with those [lines ](https://github.com/stereolabs/zed-ros2-wrapper/blob/b512dce6ad4565f4770273995b147122e735ca0f/zed_wrapper/config/common.yaml#L58-L60 ) set to false to avoid TF conflicts):
```bash
2022-10-01 11:22:26 -07:00
ros2 launch zed_wrapper zed.launch.py
2021-10-05 18:01:30 -04:00
2022-10-01 11:22:26 -07:00
ros2 launch rtabmap_ros rtabmap.launch.py \
2021-10-05 18:01:30 -04:00
rtabmap_args:= "--delete_db_on_start" \
rgb_topic:= /zed/zed_node/rgb/image_rect_color \
depth_topic:= /zed/zed_node/depth/depth_registered \
camera_info_topic:= /zed/zed_node/rgb/camera_info \
frame_id:= base_link \
2021-11-08 18:36:19 -05:00
approx_sync:= false \
wait_imu_to_init:= true \
imu_topic:= /zed/zed_node/imu/data \
2022-10-01 11:22:26 -07:00
qos:= 1 \
rviz:= true
2021-10-05 18:01:30 -04:00
```
2021-11-08 18:36:19 -05:00
`qos` (Quality of Service) argument should match the published topics QoS (1=RELIABLE, 2=BEST EFFORT). ROS1 was always RELIABLE.
2014-11-25 17:51:23 -05:00
2017-03-23 13:45:50 -04:00
# Installation
2014-11-27 13:51:23 -05:00
2020-01-30 17:18:48 -05:00
* RTAB-Map ROS2 package:
```bash
2022-10-01 11:22:26 -07:00
cd ~/ros2_ws
git clone https://github.com/introlab/rtabmap.git src/rtabmap
git clone --branch ros2 https://github.com/introlab/rtabmap_ros.git src/rtabmap_ros
export MAKEFLAGS="-j6" # Can be ignored if you have a lot of RAM (>16GB)
2022-10-05 12:02:00 -07:00
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
2020-01-30 17:18:48 -05:00
` ``
2014-11-27 13:51:23 -05:00
2021-10-14 16:11:56 -04:00
* To build with ` rgbd_cameras>1` support and/or ` subscribe_user_data` support:
` ``bash
2022-10-05 12:02:00 -07:00
colcon build --symlink-install --cmake-args -DRTABMAP_SYNC_MULTI_RGBD=ON -DRTABMAP_SYNC_USER_DATA=ON -DCMAKE_BUILD_TYPE=Release
2021-10-14 16:11:56 -04:00
` ``
2021-10-05 18:01:30 -04:00
# Example with Turtlebot3
2014-11-27 13:51:23 -05:00
2021-10-05 18:01:30 -04:00
1. Launch Turtlebot3 simulator:
` ``bash
2022-10-01 11:22:26 -07:00
export TURTLEBOT3_MODEL=waffle
ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py
2021-10-05 18:01:30 -04:00
2022-10-01 11:22:26 -07:00
export TURTLEBOT3_MODEL=waffle
ros2 run turtlebot3_teleop teleop_keyboard
2021-10-05 18:01:30 -04:00
` ``
2. Launch RTAB-Map:
` ``
2022-10-01 11:22:26 -07:00
ros2 launch rtabmap_ros turtlebot3_scan.launch.py
2021-10-05 18:01:30 -04:00
# OR with rtabmap.launch.py
2022-10-01 11:22:26 -07:00
ros2 launch rtabmap_ros rtabmap.launch.py \
2021-10-05 18:01:30 -04:00
visual_odometry:=false \
frame_id:=base_footprint \
subscribe_scan:=true depth:=false \
approx_sync:=true \
odom_topic:=/odom \
scan_topic:=/scan \
2021-11-08 18:36:19 -05:00
qos:=2 \
2021-10-05 18:01:30 -04:00
args:="-d --RGBD/NeighborLinkRefining true --Reg/Strategy 1" \
2022-10-01 11:22:26 -07:00
use_sim_time:=true \
rviz:=true
2021-10-05 18:01:30 -04:00
` ``
2015-10-06 09:51:31 -04:00
2022-01-29 18:01:08 -05:00
3. Launch navigation (` nav2_bringup` package should be installed):
2017-03-23 13:45:50 -04:00
` ``
2022-10-01 11:22:26 -07:00
ros2 launch nav2_bringup navigation_launch.py use_sim_time:=True
ros2 launch nav2_bringup rviz_launch.py
2022-01-29 18:01:08 -05:00
` ``
2021-10-05 18:01:30 -04:00
See [launch/ros2 ](https://github.com/introlab/rtabmap_ros/tree/ros2/launch/ros2 ) subfolder for some other ROS2 examples with turtlebot3 in simulation and a RGB-D camera.