ROS Package

Installation

Requirements

  • ROS : noetic is recommended. (If you have built OpenCV (3.3.1 or later) manually, you can use melodic or later.)

  • OpenVSLAM

  • image_transport : Required by this ROS package examples.

  • cv_bridge : Please build it with the same version of OpenCV used in OpenVSLAM.

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.

Install the dependencies via apt.

apt update -y
apt install ros-${ROS_DISTRO}-image-transport

Download the source of cv_bridge.

mkdir -p ~/catkin_ws/src
git clone --branch ${ROS_DISTRO} --depth 1 https://github.com/ros-perception/vision_opencv.git
cp -r vision_opencv/cv_bridge ~/catkin_ws/src
rm -rf vision_opencv

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 ros --depth 1 https://github.com/OpenVSLAM-Community/openvslam_ros.git
cd ~/catkin_ws
catkin_make -DUSE_PANGOLIN_VIEWER=ON -DUSE_SOCKET_PUBLISHER=OFF

Examples

Run the core program required for ROS-based system in advance.

roscore

Note

Please leave the roscore run.

Publisher

If you want to input image sequences or videos into openvslam_ros, please use ROS2.

Publish Images of a USB Camera

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

apt install ros-${ROS_DISTRO}-usb-cam
rosparam set usb_cam/pixel_format yuyv
rosrun usb_cam usb_cam_node

Republish the ROS topic to /camera/image_raw.

rosrun image_transport republish \
    raw in:=/usb_cam/image_raw 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 ~/catkin_ws/devel/setup.bash
rosrun 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 ~/catkin_ws/devel/setup.bash
rosrun openvslam_ros run_localization \
    -v /path/to/orb_vocab.fbow \
    -c /path/to/config.yaml \
    --map-db /path/to/map.msg