运行ORB-SLAM2
运行教程参考ORB_SLAM2_detailed_comments,但是遇到报错,在文章中有说明,可参照这篇博客操作:ORB_SLAM2–源码编译。
运行ORB_Line_SLAM 资料较少,测试发现其编译步骤与ORB_SLAM2相同,但是编译过程中遇到报错1:
/home/xiujie/Downloads/ORB_Line_SLAM-master/src/Tracking.cc: In member function ‘bool ORB_SLAM2::Tracking::TrackWithMotionModelWithLine()’:
/home/xiujie/Downloads/ORB_Line_SLAM-master/src/Tracking.cc:1358:9: error: ‘random_device’ was not declared in this scope; did you mean ‘random_data’?
1358 | random_device rnd_dev;
| ^~~~~~~~~~~~~
| random_data
/home/xiujie/Downloads/ORB_Line_SLAM-master/src/Tracking.cc:1359:9: error: ‘mt19937’ was not declared in this scope
1359 | mt19937 rnd(rnd_dev());
| ^~~~~~~
/home/xiujie/Downloads/ORB_Line_SLAM-master/src/Tracking.cc:1364:50: error: ‘rnd’ was not declared in this scope; did you mean ‘rand’?
1364 | cv::Scalar color = Scalar(color_dist(rnd), color_dist(rnd), color_dist(rnd));
| ^~~
| rand
/home/xiujie/Downloads/ORB_Line_SLAM-master/src/Tracking.cc:1397:9: error: ‘random_device’ was not declared in this scope; did you mean ‘random_data’?
1397 | random_device rnd_dev;
| ^~~~~~~~~~~~~
| random_data
/home/xiujie/Downloads/ORB_Line_SLAM-master/src/Tracking.cc:1398:9: error: ‘mt19937’ was not declared in this scope
1398 | mt19937 rnd(rnd_dev());
| ^~~~~~~
/home/xiujie/Downloads/ORB_Line_SLAM-master/src/Tracking.cc:1403:50: error: ‘rnd’ was not declared in this scope; did you mean ‘rand’?
1403 | cv::Scalar color = Scalar(color_dist(rnd), color_dist(rnd), color_dist(rnd));
| ^~~
| rand
报错2:
/home/xiujie/Downloads/ORB_Line_SLAM-master/src/Tracking.cc:2382:13: error: ‘usleep’ was not declared in this scope
2382 | usleep(3000);
针对报错1不要按照它的提示修改文件,参照博客编译stvo-pl报错error: ‘random_device’ was not declared in this scope 解决方案,我选用在报错的.h文件内添加万能头文件,只在报错文件添加即可。
#include<bits/stdc++.h>
针对报错2,参考博客编译orbslam2出现的error: ‘usleep’ was not declared in this scope usleep(3000),只需要在报错的相关.h文件内添加
#include<unistd.h>
两个SLAM代码至此编译成功!