ROS2 Package

Installation

Requirements

Prerequisites

Tested for Ubuntu 18.04.

Please install the following dependencies.

Note

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 https://github.com/ros-perception/image_common.git
git clone -b ros2 --single-branch https://github.com/ros-perception/vision_opencv.git

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

cd ~/ros2_ws
git clone https://github.com/ros2/demos.git
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 https://github.com/OpenVSLAM-Community/openvslam_ros.git
cd ~/ros2_ws
colcon build --symlink-install --cmake-args -DUSE_PANGOLIN_VIEWER=ON -DUSE_SOCKET_PUBLISHER=OFF

Examples

Publisher

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

Subscriber

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

Note

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/run_slam.cc.

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

Localization

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

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