欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

ROS环境下编译使用了多个版本的ORB-SLAM2工程造成(You should double-check your ROS_PACKAGE_PATH...)

程序员文章站 2024-03-25 10:41:24
...
[rosbuild] Error from directory check: /opt/ros/kinetic/share/ros/core/rosbuild/bin/check_same_directories.py /opt/ros/kinetic/share/ORB_SLAM2 /home/ckq/TextSLAM/ORB_SLAM2-master/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/ckq/TextSLAM/ORB_SLAM2-master/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)

今天重新编译一个新的orbslam2时出现该问题

分析:
这是由于在ROS环境下编译使用了多个版本的ORB-SLAM2工程造成的,再对新的工程编译,就报了这个错误。因为原工程已经在/opt/ros/kinetic/share文件夹下建立了一个软连接ORB_SLAM2,这里包含的事我自己原来工程的一些信息,我们需要做的就是把该软连接,替换为现在工程的软连接。

(不知道之前怎么就创建了软连接,在bashrc下没写ROS_PACKAGE_PATH路径)

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

sudo rm -r ORB_SLAM2

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

sudo ln -s /home/...(具体路径)....../Examples/ROS/ORB_SLAM2 /opt/ros/kinetic/share/ORB_SLAM2

或者在bashrc中添加ROS_PACKAGE_PATH

export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/ckq/TextSLAM/ORB_SLAM2-master/Examples/ROS/ORB_SLAM2

参考戳这里

相关标签: ORBSLAM2学习