安装ROS使用sudo rosdep init 报错ERROR: cannot download default sources list from:

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:解决方法

  1. 下载rosdistro的包,github下载地址,转到我的码云,下载快一些下载地址,解压放在/home/你用户名/路径下

  2. 修改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是你的用户名

  3. 修改/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'

  4. 修改一下两个文件夹里的代码:
    修改文件1

    sudo 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'

  5. 再次初始化rosdep,期间可能提醒20-default.list已经下载,把其删除再rosdep就行了

    sudo rosdep init
    rosdep update
    

可以roscore测试一下安装是否成功

猜你喜欢

转载自blog.csdn.net/Jolen_xie/article/details/118436834