ROS rosdep init 和 ROS rosdep update更新失败问题(手动添加文件解决)

ROS rosdep init 和 ROS rosdep update更新失败问题(手动添加文件解决)

1 问题

因个人Ubuntu 18.04 国内网络原因,rosdep init 和 update更新失败,找了很多办法最终手动复制文件解决。

reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit file:///etc/ros/rosdep/osx-homebrew.yaml
Hit file:///etc/ros/rosdep/base.yaml
Hit file:///etc/ros/rosdep/python.yaml
Hit file:///etc/ros/rosdep/ruby.yaml
Hit file:///etc/ros/rosdep/fuerte.yaml
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
ERROR: error loading sources list:
	 (https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml)>

2 解决方法

2.1 ROS rosdep init 解决方法

修改hosts

# github ip
# 自己的 ip
172.17.0.1 raw.githubusercontent.com git
# raw.githubusercontent.com 最新的ip  https://www.ipaddress.com 查询
185.199.110.133 raw.githubusercontent.com
#199.232.28.133 raw.githubusercontent.com

即可解决

2.2 ROS rosdep update 解决方法

1 完成上一步,会生成一个20-default.list 文件

路径为:/etc/ros/rosdep/sources.list.d/20-default.list

# 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

下载所有的文件放在/etc/ros/rosdep/ 下面

2 修改20-default.list,改为绝对路径

# os-specific listings first
yaml file:///etc/ros/rosdep/osx-homebrew.yaml osx

# generic
yaml file:///etc/ros/rosdep/base.yaml
yaml file:///etc/ros/rosdep/python.yaml
yaml file:///etc/ros/rosdep/ruby.yaml
gbpdistro file:///etc/ros/rosdep/fuerte.yaml fuerte

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

3 下载文件index-v4.yaml,放置在/etc/ros/rosdep/ 下面

此步骤可能会出问题:Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml

https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml

sudo 打开/usr/lib/python2.7/dist-packages/rosdistro/init.py这个文件,按照下面的代码进行修改。

# index information
#DEFAULT_INDEX_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'
DEFAULT_INDEX_URL = 'file:///etc/ros/rosdep/index-v4.yaml'

5 下载文件,带文件夹放置在/etc/ros/rosdep/ 下面

地址:https://github.com/ros/rosdistro
找到下图中的几个文件夹,拷贝到/etc/ros/rosdep/ 下面

在这里插入图片描述

6 重新进行 rosdep update

此时应该是会成功的(未成功就多试几次),成功的提示如下:

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

time:2022年12月6日
Ref:
https://blog.csdn.net/super_sean/article/details/105433250

你可能感兴趣的:(算法,计算机视觉,自动驾驶,c++,opencv)