ROS: Simultaneous Mapping and Localization with RTABmap

Background: Approaches to SLAM

  • The classic Kinect 1 or the new Kinect 2 cameras are affordable cameras with a good standing in ROS projects. Plenty examples exist. On the downside, there seem to be compatibility issues1, its hard to setup in recent ROS distributions2, and the proprietary connector needs to be spliced into USB and 12V Input voltage when using a mobile robot.
  • The RealSense Sensors are well supported in current ROS and ROS2 distributions 3, and the native SDK is also up-to-date and available on all current platforms 4. However. the image quality of this device is worse than that of a Kinect5, and they are more expensive.
  • Finally, the affordable RP Lidar A1M8 is also used in several projects and easy to setup6. Lidar is a technology primary for obstacle detection, it cannot be used to get an image from its surroundings, which is required when e.g. a robotic arms wants to pick up other items. Also, Lidar based navigation can be problematic indoors7.

Installing RTABmap

sudo apt-get install ros-noetic-rtabmap-ros ros-noetic-rtabmap

RTAB Mapping Mode

Starting the GUI

roslaunch rtabmap_ros $LAUNCH_FILE \
rtabmap_args:="--delete_db_on_start" \
rtabmapviz:=true \
roslaunch rtabmap_ros rtabmap.launch \
depth_topic:=/camera/depth/image_rect_raw/ \
rgb_topic:=/camera/color/image_raw \
camera_info_topic:=/camera/color/camera_info \
rtabmapviz:=true \

Parameter Tuning

  • Start rtabmap and check the opening log statement — they will mention at which directory your local config file will be stored, which defaults to ~/.ros/rtabmap_gui.ini
  • Grab one of the recommended starting configuration files: Raspberry Pi or Generic
  • Read the tuning tips, and apply them step-by-step in the rtabmap configuration at Tool/Preferences
roslaunch rtabmap_ros rtabmap.launch \
rtabmap_args:="--delete_db_on_start --Vis/MaxFeatures 500 --Mem/ImagePreDecimation 2 --Mem/ImagePostDecimation 2 --Kp/DetectorStrategy 6 --OdomF2M/MaxSize 1000 --Odom/ImageDecimation 2" \
approx_sync:=true \
queue_size:=30 \
compressed_rate:=1 \
noise_filter_radius:=0.05 \

RTAB Localization Mode

roslaunch rtabmap_ros rtabmap.launc\
localization:=true \
rtabmapviz:=true \

Viewing Map Data




  1. For example, when searching for questions regarding Kinect in the official ROS forum, it’s hard to find recent answers.
  2. In a great article about ROS on Raspberry Pi 4 with Kinect, the details of a long and challenging “configuration and compilation” journey can be found. The author decided to publish a fully configured Raspberry Pi 4 image, saving you lots of hassles he had endured.
  3. See the official Github repo
  4. The librealsense works on Linux, OsX and Windows.
  5. In this YouTube video, you can see the image quality compared between Kinect and RealSense
  6. For example in this Raspberry Pi 4 project.
  7. Watch this YouTube video to see where Lidar-based obstacle detection fails



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


IT Project Manager & Developer