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'
上文中我已经修改,放心使用 :)

  • 3
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
### 回答1: 在Ubuntu 16.04上使用ROS时,执行"rosdep init"命令时可能会遇到报错。这个问题通常是由于网络连接问题导致的。要解决这个问题,可以按照以下步骤进行操作: 1. 首先,确保您的网络连接是正常的,可以尝试更换网络连接方式(例如使用有线连接代替无线连接)并重试命令。 2. 如果更换网络连接方式仍然无法解决问题,可以尝试使用以下命令来更新ROS的依赖项: ``` sudo apt-get update sudo apt-get install python-rosdep ``` 3. 如果上述步骤仍然无法解决问题,可以尝试手动初始化rosdep。首先,通过以下命令创建一个rospkg目录: ``` sudo mkdir /etc/ros/rosdep/sources.list.d ``` 4. 然后,使用以下命令创建一个rosdep源列表文件: ``` sudo sh -c 'echo "yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml" > /etc/ros/rosdep/sources.list.d/20-default.list' ``` 5. 最后,执行以下命令来初始化rosdep: ``` rosdep init ``` 通过执行上述步骤,您应该能够成功初始化rosdep,并继续使用ROS。希望这些信息对您有所帮助! ### 回答2: 当使用`ubuntu 16.04`系统上的`rosdep init`命令时,可能会遇到报错。这个错误通常是由于`rosdep`工具中的源文件问题引起的。 要解决这个问题,可以按照以下步骤进行操作: 1. 打开终端,输入以下命令来编辑`rosdep`源文件: ``` sudo nano /etc/ros/rosdep/sources.list.d/20-default.list ``` 2. 在打开的文件中,你会看到一些URL链接。这些链接是`rosdep`工具用来下载依赖关系的源文件。 3. 将所有的URL链接注释掉,或者将它们删除。你可以在前面添加一个井号(#)来注释掉链接。 4. 在文件的末尾,添加以下源文件链接: ``` yaml http://packages.ros.org/ros/rosdep/ubuntu.yaml ``` 5. 保存文件并退出编辑器。 6. 运行以下命令来更新`rosdep`工具的源文件: ``` sudo rosdep update ``` 7. 现在你可以尝试再次运行`rosdep init`命令,应该不会再出现错误。 这些步骤将修复`ubuntu 16.04`系统上`rosdep init`命令的报错问题,并正确初始化`rosdep`工具。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

GRF-Sunomikp31

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

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

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

打赏作者

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

抵扣说明:

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

余额充值