在安装ros时,运行 rosdeo update,因为网络原因,一直出现超时错误:
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
ERROR: error loading sources list:
The read operation timed out
原因不想考究了,大家应该都知道。下面详细说下解决方法:
1、git clone https://github.com/ros/rosdistro.git 到本地,记住这个rosdistro目录的路径,例如我git clone 到了路径
/home/robot/rosdistro/
2、查找 文件/usr/lib/python2/dist-packages/rosdep2/rep3.py 中的raw.githubusercontent.com,将 https://raw.githubusercontent.com/ros/rosdistro/master 替换成 file://+第1步中的路径,比如我的是:
将 原来文件中的 REP3_TARGETS_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/releases/targets.yaml' 替换成 REP3_TARGETS_URL = 'file:///home/robot/rosdistro/releases/targets.yaml'
3、同第2步,查找文件/usr/lib/python2/dist-packages/rosdistro/__init__.py中的raw.githubusercontent.com,将 https://raw.githubusercontent.com/ros/rosdistro/master 替换成 file://+第1步中的路径,比如:
将 原来文件中的 DEFAULT_INDEX_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'替换成 DEFAULT_INDEX_URL = 'file:///home/robot/rosdistro/index-v4.yaml'
4、sudo rosdep init 重新生成/etc/ros/rosdep/sources.list.d/20-default.list,将该文件中的所有https://raw.githubusercontent.com/ros/rosdistro/master 也替换成 file://+第1步中的路径,比如我修改后的文件:
# os-specific listings first
yaml file:///home/robot/rosdistro/rosdep/osx-homebrew.yaml osx
# generic
yaml file:///home/robot/rosdistro/rosdep/base.yaml
yaml file:///home/robot/rosdistro/rosdep/python.yaml
yaml file:///home/robot/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/robot/rosdistro/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
5、然后就可以顺畅的rosdep update了。
参考:https://zhuanlan.zhihu.com/p/107218921