ORB-SLAM2 编译记录

ORB-SLAM2编译记录

由于之前已经编译过ORB-SLAM3,大部分库都已经配置好了,这次主要只了处理两个错误

1. error: usleep is not declared in this scope

“/xxx/xxx/ORB_SLAM2/Examples/Stereo/stereo_euroc.cc:169:13: error: ‘usleep’ was not declared in this scope”,“usleep((T-ttrack)*1e6);”;
“/home/qyz/ORB_SLAM2/Examples/Stereo/stereo_euroc.cc:169:13: error: ‘usleep’ was not declared in this scope”,“usleep((T-ttrack)*1e6);”
作者在多个文件中使用了usleep()这个函数,但是却好像忘了包含相关的头文件,只需在报错的文件中加入下面内容即可:

#include 
#include 
#include 

如果不想一次次试,可以把下面这些文件里全加上(github的兄弟总结的)

Still it needs to be added in some of these files!!

/home/orbslam/ORB_SLAM2/src/Converter.cc
/home/orbslam/ORB_SLAM2/src/Frame.cc
/home/orbslam/ORB_SLAM2/src/FrameDrawer.cc
/home/orbslam/ORB_SLAM2/src/Initializer.cc
/home/orbslam/ORB_SLAM2/src/KeyFrame.cc
/home/orbslam/ORB_SLAM2/src/KeyFrameDatabase.cc
/home/orbslam/ORB_SLAM2/src/LocalMapping.cc
/home/orbslam/ORB_SLAM2/src/LoopClosing.cc
/home/orbslam/ORB_SLAM2/src/Map.cc
/home/orbslam/ORB_SLAM2/src/MapDrawer.cc
/home/orbslam/ORB_SLAM2/src/MapPoint.cc
/home/orbslam/ORB_SLAM2/src/Optimizer.cc
/home/orbslam/ORB_SLAM2/src/ORBextractor.cc
/home/orbslam/ORB_SLAM2/src/ORBmatcher.cc
/home/orbslam/ORB_SLAM2/src/PnPsolver.cc
/home/orbslam/ORB_SLAM2/src/Sim3Solver.cc
/home/orbslam/ORB_SLAM2/src/System.cc
/home/orbslam/ORB_SLAM2/src/Tracking.cc
/home/orbslam/ORB_SLAM2/src/Viewer.cc

参考:https://github.com/raulmur/ORB_SLAM2/issues/337,https://github.com/raulmur/ORB_SLAM2/pull/577

2. Pangolin could not be found because dependency Eigen3 could not be found

这个是由于Pangolin版本过高导致的,一开始我还以为是find不到Eigne3,差点给Eigen卸载了,得亏后来阅读了下报错的CMakeLists.txt的行数,是Pangolin的问题,换成0.5版本的即可

  • 找到pangolin安装时的build文件夹,cd进去,来个sudo make unintall
  • 切换到/usr/local/include 删除pangolin文件夹,rm -r pangolin
  • 重新安装Pangolin0.5
mkdir build && cd build
cmake ..
make -j
sudo make install

cmake,make,install三连,直接安装到/usr/local/include,重新编译ORB-SLAM2,成功
参考:https://blog.csdn.net/ssstarr/article/details/121089975
请添加图片描述

3. 在TUM数据集上测试

下载TUM数据集的第一个sequence并解压,根据官网提示,在ORB-SLAM2目录下输入以下命令

./Examples/Monocular/mono_tum Vocabulary/ORBvoc.txt Examples/Monocular/TUM1.yaml /home/qyz/Downloads/rgbd_dataset_freiburg1_xyz

ORB-SLAM2 编译记录_第1张图片

你可能感兴趣的:(Computer,Vision,slam,orb)