Ubuntu16.04在安装ROS时,rosdep初始化报错问题的解决方案


在安装ROS系统时,rosdep初始化往往容易出现报错,经网上查资料,总结了以下解决方案。

一、初始化rosdep报错

报错原因:20-default.list无法下载因网络限制无法下载。
在运行 “sudo 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.

刚开始以为是自己网络问题,于是换成网线、其他无线试了好多次,还是显示同样的错误。

可能的解决方法:
(1)ca-certificates问题,证书不对,重新安装证书,运行命令如下:

sudo apt-get install ca-certificates

然而,我尝试了这个方法之后,并不行,还是显示同样的错误。说明我的证书没问题。接着用其他方法。

(2)系统时间同步问题,需要同步系统时间。运行以下命令:

sudo apt-get install ntpdate
sudo ntpdate cn.pool.ntp.org
sudo hwclock --systohc

然而。。。同样没用,还是显示同样的报错。继续尝试别的方法。

(3)ssl certs问题。运行以下命令:

sudo c_rehash /etc/ssl/certs 
sudo -E rosdep init

However, it doesn’t work for me…again.

(4)python-rosdep问题

sudo apt-get install python-rosdep

笑而不语,继续默默转向其他方法。

(5)简单粗暴(然而对我电脑是有效的),请直接在/etc目录下新建/ros/rosdep/sources.list.d/20-default.list文件,下载地址:

https://raw.githubusercontent.com/ros/rosdistro/master/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

至此,已解决20-default.list无法下载的问题。开始下一步 “rosdep update”。

二、rosdep update报错

报错原因:下载超时,出现 time out 或 connect refuse,带选择方法如下:
(1)将20-default.list中所有raw.githubusercontent.com改为raw.github.com,得到如下最终文档:

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

再次执行:rosdep update

(2)修改配置文件:/etc/resolv.conf 中的nameserver,内容如下:

sudo gedit /etc/resolv.conf
nameserver 8.8.8.8 #google域名服务器
nameserver 8.8.4.4 #google域名服务器

OK,我在尝试该方法之后,就可以成功运行 rosdep update 命令了。

如果还不行,可以继续尝试方法(3):
(3)timeout设置大点:
分别更改 /usr/lib/python2.7/dist­packages/rosdep2/下的三个文件sources_list.py,gbpdistro_support.py,rep3.py中的DOWNLOAD_TIMEOUT = 15.0

成功后,运行命令,界面显示如下:
在这里插入图片描述

成功升级,至此终于完成rosdep初始化,问题解决。

=======更新于2021年10月20日

来,给大家提供一个无敌的方法!!

Step1:首先,下载需要的文件(我已保存到保存到百度网盘中,其中Ubuntu16、18、20的版本方法都有)

链接:https://pan.baidu.com/s/1rlBvebYo3MCPye9MfOELGA
提取码:ezuq

Step2:根据下载的文件中的“提示操作”一步一步进行操作!(以Ubuntu18.04为例)

在这里插入图片描述

Step3:成功完成升级!

  • 2
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值