编译时出现类似环境变量出错的提示
如下
Traceback (most recent call last):
File “/opt/ros/kinetic/share/ros/core/rosbuild/bin/check_same_directories.py”, line 46, in
raise Exception
Exception
CMake Error at /opt/ros/kinetic/share/ros/core/rosbuild/private.cmake:102 (message):
[rosbuild] rospack found package “ORB_SLAM2_PointMap_SegNetM” at “”, but
the current directory is
“/home/xxx/catkin_ws/src/DS-SLAM/Examples/ROS/ORB_SLAM2_PointMap_SegNetM”.
You should double-check your ROS_PACKAGE_PATH to ensure that packages are
found in the correct precedence order.
————————————————
版权声明:本文为CSDN博主「Run_with_you」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/Run_with_you/article/details/120342614
许多方案说是没设置环境变量,在bashrc或其他一些文件中加入环境变量
如在bashrc中加入
export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:path_to_project/catkin_ws/src/ORB_SLAM2/Examples/ROS
并且用
echo $ROS_PACKAGE_PATH
进行检查环境变量,可我加过了就是检查不出来
后找到了一个解决方案。之前运行过ORB的其他变种SLAM,那时ROS就会在/opt/ros/melodic/share文件夹下建立了一个软连接ORB_SLAM2,现在的工程需要把原来的软链接换成当前你的工作空间下的路径
具体操作如下
1)先cd到/opt/ros/kinetic/share目录下,删除原来的ORB_SLAM2软连接
sudo rm -r ORB-SLAM2
注意:这里的ORB-SLAM2,就是这样,千万不要补全,会补一个/ ,带/的话,会把真是文件夹下的都删除了,而我们只是需要删除软链接
2)对当前工程在/opt/ros/melodic/share目录下建立软连接
sudo ln -s /home/xxx/ORB_SLAM2/Examples/ROS/ORB_SLAM2 /opt/ros/melodic/share/ORB_SLAM2
参考链接:
http://www.soolco.com/post/29527_1_1.html
https://blog.csdn.net/Run_with_you/article/details/120342614