This repo includes SVO Pro which is the newest version of Semi-direct Visual Odometry (SVO) developed over the past few years at the Robotics and Perception Group (RPG). SVO was born as a fast and versatile visual front-end as described in the SVO paper (TRO-17). Since then, different extensions have been integrated through various research and industrial projects. SVO Pro features the support of different camera models, active exposure control, a sliding window based backend, and global bundle adjustment with loop closure.
In summary, this repository offers the following functionalities:
An example of the visual-inertial SLAM pipeline on EuRoC dataset is below (green points - sliding window; blue points - iSAM2 map):
SVO Pro and its extensions have been used to support various projects at RPG, such as our recent work on multiple camera SLAM, voxel map for visual SLAM and the tight-coupling of global positional measurements into VIO. We hope that the efforts we made can facilitate the research and applications of SLAM and spatial perception.
The code is licensed under GPLv3. For commercial use, please contact sdavide [at] ifi [dot] uzh [dot] ch
.
The visual-inertial backend is modified from OKVIS, and the license is retained at the beginning of the related files.
If you use the code in the academic context, please cite:
Additionally, please cite the following papers for the specific extensions you make use of:
Our recent publications that use SVO Pro are:
The code has been tested on
Install catkin tools and vcstools if you haven't done so before. Depending on your operating system, run
# For Ubuntu 18.04 + Melodic
sudo apt-get install python-catkin-tools python-vcstool
or
# For Ubuntu 20.04 + Noetic
sudo apt-get install python3-catkin-tools python3-vcstool python3-osrf-pycommon
Install system dependencies and dependencies for Ceres Solver
# system dep.
sudo apt-get install libglew-dev libopencv-dev libyaml-cpp-dev
# Ceres dep.
sudo apt-get install libblas-dev liblapack-dev libsuitesparse-dev
Create a workspace and clone the code (ROS-DISTRO
=melodic
/noetic
):
mkdir svo_ws && cd svo_ws
# see below for the reason for specifying the eigen path
catkin config --init --mkdirs --extend /opt/ros/<ROS-DISTRO> --cmake-args -DCMAKE_BUILD_TYPE=Release -DEIGEN3_INCLUDE_DIR=/usr/include/eigen3
cd src
git clone git@github.com:uzh-rpg/rpg_svo_pro_open.git
vcs-import < ./rpg_svo_pro_open/dependencies.yaml
touch minkindr/minkindr_python/CATKIN_IGNORE
# vocabulary for place recognition
cd rpg_svo_pro_open/svo_online_loopclosing/vocabularies && ./download_voc.sh
cd ../../..
There are two types of builds that you can proceed from here
Build without the global map (front-end + sliding window back-end + loop closure/pose graph)
catkin build
Build with the global map using iSAM2 (all functionalities)
First, enable the global map feature
rm rpg_svo_pro_open/svo_global_map/CATKIN_IGNORE
and in svo_cmake/cmake/Modules/SvoSetup.cmake
SET(USE_GLOBAL_MAP TRUE)
Second, clone GTSAM
git clone --branch 4.0.3 git@github.com:borglab/gtsam.git
and modify GTSAM compilation flags a bit:
# 1. gtsam/CMakelists.txt: use system Eigen
-option(GTSAM_USE_SYSTEM_EIGEN "Find and use system-installed Eigen. If 'off', use the one bundled with GTSAM" OFF)
+option(GTSAM_USE_SYSTEM_EIGEN "Find and use system-installed Eigen. If 'off', use the one bundled with GTSAM" ON)
# 2. gtsam/cmake/GtsamBuildTypes: disable avx instruction set
# below the line `list_append_cache(GTSAM_COMPILE_OPTIONS_PUBLIC "-march=native")`
list_append_cache(GTSAM_COMPILE_OPTIONS_PUBLIC "-mno-avx")
Using the same version of Eigen helps avoid memory issues. Disabling
avx
instruction set also helps with some segment faults in our experience (this can be however OS and hardware dependent).
And finally build the whole workspace
# building GTSAM may take a while
catkin build
Weird building issues after some tinkering. It is recommend to
catkin clean --all
at the workspace root) and rebuild your workspace (catkin build
)catkin build --force-cmake
after your have made changes to CMake files (CMakeLists.txt
or *.cmake
) to make sure the changes take effect.
Compiling/linking error related to OpenCV: find find_package(OpenCV REQUIRED)
in the CMakeLists.txt
files in each package (in rpg_common
, svo_ros
, svo_direct
, vikit/vikit_common
and svo_online_loopclosing
) and replace it with
# Ubuntu 18.04 + Melodic
find_package(OpenCV 3 REQUIRED)
# Ubuntu 20.04 + Noetic
find_package(OpenCV 4 REQUIRED)
Visualization issues with the PointCloud2: Using Points
to visualize PointCloud2
in RVIZ seems to be problematic in Ubuntu 20.04. We use other visualization types instead of Points
per default. However, it is good to be aware of this if you want to customize the visualization.
Pipeline crashes with loop closure enabled: If the pipeline crashes calling svo::loadVoc()
, did you forgot to download the vocabulary files as mentioned above?
cd rpg_svo_pro_open/svo_online_loopclosing/vocabularies && ./download_voc.sh
Inconsistent Eigen versions during compilation: The same Eigen should be used across the whole project (which should be system Eigen, since we are also using ROS). Check whether eigen_catkin
and gtsam
find the same version of Eigen:
# for eigen_catkin
catkin build eigen_catkin --force-cmake --verbose
# for gtsam
catkin build gtsam --force-cmake --verbose
Thanks to Simon Klenk, Manasi Muglikar, Giovanni Cioffi and Javier Hidalgo-Carrió for their valuable help and comments for the open source code.
The work is made possible thanks to the efforts of many contributors from RPG. Apart from the authors listed in the above papers, Titus Cieslewski and Henri Rebecq made significant contributions to the visual front-end. Jeffrey Delmerico made great efforts to apply SVO on different real robots, which in turn helped improve the pipeline. Many PhD and master students and lab engineers have also contributed to the code.
The Ceres-based optimization back-end is based on code developed at Zurich-eye, a spin-off from RPG. Jonathan Huber is the main contributor that integrated the back-end with SVO. Kunal Shrivastava (now CEO of SUIND) developed the loop closure module during his semester project and internship at RPG. The integration of the iSAM2-based global map was developed by Zichao Zhang.
We would like to thank our collaborators at Prophesee for pointing out several bugs in the visual front-end. Part of the code was developed during a funded project with Huawei.