Author: 杭州电子科技大学-自动化学院-智能系统和机器人研究中心-Jolen Xie
Q:安装ROS使用rosdep init报错
sudo apt install python-rosdep
sudo rosdep init
rosdep update
报错: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.
A:解决方法
-
下载rosdistro的包,github下载地址,转到我的码云,下载快一些下载地址,解压放在
/home/你用户名/
路径下 -
修改
rosdistro
这个包中rosdep/source.list.d/
下的文件20-default.list
文件,即文件rosdistro/rosdep/source.list.d20-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
中的DEFAULT_SOURCES_LIST_URL
sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/sources_list.py
修改DEFAULT_SOURCES_LIST_URL路径:
DEFAULT_SOURCES_LIST_URL = 'file:///home/xxx/rosdistro/rosdep/sources.list.d/20-default.list'
-
修改一下两个文件夹里的代码:
修改文件1sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/rep3.py
修改URL:
REP3_TARGETS_URL = 'file:///home/xxx/rosdistro/releases/targets.yaml'
修改文件2:
sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/__init__.py
修改URL:
DEFAULT_INDEX_URL = 'file:///home/xxx/rosdistro/index-v4.yaml'
-
再次初始化
rosdep
,期间可能提醒20-default.list
已经下载,把其删除再rosdep
就行了sudo rosdep init rosdep update
可以roscore
测试一下安装是否成功