解决安装ROS时rosdep update错误 raw.githubusercontent.com

话不多说进入正题

写于2021.5.14,至少这个方法目前是有效的。

Ubuntu16.04系统,安装ROS参考如下博客:
https://www.cnblogs.com/longronglang/p/11386522.html
下面的问题流程全部是基于这篇博客的!但是初始化遇到问题(sudo rosdep init,rosdep update),通宵搞没搞明白。这里也是借鉴了很多博主的方法,什么改IP,改DNS,改清华源阿里源的都有。

raw.githubusercontent.com是恼人的网址,被墙了又没有完全被墙,希望装ROS的小伙伴都能过了这一关。要善待你身边的ubuntu初学者,因为配置环境的人都有一颗玻璃心心!

问题一:缺少签名

无法验证下列签名: NO_PUBKEY F42ED6FBAB17C654

#桌面打开终端,输入:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654

问题二:初始化第一句

执行初始化第一句:sudo rosdep init
这之前先修改IP地址:

#桌面打开终端,输入:
sudo gedit /etc/hosts
#在末尾添加下列语句,保存并退出:
185.199.111.133 raw.githubusercontent.com
#备选的IP如下(每次用一个!),建议直接查询地址的IP(会变的):
185.199.111.133 raw.githubusercontent.com
185.199.108.133 raw.githubusercontent.com
185.199.109.133 raw.githubusercontent.com
185.199.110.133 raw.githubusercontent.com
199.232.28.133 raw.githubusercontent.com
151.101.76.133 raw.githubusercontent.com

进行初始化,初始化第一句运行完毕,会提示你输入rosdep update。
下面才是深渊的开始,因为你可能永远无法hit到raw.githubusercontent.com!当然,如果你hit到了也不会来看这篇博客。

问题三:rosdep update

(1)参考博客:https://blog.youkuaiyun.com/super_sean/article/details/105433250#commentBox
将rosdistro文件夹复制到/etc/ros中,具体的下载地址看这篇博客。
因为这些文件很难直接hit下载!

#桌面把rosdistro.zip解压成rosdistro文件夹,打开终端输入:
sudo cp -r /home/jason/桌面/rosdistro /etc/ros
#记得修改/xx/xx/rosdistro为你自己的文件夹路径

(2)仍然参考该博客:
修改20-default.list(/etc/ros/rosdep/sources.list.d/20-default.list)
修改如下(直接复制粘贴下面的覆盖原本的20-default.list,记得sudo gedit打开):

# 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

(3)仍然参考该博客:

#桌面打开终端输入:
sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/__init__.py
#修改DEFAULT_INDEX_URL如下:
DEFAULT_INDEX_URL = 'file:///etc/ros/rosdistro/master/index-v4.yaml'

(4)参考博客:https://blog.youkuaiyun.com/qq_38491310/article/details/86494635#commentBox

#桌面打开终端输入:
sudo gedit /etc/systemd/resolved.conf
#删除DNS前面的#,并写成:
DNS=8.8.8.8
#可能的其他DNS8.8.4.4114.114.114.114

(5)参考博客:
https://www.guyuehome.com/33258
修改/usr/lib/python2.7/dist-packages/rosdep2目录中的sources_list.py、gbpdistro_support.py、rep3.py的时间限制。

#进入/usr/lib/python2.7/dist-packages/rosdep2,打开终端分别输入:
sudo gedit sources_list.py
sudo gedit gbpdistro_support.py
sudo gedit rep3.py
#修改DOWNLOAD_TIMEOUT时间常数:
全部修改:DOWNLOAD_TIMEOUT = 15.0DOWNLOAD_TIMEOUT = 1200

(6)修改软件源为aliyun,软件更新里面,不多赘述。
在桌面打开终端输入:rosdep update。
可能要多重复执行几次(开手机热点),直到没有error为止。一定能成功!

reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit file:///etc/ros/rosdistro/master/rosdep/osx-homebrew.yaml
Hit file:///etc/ros/rosdistro/master/rosdep/base.yaml
Hit file:///etc/ros/rosdistro/master/rosdep/python.yaml
Hit file:///etc/ros/rosdistro/master/rosdep/ruby.yaml
Hit file:///etc/ros/rosdistro/master/releases/fuerte.yaml
Query rosdistro index file:///etc/ros/rosdistro/master/index-v4.yaml
Skip end-of-life distro "ardent"
Skip end-of-life distro "bouncy"
Skip end-of-life distro "crystal"
Add distro "dashing"
Add distro "eloquent"
Add distro "foxy"
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/jason/.ros/rosdep/sources.cache

希望你也能早日看见小乌龟!加油!

### 解决 ROS `rosdep update` 超错误的方法 当遇到 `rosdep update` 命令超,可以采取多种措施来解决问题。以下是详细的解决方案: #### 修改源地址配置 一种常见的原因是默认的 rosdep 源服务器响应缓慢或不可达。可以通过修改 `/etc/ros/rosdep/sources.list.d/20-default.list` 文件中的 URL 来指向国内镜像站点[^1]。 例如,将原来的 URL 替换为中国科学技术大学的镜像: ```bash sudo sed -i 's@http://data.ros.org@https://mirrors.ustc.edu.cn@g' /etc/ros/rosdep/sources.list.d/20-default.list ``` #### 更新索引文件路径 有特定版本的 YAML 文件无法正常访问也会引发此问题。对于 Fuerte 版本提到的 `[https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml]` 地址报错的情况,确认本地是否有缓存副本或者尝试更换其他稳定链接。 #### 清理并重置 rosdep 数据库 如果之前存在不完整的下载记录,则可能导致后续操作失败。建议先清理再重新初始化数据库: ```bash sudo rm -rf /var/lib/rosdep/* rosdep init rosdep update --include-eol-distros ``` #### 设置代理环境变量 网络连接不稳定同样会影响命令执行效率。可以在终端设置临 HTTP(S) 代理以改善情况: ```bash export http_proxy=http://your.proxy.server:port/ export https_proxy=https://your.proxy.server:port/ ``` 通过上述调整通常能够有效缓解乃至彻底解决 `rosdep update` 的超现象[^2]。
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值