Ubuntu16.04&Melodic 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
  1. ssl certs问题
sudo c_rehash /etc/ssl/certs 
sudo -E rosdep init

4)python-rosdep问题

sudo apt-get install python-rosdep

若以上方法全部无效,请直接在/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报错

报错原因:链接下载超时,出现 time out 或 connect refuse

解决办法一:

将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

解决办法二:

修改配置文件:

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

解决办法三:

timeout设置大点:

分别更改 /usr/lib/python2.7/dist­packages/rosdep2/下的三个文件sources_list.py,gbpdistro_support.py,rep3.py中的DOWNLOAD_TIMEOUT = 15.0

三、成功信息

rosdep update

reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
Skip end-of-life distro "ardent"
Skip end-of-life 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"
Add distro "noetic"
updated cache in /home/eco/.ros/rosdep/sources.cache

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

若问题未能顺利解决,需要在Linux系统下进行科学上网,从而一次性解决上述问题。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值