2021-09-17ROS安装时 rosdep init/update 出现报错解决方法

ROS安装时 rosdep init/update 出现报错

在安装ROS的过程中,很多同学在执行上述指令时会提示以下错误:

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.

其主要解决办法是用VPN,但是这在Ubuntu中很难实现;或者用手机开热点(移动手机热点没有用,得是联通手机或电信);或者通过代码和相关指令完成。本文主要提供两种办法,均可行。整理修改后提供解决ROS rosdep init/update报错的方法(终极版)。

方法1

执行三条指令(这个简单方便,大部分可行):

sudo apt-get install python3-pip
sudo pip3 install fix-rosdep
sudo fix-rosdep

方法2

步骤1

进入到 sources.list.d 文件夹(如果没有,则新建)

修改 gedit 20-default.list

cd /etc/ros/rosdep/sources.list.d
sudo gedit 20-default.list

将里面所有的

raw.githubusercontent.com/ros/rosdistro/master替换成gitee.com/wybros/rosdistro/raw/master

修改前:

#os-specific listings first
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
  # generic
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte

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

修改后:

#os-specific listings first rosdep update
yaml https://gitee.com/wybros/rosdistro/raw/master/rosdep/osx-homebrew.yaml osx

#generic
yaml https://gitee.com/wybros/rosdistro/raw/master/rosdep/base.yaml
yaml https://gitee.com/wybros/rosdistro/raw/master/rosdep/python.yaml
yaml https://gitee.com/wybros/rosdistro/raw/master/rosdep/ruby.yaml
gbpdistro https://gitee.com/wybros/rosdistro/raw/master/releases/fuerte.yaml fuerte

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

步骤2

进入到 rosdep2 文件夹,

修改 gbpdistro_support.py

cd /usr/lib/python2.7/dist-packages/rosdep2/ sudo gedit
gbpdistro_support.py

将里面所有的 raw.githubusercontent.com/ros/rosdistro/master替换成gitee.com/wybros/rosdistro/raw/master

修改后如下

FUERTE_GBPDISTRO_URL = 'https://gitee.com/wybros/rosdistro/raw/' \
    'master/releases/fuerte.yaml'

步骤3

进入到 rosdep2 文件夹,修改 rep3.py

cd /usr/lib/python2.7/dist-packages/rosdep2/
sudo gedit rep3.py

将里面所有的

raw.githubusercontent.com/ros/rosdistro/master替换成gitee.com/wybros/rosdistro/raw/master

修改后如下

REP3_TARGETS_URL = 'https://gitee.com/wybros/rosdistro/raw/master/releases/targets.yaml'

步骤4

进入到 rosdep2 文件夹,

修改 sources_list.py

cd /usr/lib/python2.7/dist-packages/rosdep2/
sudo gedit sources_list.py

将里面所有的

raw.githubusercontent.com/ros/rosdistro/master替换成gitee.com/wybros/rosdistro/raw/master

修改后如下

DEFAULT_SOURCES_LIST_URL = 'https://gitee.com/wybros/rosdistro/raw/master/rosdep/sources.list.d/20-default.list'

步骤5

进入到 rosdistro 文件夹

修改 init.py

cd /usr/lib/python2.7/dist-packages/rosdistro/
sudo gedit init.py

将里面所有的 raw.githubusercontent.com/ros/rosdistro/master
替换成gitee.com/wybros/rosdistro/raw/master

修改后如下

DEFAULT_INDEX_URL = 'https://gitee.com/wybros/rosdistro/raw/master/index-v4.yaml'

最后
打开新终端执行

rosdep update
如果出现如下提示则表示成功!

2021-09-17ROS安装时 rosdep init/update 出现报错解决方法_第1张图片
原文连接:https://mp.weixin.qq.com/s/mghnF4sesImHpg4ScZ-bRA

你可能感兴趣的:(ros安装学习,经验分享)