ROS安装过程中初始化时报错:
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.
在进行rodep init 的时候需要联网访问这个网址,而这个网址无法进入,所以会报错。
解决思路:
在进行rosdep init 的时候访问raw.githubusercontent.com,这个其实就是github的用户数据服务器。rosdep 程序下载的就是github.com/ros/rosdistro这个包里的yaml文件。
因此得到一个思路就是:首先下载github.com/ros/rosdistro包,将下列文件里面的默认的进入raw.githubusercontent.com去下载文件的url地址全部改为本地的下载的包的地址。
解决过程:
第一步:
首先将这个包下载下来。
下载链接:https://gitcode.net/mirrors/ros/rosdistro?utm_source=csdn_github_accelerator
https://github.com/ros/rosdistro
下载完成后将其解压移动到 /home/xxx/ 目录下
第二步:
修改这个包中rosdep/source.list.d/下的文件 20-default.list
,将这个文件中指向raw.githubusercontent.com
的url地址全部修改为指向本地文件的地址,也就是该下载好的包的地址:
# os-specific listings first
yaml file:///home/xxx/rosdistro/rosdep/osx-homebrew.yaml osx
# generic
yaml file:///home/xxx/rosdistro/rosdep/base.yaml
yaml file:///home/xxx/rosdistro/rosdep/python.yaml
yaml file:///home/xxx/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/xxx/rosdistro/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
将XXX替换为自己的用户名。
第三步:
修改 /usr/lib/python2.7/dist-packages/rosdep2 文件夹下的 sources_list.py 文件中的默认的url地址:
# default file to download with 'init' command in order to bootstrap
# rosdep
DEFAULT_SOURCES_LIST_URL = 'file:///home/xxx/rosdistro/rosdep/sources.list.d/20-default.list'
# seconds to wait before aborting download of rosdep data
第四步:
修改以下两个文件里面的代码:
1、
/usr/lib/python2.7/dist-packages/rosdep2/rep3.py文件:
# location of targets file for processing gbpdistro files
REP3_TARGETS_URL = 'file:///home/xxx/rosdistro/releases/targets.yaml'
# seconds to wait before aborting download of gbpdistro data
2、
/usr/lib/python2.7/dist-packages/rosdistro/__init__.py的文件:
# index information
DEFAULT_INDEX_URL = 'file:///home/xxx/rosdistro/index-v4.yaml'
def get_index_url():
修改完成后 sudo rodep init即可成功。
参考链接:
https://blog.csdn.net/nanianwochengshui/article/details/105702188?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_title~default-0.pc_relevant_antiscanv2&spm=1001.2101.3001.4242.1&utm_relevant_index=3