一、问题描述
在编译ORB_SLAM2中Example的ROS时,执行到
-
$ chmod +x build_ros.sh
-
$ ./build_ros.sh
时。报出如下错误:
[rospack] Error: package 'ORB_SLAM2' depends on non-existent package 'cv_bridge' and rosdep claims that it is not a system dependency. Check the ROS_PACKAGE_PATH or try calling 'rosdep update'
二、错误原因
此ROS_kinetic缺少ORB_SLAM2需要的依赖包cv_bridge。
三、解决方法
(1)通过终端安装 cv_bridge
$sudo apt-get install ros-kinetic-cv-bridge
(2)在ORB_SLAM2文件夹中,删除之前编译好的build文件,从 ./build.sh开始向下重新编译。
#修改环境变量,在本窗口临时生效
$ export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:~/catkin_ws/src/ORB_SLAM2/Examples/ROS
$ cd ORB_SLAM2
$ chmod +x build.sh
$ ./build.sh
$ chmod +x build_ros.sh
$ ./build_ros.sh$ cd
$ gedit .bashrc
#在文件末尾加上:(始终生效)
$ export ROS_PACKAGE_PATH=${ROS_PACKAGE_PATH}:~/catkin_ws/src/ORB_SLAM2/Examples/ROS
详细的ORB_SLAM2编译过程,请看小白其它博客。
×亲测有效