ROS2 Package




Tested for Ubuntu 18.04.

Please install the following dependencies.


Please build OpenVSLAM with PangolinViewer or SocketViewer if you plan on using it for the examples.

Download repositories of image_common and vision_opencv.

midir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone -b ${ROS_DISTRO} --single-branch
git clone -b ros2 --single-branch

For using USB cam as a image source, donload a repository of demos and pick image_tools module.

cd ~/ros2_ws
git clone
cp -r demos/image_tools src/
rm -rf demos

Build Instructions

When building with support for PangolinViewer, please specify the following cmake options: -DUSE_PANGOLIN_VIEWER=ON and -DUSE_SOCKET_PUBLISHER=OFF as described in build of OpenVSLAM. openvslam and openvslam_ros need to be built with the same options.

cd ~/catkin_ws/src
git clone --branch ros2 --depth 1
cd ~/ros2_ws
colcon build --symlink-install --cmake-args -DUSE_PANGOLIN_VIEWER=ON -DUSE_SOCKET_PUBLISHER=OFF



If you want to input image sequences or videos into openvslam_ros, please refer to dataset_publisher_ros2.

Publish Images Captured by a USB Camera

For using a standard USB camera for visual SLAM or localization.

ros2 run image_tools cam2image

Republish the ROS topic to /camera/image_raw.

ros2 run image_transport republish \
    raw in:=image raw out:=/camera/image_raw


Subscribers continually receive images. Please execute one of the following command snippets in the new terminal.


Option arguments are the same as the examples of OpenVSLAM.

Tracking and Mapping

We provide an example snippet for visual SLAM. The source code is placed at openvslam_ros/src/

source ~/ros2_ws/install/setup.bash
ros2 run openvslam_ros run_slam \
    -v /path/to/orb_vocab.fbow \
    -c /path/to/config.yaml


We provide an example snippet for localization based on a prebuilt map. The source code is placed at openvslam_ros/src/

source ~/ros2_ws/install/setup.bash
ros2 run openvslam_ros run_localization \
    -v /path/to/orb_vocab.fbow \
    -c /path/to/config.yaml \
    --map-db /path/to/map.msg