天天看點

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.

不然在初始化後就會崩潰。