ROS rosdep initupdate报错解决方法

ROS rosdep init/update报错解决方法

在安装ROS的过程中,很多同学在执行上述指令时会提示以下错误:

ERROR: cannot download default sources list from:https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.listWebsite may be down.

通常的解决办法是用手机热点

或者查询

https://raw.githubusercontent.com的实际IP地址,但是也有可能会失效。

本文会提供解决ROS rosdep init/update报错的方法。

步骤:

第一步

rosdistro 下载到本地

git clone https://github.com/ros/rosdistro.git

如果失败了,可以尝试

git clone https://gitee.com/wybros/rosdistro.git

第二步

进入到 sources.list.d 文件夹,

修改 gedit 20-default.list

注意:XXXX为你的用户名

cd /home/XXXX/rosdistro/rosdep/sources.list.d/

sudo gedit 20-default.list

将里面所有的 raw.githubusercontent.com 地址,
替换成本机 rosdistro 的地址。

修改前:

# 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

修改后:

*注意:*XXXX为你的用户名


# os-specific listings first
yaml file:///home/XXXX/rosdistro/rosdep/osx-homebrew.yaml osx

# generic
yaml file:///home/XXXX/rosdistro/rosdep/base.yaml
yaml file:///home/XXXX/rosdistro/rosdep/python.yaml
yaml file:///home/XXXX/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/XXXX/rosdistro/releases/fuerte.yaml fuerte

# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead

第三步

进入到 rosdep2 文件夹,

修改 gbpdistro_support.py

cd /usr/lib/python2.7/dist-packages/rosdep2/
sudo gedit gbpdistro_support.py

替换成自己的地址,修改后如下

***注意:*XXXX为你的用户名

FUERTE_GBPDISTRO_URL = 'file:///home/XXXX/rosdistro/releases/fuerte.yaml'

第四步

进入到 rosdep2 文件夹,

修改 rep3.py

cd /usr/lib/python2.7/dist-packages/rosdep2/
sudo gedit rep3.py

替换成自己的地址,修改后如下

***注意:*XXXX为你的用户名

REP3_TARGETS_URL = 'file:///home/XXXX/rosdistro/releases/targets.yaml'

第五步

进入到 rosdistro 文件夹

修改 init.py

cd /usr/lib/python2.7/dist-packages/rosdistro/

sudo gedit __init__.py

替换成自己的地址,修改后如下

***注意:*XXXX为你的用户名

DEFAULT_INDEX_URL = 'file:///home/XXXX/rosdistro/index-v4.yaml'

第六步

切换到root用户

sudo su

新建 sources.list.d 文件夹

sudo mkdir -p /etc/ros/rosdep/sources.list.d

进入到 sources.list.d 文件夹

修改 20-default.list

cd /etc/ros/rosdep/sources.list.d
sudo gedit 20-default.list

将以下的内容复制进 20-default.list

*注意:XXXX为你的用户名*


#os-specific listings first
yaml file:///home/XXXX/rosdistro/rosdep/osx-homebrew.yaml osx
#generic
yaml file:///home/XXXX/rosdistro/rosdep/base.yaml
yaml file:///home/XXXX/rosdistro/rosdep/python.yaml
yaml file:///home/XXXX/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/XXXX/rosdistro/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

如果出现如下提示则表示成功!

XXXX为你的用户名

reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit file:///home/XXXX/rosdistro/rosdep/osx-homebrew.yaml
Hit file:///home/XXXX/rosdistro/rosdep/base.yaml
Hit file:///home/XXXX/rosdistro/rosdep/python.yaml
Hit file:///home/XXXX/rosdistro/rosdep/ruby.yaml
Hit file:///home/XXXX/rosdistro/releases/fuerte.yaml
Query rosdistro index file:///home/XXXX/rosdistro/index-v4.yaml
Skip end-of-life distro "ardent"
Add distro "bouncy"
Add distro "crystal"
Add distro "dashing"
Add distro "eloquent"
Skip end-of-life distro "groovy"
Skip end-of-life distro "hydro"
Skip end-of-life distro "indigo"
Skip end-of-life distro "jade"
Add distro "kinetic"
Skip end-of-life distro "lunar"
Add distro "melodic"
updated cache in /home/XXXX/.ros/rosdep/sources.cache

参考资料

ROS rosdep init/update报错解决方法

这个文章其实基本上都是参考这个博文的,但是我改了一个小bug;
步骤四的
FUERTE_GBPDISTRO_URL = 'file:///home/XXXX/rosdistro/' \ 'releases/fuerte.yaml'
会报错,要改成:
FUERTE_GBPDISTRO_URL = 'file:///home/XXXX/rosdistro/releases/fuerte.yaml'
上文中我已经修改,放心使用 :)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

GRF-Sunomikp31

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值