ORB-SLAM2编译报错:rospack found package "ORB_SLAM2" at "/opt/ros/kinetic/share/ORB_SLAM2", but the....

22 篇文章 3 订阅

折腾了一中午,尝试了各种修改路径的方法,仍然是提示报错,但是路径明明是添加进去了…

在.bashrc文件中添加如下路径信息:

source /opt/ros/kinetic/setup.bash
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/bruce/study/slam/orb/point_map/Examples/ROS

刷新环境变量,并验证路径设置信息:

bruce@bruce-desktop:~$ source ~/.bashrc
bruce@bruce-desktop:~$ echo $ROS_PACKAGE_PATH
/opt/ros/kinetic/share:/home/bruce/study/slam/orb/point_map/Examples/ROS

输出信息都是对的,但是依然报错…,头大了很久。

报错信息:

[rosbuild] Building package ORB_SLAM2
[rosbuild] Error from directory check: /opt/ros/kinetic/share/ros/core/rosbuild/bin/check_same_directories.py /opt/ros/kinetic/share/ORB_SLAM2 /home/bruce/study/slam/orb/point_map2/Examples/ROS/ORB_SLAM2
1
Traceback (most recent call last):
  File "/opt/ros/kinetic/share/ros/core/rosbuild/bin/check_same_directories.py", line 48, in <module>
    raise Exception
Exception
CMake Error at /opt/ros/kinetic/share/ros/core/rosbuild/private.cmake:102 (message):
  [rosbuild] rospack found package "ORB_SLAM2" at
  "/opt/ros/kinetic/share/ORB_SLAM2", but the current directory is
  "/home/bruce/study/slam/orb/point_map2/Examples/ROS/ORB_SLAM2".  You should
  double-check your ROS_PACKAGE_PATH to ensure that packages are found in the
  correct precedence order.
Call Stack (most recent call first):
  /opt/ros/kinetic/share/ros/core/rosbuild/public.cmake:177 (_rosbuild_check_package_location)
  CMakeLists.txt:4 (rosbuild_init)


-- Configuring incomplete, errors occurred!
See also "/home/bruce/study/slam/orb/point_map2/Examples/ROS/ORB_SLAM2/build/CMakeFiles/CMakeOutput.log".
make: *** 没有指明目标并且找不到 makefile。 停止。

原因分析及解决办法:
这是由于在ROS环境下编译使用了多个版本的ORB-SLAM2工程造成的,比如我运行了原版的ORB-SLAM2,然后拷贝了一份改了下文件名字,添加稠密重建模块,再对新的工程编译,就报了这个错误。因为原工程已经在/opt/ros/kinetic/share文件夹下建立了一个软连接ORB_SLAM2,这里包含有原工程的一些信息,我们需要做的就是把该软连接,替换为现在工程的软连接。

(1)先cd到/opt/ros/kinetic/share目录下,删除原来的ORB_SLAM2软连接

sudo rm -r ORB_SLAM2

(2)对当前工程在/opt/ros/kinetic/share目录下建立软连接

sudo ln -s /home/bruce/study/slam/orb/point_map/Examples/ROS/ORB_SLAM2 /opt/ros/kinetic/share/ORB_SLAM2

这样就圆满解决问题了!!!

  • 22
    点赞
  • 113
    收藏
    觉得还不错? 一键收藏
  • 9
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值