ubuntu20.04编译ORB-SLAM2 TUM数据集

https://blog.csdn.net/weixin_53660567/article/details/119823955?spm=1001.2014.3001.5501

在这片帖子里我已经介绍了相应的步骤,过程都是一样的,但是我在Ubuntu20.04编译的时候出现了两个错误,Ubuntu18.04没有出现:

在编译ORB_SLAM2的时候:

./build.sh

在进行到这一个步骤时候:

(1)error1:

error: ‘usleep’ was not declared in this scope

 解决办法:

将system.h头文件修改,加入下面的代码

#include<unistd.h>

(2)error2:


error: template argument 1 is invalid
   50 |         Eigen::aligned_allocator<std::pair<const KeyFrame* g2o::Sim3> > > KeyFrameAndPose;
      |                                                                       ^
/home/liqiang/Downloads/ORB_SLAM2/include/LoopClosing.h:50:73: error: template argument 4 is invalid
   50 |         Eigen::aligned_allocator<std::pair<const KeyFrame* g2o::Sim3> > > KeyFrameAndPose;
      |                                                                         ^
/home/liqiang/Downloads/ORB_SLAM2/src/Optimizer.cc: In static member function ‘static void ORB_SLAM2::Optimizer::OptimizeEssentialGraph(ORB_SLAM2::Map*, ORB_SLAM2::KeyFrame*, ORB_SLAM2::KeyFrame*, const KeyFrameAndPose&, const KeyFrameAndPose&, const std::map<ORB_SLAM2::KeyFrame*, std::set<ORB_SLAM2::KeyFrame*> >&, const bool&)’:
/home/liqiang/Downloads/ORB_SLAM2/src/Optimizer.cc:818:54: error: qualified-id in declaration before ‘it’
  818 |         LoopClosing::KeyFrameAndPose::const_iterator it = CorrectedSim3.find(pKF);
      |                                                      ^~
/home/liqiang/Downloads/ORB_SLAM2/src/Optimizer.cc:820:12: error: ‘it’ was not declared in this scope; did you mean ‘i’?
  820 |         if(it!=CorrectedSim3.end())
      |            ^~
      |            i

  解决办法:

将LoopClosing.h文件里的代码做一点小小的修改:

 

 将文件改成下面一样的问题就能解决了

在Ubuntu20.04上编译的效果如下所示:

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

长沙有肥鱼

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值