SLAM入门之ORBSLAM2编译运行

  1. ORBSLAM2的编译与运行

环境:Ubuntu16.04 ORBSLAM2

官网的源码和配置教程:https://github.com/raulmur/ORB_SLAM2

(1)安装工具

sudo apt-get install cmake
sudo apt-get install git
sudo apt-get install gcc g++  

(2) 安装pangolin

安装依赖项:

sudo apt-get install libglew-dev
sudo apt-get install libboost-dev libboost-thread-dev libboost-filesystem-dev
sudo apt-get install libpython2.7-dev

下载并安装

git clone https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
mkdir build
cd build
cmake -DCPP11_NO_BOOSR=1 ..
make -j
sudo make install

(3)安装opencv

ORBSLAM2支持opencv2和3,这里我安装的是opencv3.2.0

安装依赖:

sudo apt-get install build-essential
sudo apt-get install libgtk2.0-dev
sudo apt-get install pkg-config

去官网下载opencv3.2.0,将下载的OpenCV解压到自己的指定目录,然后cd到OpenCV的目录下

mkdir build
cd build
cmake ..
make
sudo make install

(4)安装Eigen3

在http://eigen.tuxfamily.org 下载Eigen3的最新版本,解压,cd到该目录下

mkdir build
cd build
cmake ..
make
sudo make install

(5)安装ORBSLAM2

clone它的源代码到ORB-SLAM2目录下:

git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2

cd 到该目录下

cd ORB_SLAM2
chmod +x build.sh
./build.sh

如果没有出错的话那么就编译完成了

如果出现这个错误:/home/yk/ORB_SLAM2-master/src/System.cc:236:28: error: ‘usleep’ was not declared in this scope
usleep(1000);

解决办法:This can be solved in one of two ways, including the proper header unistd.h, that was removed from Eigen headers, or better yet, using the now standard C++11 std::this_thread::sleep_for.
参考网页:https://github.com/raulmur/ORB_SLAM2/issues/254
it’s solved simply by adding
#include
in those error files
之后重新运行

./build.sh即可
(6)运行单目实例

下载数据集并解压

http://vision.in.tum.de/data/datasets/rgbd-dataset/download#freiburg1_desk

./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUM1.yaml /home/yk/桌面/rgbd_dataset_freiburg1_xyz

作者:zqnnn
来源:CSDN
原文:https://blog.csdn.net/zqnnn/article/details/79377051
版权声明:本文为博主原创文章,转载请附上博文链接!

你可能感兴趣的:(SLAM)