1、在github上clone相关程序
git clone https://github.com.cnpmjs.org/raulmur/ORB_SLAM2.git ORB_SLAM2
2、编译build.sh
cd ORB_SLAM2
chmod +x build.sh
./build.sh
在此我遇到了问题,编译报错,(error:‘usleep’ was not declared in this scope)查阅资料得知需要在以下几个文件中添加语句
#include<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
然后可以在src文件中检查是否出现了文件libORB_SLAM2.so
3、在TUM官网上下载数据集
并且下载好它的associate.py程序,放在跟depth.txt以及rgb.txt的文件夹里面(当然也可以选择其他的,这样方便一点)
用它生成代码
python associate.py rgb.txt depth.txt > associations.txt
之后你就会看到生成associations.txt文件
4、跑通数据集
注意好文件放在哪即可,以及它需要输入几个参数,这个一定呀注意别输错了,我就是试了好几次
./Examples/RGB-D/rgbd_tum Vocabulary/ORBvoc.txt Examples/RGB-D/TUM1.yaml Examples/RGB-D/rgbd_dataset_freiburg1_xyz Examples/RGB-D/rgbd_dataset_freiburg1_xyz/associations.txt
接下来就可以直接看见运行结果啦