sudo rosdep init update 出错的最新解决方案

问题分析

安装ros 执行sudo rosdep init 或者rosdep update出错的主要原因:https://raw.githubusercontent.com网站国内访问受限

最新解决方案

原理

既然网站服务器访问受限,不如把服务器中的文件拷贝下来,在本地进行 init和update.

第一步 下载服务器中的文件

打开终端,输入下面指令:

git clone https://github.com/ros/rosdistro.git

最终会得到所用的文件,文件路径为(注意user替换为自己的用户名):

/home/user/rosdistro

第二步 修改文件

  1. 20-default.list文件,将服务器地址更换为本地。
sudo gedit /home/user/rosdistro/rosdep/sources.list.d/20-default.list 
# os-specific listings first
yaml file:///home/yourname/rosdistro/rosdep/osx-homebrew.yaml osx

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

# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
  1. gbpdistro_support.py 文件,同理。
sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py
FUERTE_GBPDISTRO_URL = 'file:///home/user/rosdistro/releases/fuerte.yaml'
  1. rep3.py文件
sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/rep3.py
REP3_TARGETS_URL = 'file:///home/user/rosdistro/releases/targets.yaml'
  1. _init_.py文件
sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/__init__.py
DEFAULT_INDEX_URL = 'file:///home/user/rosdistro/index-v4.yaml'

第三步 创建20-default.list文件,模拟 执行rosdep init的过程

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

复制以下内容,保存退出。

#os-specific listings first
yaml file:///home/user/rosdistro/rosdep/osx-homebrew.yaml osx
#generic
yaml file:///home/user/rosdistro/rosdep/base.yaml
yaml file:///home/user/rosdistro/rosdep/python.yaml
yaml file:///home/user/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/user/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命令

rosdep update
reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit file:///home/user/rosdistro/rosdep/osx-homebrew.yaml
Hit file:///home/user/rosdistro/rosdep/base.yaml
Hit file:///home/user/rosdistro/rosdep/python.yaml
Hit file:///home/user/rosdistro/rosdep/ruby.yaml
Hit file:///home/user/rosdistro/releases/fuerte.yaml
Query rosdistro index file:///home/user/rosdistro/index-v4.yaml
Skip end-of-life distro "ardent"
Add distro "bouncy"
Add distro "crystal"
Add distro "dashing"
Add distro "eloquent"
Skip end-of-life distro "groovy"
Skip end-of-life distro "hydro"
Skip end-of-life distro "indigo"
Skip end-of-life distro "jade"
Add distro "kinetic"
Skip end-of-life distro "lunar"
Add distro "melodic"
updated cache in /home/user/.ros/rosdep/sources.cache

至此问题解决。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值