1.参考网站:
https://github.com/raulmur/ORB_SLAM2
一、开始安装
1.下载源码
git clone https://github.com/raulmur/ORB_SLAM2.git ORB_SLAM2
遇到问题
* GnuTLS recv error (-54): Error in the pull function.
* Closing connection 0
error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.
fatal: The remote end hung up unexpectedly
fatal: protocol error: bad pack header
尝试git config --global http.postBuffer 40000000
命令,也不行,改从该网站直接下载源码。下载后解压到自己的文件夹内。
二、编译
cd ORB_SLAM2
chmod +x build.sh
./build.sh
遇到问题1
/home/ning/1.software/ORB_SLAM2/src/LoopClosing.cc:630:20: error: ‘usleep’ was not declared in this scope
usleep(5000);
^
/home/ning/1.software/ORB_SLAM2/src/LoopClosing.cc: In member function ‘void ORB_SLAM2::LoopClosing::RunGlobalBundleAdjustment(long unsigned int)’:
/home/ning/1.software/ORB_SLAM2/src/LoopClosing.cc:670:28: error: ‘usleep’ was not declared in this scope
usleep(1000);
解决方案:
在出错的文件中 加上#include<unistd.h>
三、检查
编译完后,在ORB_SLAM2/lib文件夹下有libORB_SLAM2.so文件,在ORB_SLAM2/Example文件夹下有 mono_tum, mono_kitti, rgbd_tum, stereo_kitti, mono_euroc and stereo_euroc可执行文件
四、测试
1.下载数据集
网址:https://vision.in.tum.de/data/datasets/rgbd-dataset/download#freiburg1_rpy
随便下载一个数据集,在ORB_SLAM2文件下执行下面的命令
./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUMX.yaml PATH_TO_SEQUENCE_FOLDER
注:数据集版本和tumx.yaml文件应匹配。 Change TUMX.yaml to TUM1.yaml,TUM2.yaml or TUM3.yaml for freiburg1, freiburg2 and freiburg3 sequences respectively. Change PATH_TO_SEQUENCE_FOLDERto the uncompressed sequence folder.
可以看到成功运行啦