天天看点

Ubuntu16.04下ORB_SLAM2的安装

2.安装必备软件:

(1)更新apt库

sudo apt-get update

(2)安装git

sudo apt-get install git

(3)安装cmake

sudo apt-get install cmake

(4)安装Pangolin

安装依赖:

a、openglGLEW:

sudo apt-get install libglew-dev

c、Boost:

sudo apt-get install libboost-dev libboost-thread-dev libboost-filesystem-dev

d、Python2/Python3:

sudo apt-get install libpython2.7-dev

e、编译基础库

sudo apt-get install build-essential

安装Pangolin:

git clone https://github.com/stevenlovegrove/Pangolin.git

cd Pangolin

在移动硬盘的常用软件中(编译过了)

mkdir build

cd build

cmake -DCPP11_NO_BOOST=1 …

make -j4

sudo make install

(5)安装OpenCV

安装依赖:

a、编译器相关:

sudo apt-get install build-essential

下面的是直接高博的:

sudo apt-get install libopencv-dev libeigen3-dev libqt4-dev qt4-qmake libqglviewer-dev libsuitesparse-dev
libcxsparse3.1.2 libcholmod-dev
           

可能会出现后面连个安装不上的情况,不用管libcxsparse3.1.2 libcholmod-dev

这个是网站上的

sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev
libavformat-dev libswscale-dev
           

安装Eigen

在常用软件包里

mkdir build
cd build
cmake ..
make
sudo make install
           

7)安装BLAS and LAPACK库

sudo apt-get install libblas-dev

sudo apt-get install liblapack-dev

如果在其中出现问题:

usleep未定义:
错误信息:

/home/melanie/source/SmartCar/ORM_SLAM2/ORB_SLAM2/src/Viewer.cc:159:28:

error: ‘usleep’ was not declared in this scope usleep(3000);

^CMakeFiles/ORB_SLAM2.dir/build.make:494: recipe for target

'CMakeFiles/ORB_SLAM2.dir/src/Viewer.cc.o' failedmake[2]:

*** [CMakeFiles/ORB_SLAM2.dir/src/Viewer.cc.o]

Error 1CMakeFiles/Makefile2:178: recipe for target 'CMakeFiles/ORB_SLAM2.dir/all' failedmake[1]: *** [CMakeFiles/ORB_SLAM2.dir/all]

Error 2Makefile:83: recipe for target 'all' failed

make: *** [all] Error 2

解决方案:

在source文件的开头增加include#include <unistd.h>

需要增加unistd.h的文件有:

Examples/Monocular/mono_euroc.cc

Examples/Monocular/mono_kitti.cc

Examples/Monocular/mono_tum.cc

Examples/RGB-D/rgbd_tum.cc

Examples/Stereo/stereo_euroc.cc

Examples/Stereo/stereo_kitti.cc

src/LocalMapping.cc

src/LoopClosing.cc

src/System.cc

src/Tracking.cc

src/Viewer.cc
           

记得按照ORB_SLAM2/build.sh的要求重新编译DBow和G20.

不然在初始化后就会崩溃。