ros安裝後,初始化时rosdep update出错解决办法(親測)
1.执行 sudo rosdep init 失败
反复尝试一下,一般情况下反复个几次,init这步就可以成功。
如果還是不成功,說明無法s從網上下載文件,需要自己新建該文件。
sudo rosdep init 这个操作最主要的工作就是从https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list,下载文件20-default.list,并把它放到/etc/ros/rosdep/sources.list.d/这个目录下。
20-default.list 文件的內容是:
# os-specific listings first yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx # generic yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml gbpdistro https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte # newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
2. 执行rosdep update失败
这步的操作失败原因是从raw.githubusercontent.com/下载文件失败,可以採用其他方式上網的大佬不會執行失敗。
既然無法直接從網上下載文件,可以把文件下載 到本地然後從本地獲取,
从下面云盘中直接下载,解压到/etc/ros目录下。需要超级权限。
链接: https://pan.baidu.com/s/1iWZF0sKXFE_-iVN48OiHAA 提取码: rtdf
修改20-default.list脚本文件,需要超级权限。可以跟前面的脚本内容做下对比。
1 # os-specific listings first
2 #yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
3 yaml file:///etc/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
4 # generic
5 #yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
6 #yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
7 #yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
8 #gbpdistro https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte
9
10 yaml file:///etc/ros/rosdistro/master/rosdep/base.yaml
11 yaml file:///etc/ros/rosdistro/master/rosdep/python.yaml
12 yaml file:///etc/ros/rosdistro/master/rosdep/ruby.yaml
13 gbpdistro file:///etc/ros/rosdistro/master/releases/fuerte.yaml fuerte
14 # newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
退出保存后,执行rosdep update。
在更新过程中,还有部分配置信息会从raw.githubusercontent.com上下载,但是反复几次,基本上就可以成功了。
如果還是無法成功,那麼需要執行下一步:
sudo 打开/usr/lib/python2.7/dist-packages/rosdistro/__init__.py这个文件,按照下面的代码进行修改。
1 # index information
2
3 #DEFAULT_INDEX_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'
4 DEFAULT_INDEX_URL = 'file:///etc/ros/rosdistro/master/index-v4.yaml'
保存后,执行rosdep update。如果一次不成功,再执行个一两次,应该就可以成功,出現下面的打印
1 reading in sources list data from /etc/ros/rosdep/sources.list.d 2 Hit file:///etc/ros/rosdistro/master/rosdep/osx-homebrew.yaml 3 Hit file:///etc/ros/rosdistro/master/rosdep/base.yaml 4 Hit file:///etc/ros/rosdistro/master/rosdep/python.yaml 5 Hit file:///etc/ros/rosdistro/master/rosdep/ruby.yaml 6 Hit file:///etc/ros/rosdistro/master/releases/fuerte.yaml 7 Query rosdistro index file:///etc/ros/rosdistro/master/index-v4.yaml 8 Skip end-of-life distro "ardent" 9 Skip end-of-life distro "bouncy" 10 Skip end-of-life distro "crystal" 11 Add distro "dashing" 12 Add distro "eloquent" 13 Add distro "foxy" 14 Skip end-of-life distro "groovy" 15 Skip end-of-life distro "hydro" 16 Skip end-of-life distro "indigo" 17 Skip end-of-life distro "jade" 18 Add distro "kinetic" 19 Skip end-of-life distro "lunar" 20 Add distro "melodic" 21 Add distro "noetic" 22 updated cache in /home/xxxx/.ros/rosdep/sources.cache
參考博客:https://blog.csdn.net/super_sean/article/details/105433250
ros官網安裝教程:http://wiki.ros.org/cn/kinetic/Installation/Ubuntu