ROS学习笔记(十二)ROS noetic ubuntu20.04 版本 rosdep init,rosdep update 问题解决方法

ROS1 noetic 版本在ubuntu20.04安装出现问题,rosdep update无法下载,网络地址访问超时。

ROS1 noetic 版本在ubuntu20.04系统上的安装方法见博客:Ubuntu Server 20.04 based on Raspberry- Pi-4B 安装 ROS1 Noetic_Wogg的博客-CSDN博客

一、rosdep init问题

1. sudo rosdep init 出现安全问题

sudo rosdep init命令时出现访问安全性问题,通过将

sudo vim /etc/apt/sources.list.d/ros-latest.list

在ros-latest.list文件中进行修改 

deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ focal main

改为:

deb [trusted=yes] http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ focal main

可以顺利通过sudo rosdep init命令。

2. sudo rosdep init 出现网络问题

出现一下问题:

ubuntu@ubuntu:~$ sudo rosdep init
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.

方法一: 增加raw.githubusercontent.com域名与ip之间的映射

$ sudo vim /etc/hosts

151.101.84.133  raw.githubusercontent.com 

方法二: 直接创建文件

sudo rosdep init  作用就是在cd /etc/ros/rosdep/sources.list.d下创建下载列表20-default.list,网站挂掉,直接在相关文件夹下创建即可,无需再执行命令

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

 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

二、rosdep update问题

rosdep update 核心问题就是raw.githubusercontent.com无法访问,导致相关文件无法下载。

使用IP138 查询raw.githubusercontent.com,发现该域名已经被禁止。

按照网上的方法,通过在/etc/hosts中添加域名解析的ip:【151.101.84:133  raw.githubusercontent.com】也无法解决,更换过多个ip也无济于事。

将需要的文件下载到本地,然后指定文件的位置,即可解决该问题。

1. 从github上下载所需要的rosdistro

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

git下载较慢,可从这里下载: 

rosdistro-master.zip-互联网文档类资源-CSDN下载

将下载好的包移动到指定位置,例如:

sudo cp -r rosdistro /etc/ros

*** 也可不用移动,在下边的步骤中将 20-default.list中的文件路径指定到此包的相应文件即可。

2. 更改sources.list.d

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

在20-default.list文件更改下载项所在的位置。

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

# generic
yaml file:///etc/ros/rosdistro/rosdep/base.yaml
yaml file:///etc/ros/rosdistro/rosdep/python.yaml
yaml file:///etc/ros/rosdistro/rosdep/ruby.yaml
gbpdistro file:///etc/ros/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
reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit file:///etc/ros/rosdistro/rosdep/osx-homebrew.yaml
Hit file:///etc/ros/rosdistro/rosdep/base.yaml
Hit file:///etc/ros/rosdistro/rosdep/python.yaml
Hit file:///etc/ros/rosdistro/rosdep/ruby.yaml
ERROR: unable to process source [file:///etc/ros/rosdistro/releases/fuerte.yaml]:
	Failed to download target platform data for gbpdistro:
	<urlopen error timed out>
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
ERROR: error loading sources list:
	<urlopen error <urlopen error timed out> (https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml)>

 此时需要修改index-v4.yaml所在的位置

3. 更改python中的ros相关下载项

ros noetic版本基于python3,所以在/usr/lib/python3路径下修改,其他ros版本若基于python2的,需要找到对应的python2 路径进行修改。

3.1 修改在__init__.py文件中修改index-v4.yaml的位置

sudo vim /usr/lib/python3/dist-packages/rosdistro/__init__.py
#DEFAULT_INDEX_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'
DEFAULT_INDEX_URL = 'file:///etc/ros/rosdistro/index-v4.yaml'

3.2在rep3.py中修改targets.yaml文件的位置 

sudo vim /usr/lib/python3/dist-packages/rosdep2/rep3.py
# location of targets file for processing gbpdistro files
#REP3_TARGETS_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/releases/targets.yaml'
REP3_TARGETS_URL = 'file:///etc/ros/rosdistro/releases/targets.yaml'

4. 进行更新

rosdep update
ubuntu@ubuntu:/etc/ros/rosdep/sources.list.d$ sudo rosdep update
reading in sources list data from /etc/ros/rosdep/sources.list.d
Warning: running 'rosdep update' as root is not recommended.
  You should run 'sudo rosdep fix-permissions' and invoke 'rosdep update' again without sudo.
Hit file:///etc/ros/rosdistro/rosdep/osx-homebrew.yaml
Hit file:///etc/ros/rosdistro/rosdep/base.yaml
Hit file:///etc/ros/rosdistro/rosdep/python.yaml
Hit file:///etc/ros/rosdistro/rosdep/ruby.yaml
Hit file:///etc/ros/rosdistro/releases/fuerte.yaml
Query rosdistro index file:///etc/ros/rosdistro/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"
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 /root/.ros/rosdep/sources.cache

enjoy!

参考:

rosdep update一定能通过简单方法rosdep update_努力是明天快乐的源泉-CSDN博客

解决ROS系统 rosdep update超时问题的新方法_leida_wt的博客-CSDN博客_rosdep update 超时

ros 中ERROR: cannot download default sources list from: https://raw.githubusercontent.com/ros/rosdist_果肉虫的博客-CSDN博客

ubuntu18 ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/ros_蛇皮怪皮蛇的博客-CSDN博客
rosdep update 的解决_快乐男生总冠军的博客-CSDN博客_rosdep update
Ubuntu 18.04.05 LTS配置ROS Melodic各种问题详细解决(填坑)_晓晨的博客-CSDN博客

评论 21
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值