rosdep init & rosdep update 失败接方法

rosdep init

报错示例:

RROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.

修改hosts

sudo vim /etc/hosts

在最后一样加入

151.101.84.133 raw.githubusercontent.com
# 这个ip 可能不行,可以去https://www.ipaddress.com/输入raw.githubusercontent.com查找新的ip

rosdep update

  • 下载rosdistro
git clone https://github.com/ros/rosdistro.git
  • 下载后放到这个目录
/home/<username>/rosdistro
#  <username>就是你的用户名字
eg:
/home/yunhgu/rosdistro
  • 修改/usr/lib/python2.7/dist-packages/rosdep2/rep3.py文件
cd /usr/lib/python2.7/dist-packages/rosdep2
sudo vim rep3.py
将REP3_TARGETS_URL = ‘https://raw.githubusercontent.com/ros/rosdistro/master/releases/targets.yaml’ 
替换成 REP3_TARGETS_URL = 'file:///home/yunhgu/rosdistro/releases/targets.yaml'
替换后的/home/yunhgu 即为第一步clone内容的存放地址 
  • 修改/usr/lib/python2.7/dist-packages/rosdistro/init.py文件
将原来文件中的 DEFAULT_INDEX_URL = ‘https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml’
替换成 DEFAULT_INDEX_URL = 'file:///home/yunhgu/rosdistro/index-v4.yaml'
替换后的/home/yunhgu 即为第一步clone内容的存放地址
  • 修改/etc/ros/rosdep/sources.list.d/20-default.list
    内容如下
# os-specific listings first
yaml file:///home/yunhgu/rosdistro/rosdep/osx-homebrew.yaml osx

# generic
yaml file:///home/yunhgu/rosdistro/rosdep/base.yaml
yaml file:///home/yunhgu/rosdistro/rosdep/python.yaml
yaml file:///home/yunhgu/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/yunhgu/rosdistro/releases/fuerte.yaml fuerte

# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
  • 运行
rosdep update

方案二

https://www.guyuehome.com/35408

posted @ 2022-01-24 13:55  不能说的秘密  阅读(80)  评论(0编辑  收藏  举报