一、OpenVSLAM主要工作
论文:Sumikura S, Shibuya M, Sakurada K. OpenVSLAM: A Versatile Visual SLAM Framework[C]//Proceedings of the 27th ACM International Conference on Multimedia. 2019: 2292-2295.
代码:https://github.com/xdspacelab/openvslam ;文档
创新:
- 支持多种相机的模型;
- 实现地图保存和加载,可以根据新的帧定位到保存的地图中的位置;
- 首个实现广角相机的开源SLAM框架;
- 相比于ORB-SLAM2,暴力匹配是可选择性的,所以匹配更加准确。
与其他框架的对比如下图所示:
部分算法原理:
- 前端使用非直接法,提取ORB特征点
- 具有三个线程:跟踪、建图和全局优化
二、OpenVSLAM的编译
git clone https://github.com/xdspacelab/openvslam
环境需求:
- Eigen : version 3.3.0 or later.
- g2o : Please use the latest release. Tested on commit ID 9b41a4e.
SuiteSparse : Required by g2o. - DBoW2 : Please use the custom version of DBoW2 released in https://github.com/shinsumicco/DBoW2.
- yaml-cpp : version 0.6.0 or later.
- OpenCV : version 3.3.1 or later.
安装依赖:
sudo apt-get update
sudo apt-get install build-essential pkg-config cmake git wget curl unzip
sudo apt-get install libatlas-base-dev libsuitesparse-dev
sudo apt-get install libgtk-3-dev
sudo apt-get install ffmpeg
sudo apt-get install libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libavresample-dev
sudo apt-get install libgoogle-glog-dev libgflags-dev
sudo apt-get install libopenblas-dev
sudo apt-get install --no-install-recommends libboost1.65-all-dev
sudo apt-get install libx11-dev
sudo apt-get install libgl1-mesa-dev
sudo apt-get install freeglut3-dev
sudo apt-get install doxygen
wget https://nchc.dl.sourceforge.net/project/glew/glew/2.1.0/glew-2.1.0.tgz --no-check-certificate
tar -xzvf glew-2.1.0.tgz && cd glew-2.1.0/
make -j2
sudo make install
sudo ln -s /usr/lib64/libGLEW.so.2.1 /usr/lib/libGLEW.so.2.1
sudo ldconfig -v
build工程:
cd 你的目录/openvslam
mkdir build && cd build
cmake \
-DBUILD_WITH_MARCH_NATIVE=ON \
-DUSE_PANGOLIN_VIEWER=ON \
-DUSE_SOCKET_PUBLISHER=OFF \
-DUSE_STACK_TRACE_LOGGER=ON \
-DBOW_FRAMEWORK=DBoW2 \
-DBUILD_TESTS=ON \
..
make -j4
如果cmake找不到依赖:
设置绝对路径,例如 当 CMAKE_INSTALL_PREFIX是 /usr/local:
Eigen3_DIR=/usr/local/share/eigen3/cmake
OpenCV_DIR=/usr/local/share/OpenCV
DBoW2_DIR=/usr/local/lib/cmake/DBoW2
g2o_DIR=/usr/local/lib/cmake/g2o
Pangolin_DIR=/usr/local/lib/cmake/Pangolin (if installed)
sioclient_DIR=/usr/local/lib/cmake/sioclient (if installed)
编译OpenVSLAM时遇到如下问题:
/usr/bin/ld: /usr/local/lib/libyaml-cpp.a(scanscalar.cpp.o): relocation R_X86_64_PC32 against symbol `ZNK4YAML5RegEx14MatchUncheckedINS_16StreamCharSourceEEEiRKT’ can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: 最后的链接失败: 错误的值
collect2: error: ld returned 1 exit status
src/openvslam/CMakeFiles/openvslam.dir/build.make:1926: recipe for target ‘lib/libopenvslam.so’ failed
make[2]: *** [lib/libopenvslam.so] Error 1
CMakeFiles/Makefile2:138: recipe for target ‘src/openvslam/CMakeFiles/openvslam.dir/all’ failed
make[1]: *** [src/openvslam/CMakeFiles/openvslam.dir/all] Error 2
Makefile:129: recipe for target ‘all’ failed
make: *** [all] Error 2
因为:yaml-cpp defaults to building a static library, but you may build a shared library by specifying -DYAML_BUILD_SHARED_LIBS=ON
.
所以在yaml-cpp的cmake选项上加上
-DYAML_BUILD_SHARED_LIBS=ON
重新编译yaml-cpp:
git clone https://github.com/jbeder/yaml-cpp
cd yaml-cpp
mkdir build && cd build
cmake \
-DYAML_BUILD_SHARED_LIBS=ON
-DCMAKE_BU ILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
..
make -j2
sudo make install
sudo ldconfig -v
最后重新编译openvslam即可
三、测试
TUM深度数据集
在build下运行
./run_tum_rgbd_slam \
-v /自己的路径/openvslam/voc/orb_vocab/orb_vocab.dbow2 \
-d /自己的路径/rgbd_dataset_freiburg1_360 \
-c ../example/tum_rgbd/TUM_RGBD_rgbd_1.yaml \
-a 自己的路径/associated.txt
Euroc单目数据集测试
同样在build下
#monocular SLAM with any EuRoC sequence
./run_euroc_slam \
-v /path/to/orb_vocab/orb_vocab.dbow2 \
-d /path/to/EuRoC/MAV/mav0/ \
-c ../example/euroc/EuRoC_mono.yaml