编译运行ORB-SLAM2和ORB-Line-SLAM遇到问题总结

运行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代码至此编译成功!

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值