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

风格不统一 提交于 2019-12-02 10:36:50

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

报错信息:

[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

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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!