rospack found package “...ORB_SLAM2...“ at ““, but the current directory is“...“

运行某个版本SLAM报错,多个SLAM版本通用:
首先,检查ros环境路径是否是错的,要和current directory对应

echo $ROS_PACKAGE_PATH

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.

原因是ROS环境路径没加进去
解决方法
1.在 /opt/ros/kinetic(或者melodic、noetic)/setup.bash文件最后加入

export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:这里是自己的路径/slam/orb/point_map/Examples/ROS/ORB_SLAM2_PointMap_SegNetM

比如我的然后在setup.sh所在文件夹执行
在这里插入图片描述

source setup.sh
  1. 同样的执行,路径同上
sudo gedit ~/.bashrc

在里面加入

export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:/home/...自己的路径../catkin_ws/src/DS-SLAM/Examples/ROS/ORB_SLAM2_PointMap_SegNetM

我的bashrc:
在这里插入图片描述再执行

source ~/.bashrc
  1. 检查ros环境路径是否添加成功
echo $ROS_PACKAGE_PATH

我的返回是

xx@xxxxxxxxx:~$ echo $ROS_PACKAGE_PATH
/opt/ros/melodic/share:/home/cs/catkin_ws/src/DS-SLAM/Examples/ROS/ORB_SLAM2_PointMap_SegNetM

至此,添加成功

参考
https://blog.csdn.net/weixin_44401286/article/details/102752767

  • 2
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值