问题描述:
学习《机器人操作系统入门》课程时,在Ubuntu 16.04 上安装了kinetic,安装ROS-Academy-for-Beginners时依赖总是报错,如下所示:
rosdep install --from-paths src --ignore-src --rosdistro=kinetic -y
报错,如下图所示
~/catkin_ws$ rosdep install --from-paths src --ignore-src --rosdistro=kinetic -y
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
robot_sim_demo: Cannot locate rosdep definition for [yocs_cmd_vel_mux]
navigation_sim_demo: Cannot locate rosdep definition for [gmapping]
slam_sim_demo: Cannot locate rosdep definition for [hector_mapping]
大概率是在rosdep init 时候失败了,无法链接官网的github,有些安装包没能更新。我在解决rosdep init 失败的问题时,是参考了一个方法,使用rosdepc init,当时看起来成功了,没想到后面还是有坑。
~/catkin_ws$ rosdep init
ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.
此时,在网上搜索了很多方法,都没有解决。后来在评论区看到一种方法,直接使用
sudo apt-get install ros-kinetic-yocs-cmd-vel-mux
安装依赖
robot_sim_demo: Cannot locate rosdep definition for [yocs_cmd_vel_mux]
直接安装成功了
解决方法:
然后就根据这个规律,缺少什么就安装什么。
如:
~/catkin_ws$ rosdep install -y --from-paths src --ignore-src --rosdistro kinetic
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
navigation_sim_demo: Cannot locate rosdep definition for [map_server]
slam_sim_demo: Cannot locate rosdep definition for [slam_karto]
报缺少[map_server]和[slam_karto]
一个一个安装,也可以一条命令同时安装的
sudo apt-get install ros-kinetic-map-server
sudo apt-get install ros-kinetic-slam-karto
依次把依赖安装完成,累计手动安装了10个左右,最终安装成功:
~/catkin_ws$ rosdep install --from-paths src --ignore-src --rosdistro=kinetic -y
接下来就可以编译了
catkin_make
编译成功,可以开心的运行示例程序了
Scanning dependencies of target scanmatch_test
[ 97%] Building CXX object openslam_gmapping/CMakeFiles/scanmatch_test.dir/scanmatcher/scanmatch_test.cpp.o
[ 97%] Linking CXX executable /home/cel/catkin_ws/devel/lib/openslam_gmapping/scanmatch_test
[ 97%] Built target scanmatch_test
Scanning dependencies of target slam_gmapping_replay
[ 97%] Building CXX object slam_gmapping/gmapping/CMakeFiles/slam_gmapping_replay.dir/src/slam_gmapping.cpp.o
[ 97%] Linking CXX executable /home/cel/catkin_ws/devel/lib/gmapping/slam_gmapping
[ 98%] Building CXX object slam_gmapping/gmapping/CMakeFiles/slam_gmapping_nodelet.dir/src/nodelet.cpp.o
[ 98%] Built target slam_gmapping
[ 98%] Building CXX object slam_gmapping/gmapping/CMakeFiles/slam_gmapping_replay.dir/src/replay.cpp.o
[ 98%] Linking CXX shared library /home/cel/catkin_ws/devel/lib/libslam_gmapping_nodelet.so
[ 98%] Built target slam_gmapping_nodelet
[100%] Linking CXX executable /home/cel/catkin_ws/devel/lib/gmapping/slam_gmapping_replay
[100%] Built target slam_gmapping_replay
|