- 由于近期国内Github Raw的可用IP越来越少,通过修改hosts文件解决
rosdep update
超时问题的方法已经不太好用,本文通过修改rosdep源码中下载资源的函数来解决这一问题。 - 网站
https://ghproxy.com/
支持github的资源代理,非常好用,我们将用此代理加速rosdep对Github Raw的访问,进而解决rosdep update
超时问题。
- 首先确定 初始化rosdep 是否成功:
sudo rosdep init
,是否在如下目录下生成此文件:/etc/ros/rosdep/sources.list.d/20-default.list
,若没有,可从其他配置成功的电脑上拷贝过来; - 修改
/etc/ros/rosdep/sources.list.d/20-default.list
文件:
在所有https://raw.githubusercontent.com
前加上https://ghproxy.com/
:如下所示:
# os-specific listings first
yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
# generic
yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://ghproxy.com/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
- 修改
/usr/lib/python2.7/dist-packages/rosdistro/__init__.py
文件:
在DEFAULT_INDEX_URL
前面加上https://ghproxy.com/
,修改完成如下所示:
DEFAULT_INDEX_URL = 'https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'
按照上述修改完成后,再次尝试执行rosdep update
,问题解决!