ubuntu16安装ROS,解决执行rosdep init报错,rosdep update报错

1.执行 sudo rosdep init 失败

(1)反复尝试一下,如果都失败,进入(2)

(2)参考下面链接提供的方法尝试一下 https://www.cnblogs.com/xuhaoforwards/p/9399744.html,还失败,直接进入步骤(3)

(3)上面的操作都不成功,可以参考下面。

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这个文件的内容如下,我们可以直接创建目录/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/下载文件失败,防火墙限制了对这个网站的访问。

(1)rosdep update在打开20-default.list里的链接时失败,也就是无法下载20-default.list列举的几个配置文件。干脆把这些文件下载到本地,然后修改20-default.list 执行本地文件就可以了。

具体操作如下:

a.将20-default.list中的链接在浏览器中打开,下载列举的文件,放在/etc/ros/xxx文件夹下。

也可以从下面云盘中直接下载,解压到/etc/ros目录下。需要超级权限。

链接: https://pan.baidu.com/s/1cEdmvwpK-WkkFzBAk5ZCfg

提取码: ezeh

b.修改20-default.list脚本文件。注视掉原文连接,改为下载的对应文件路径。

 

# os-specific listings first
#yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
yaml file:///etc/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
 
yaml file:///etc/ros/rosdistro/master/rosdep/base.yaml
yaml file:///etc/ros/rosdistro/master/rosdep/python.yaml
yaml file:///etc/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro file:///etc/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

 退出保存后,执行rosdep update。反复几次,基本上就可以成功了。

(3)经过上面两步,还是失败,请继续往下看。(还未尝试;from转载者)

sudo 打开/usr/lib/python2.7/dist-packages/rosdistro/init.py这个文件,按照下面的代码进行修改。

# index information
 
#DEFAULT_INDEX_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'
DEFAULT_INDEX_URL = 'file:///etc/ros/rosdistro/master/index-v4.yaml'

 保存后,执行rosdep update。如果一次不成功,再执行个一两次。

4)如果执行到第3步还是报错,很可能是本机的DNS服务被污染了,无法获得https://raw.githubusercontent.com这个网址的正确IP,导致连接失败。这时你需要更新一下DNS服务器设置,选择一个外部的DNS服务器。添加8.8.8.8(google的DNS服务器)。

修改DNS服务器地址,需自行搜一下攻略。执行rosdep update。这时应该就不会报错了。

 

上一篇:Ubuntu18.04安装ROS——实现小海龟仿真


下一篇:选择性注意模型