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:
	<urlopen error <urlopen error timed out> (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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
### 回答1: 要解决ROS系统中的rosdep update问题,您可以尝试以下步骤: 1. 确保您的ROS版本已正确安装并配置。 2. 确认您的网络连接正常,可以访问ROS软件源。 3. 执行以下命令更新rosdep: ``` sudo apt-get update sudo apt-get install python-rosdep sudo rosdep init rosdep update ``` 4. 如果您仍然遇到问题,请尝试使用代理服务器或更改软件源。 希望这些步骤可以帮助您解决rosdep update问题。 ### 回答2: ROS是一个非常强大的机器人操作系统,它提供了大量的用于开发机器人应用程序的功能。然而,在使用ROS时,有时会出现rosdep update无法解决问题。有以下几种方法可以解决这个问题: 1.更改源 在执行rosdep update命令时,如果它卡在'connecting to raw.github.com'步骤,则可能是由于RAW GitHub被阻止了。为了解决这个问题,可以尝试更改ROS配置文件中的ROS下载源。打开终端并输入以下命令: sudo gedit /etc/apt/sources.list.d/ros-latest.list 然后将deb http://packages.ros.org/ros/ubuntu替换为deb [官方源] http://mirrors.ustc.edu.cn/ros/ubuntu和deb-src [官方源] http://mirrors.ustc.edu.cn/ros/ubuntu。 然后,保存更改并运行以下命令: sudo apt-get update 重新执行rosdep update命令,问题应该会解决。 2. 设置代理 如果你使用的是命令行,可以执行以下命令设置HTTPS代理: export HTTPS_PROXY="http://yourproxy:port" 如果你使用的是Ubuntu系统,可以在系统环境变量中设置代理。打开终端,输入以下命令: sudo vi /etc/environment 然后在文件末尾添加以下命令: HTTPS_PROXY="yourproxy:port" HTTP_PROXY="yourproxy:port" 保存文件,关闭并重启终端。 3.使用conda 使用conda可以避免rosdep update的这个问题。首先,在Anaconda中安装Miniconda。然后创建一个新conda环境并通过conda-forge频道安装ROS中所需的软件包。执行以下命令: conda create --name ros python=3.6 conda-forge-rospkg 然后激活新环境,即执行以下命令: conda activate ros 安装其他需要的软件包,例如rospy、rosbag和其他ROS包: conda install -c conda-forge rospy rosbag 这三种方法中任何一种都可以解决rosdep update问题。 ### 回答3: ROS(机器人操作系统)是一种开源框架,常用于机器人软件开发。在ROS中,rosdep是重要的工具之一,用于管理系统依赖。但是,当遇到rosdep update无法更新问题,可采取以下步骤: 1. 确认网络连接正常:运行命令ping www.baidu.com,确保网络连接正常。若没有网络连接,则需要排查问题,确保网络设置正确。 2. 检查软件源:在执行rosdep update时,需要从软件源中获取依赖包的信息。如果软件源损坏或者设置不正确,就会导致rosdep update失效。可以通过修改源的方式来解决问题。具体操作步骤如下: (1)进入/etc/apt目录,执行命令ls查看sources.list.d文件夹内是否存在ros-latest.list等ros相关的文件。 (2)确定需要修改的sources.list.d文件夹内的ros相关文件名,如ros-latest.list。 (3)备份该文件,使用命令sudo cp 文件文件名.bak进行备份。 (4)编辑文件,使用命令sudo gedit 文件名进行编辑。 (5)将原有的软件源修改为可用的软件源,例如修改为http://packages.ros.org/ros/ubuntu。修改完成后,保存并关闭编辑器。 (6)执行rosdep update进行测试。 3. 更新rosdep:如果上述步骤仍然无法解决问题,则可能是rosdep本身存在问题。可以通过升级rosdep解决。具体操作步骤如下: (1)执行命令sudo apt-get update 更新软件包列表。 (2)执行命令sudo apt-get install python-rosdep更新rosdep。 (3)执行命令sudo rosdep init,初始化rosdep。 (4)执行命令rosdep update更新rosdep。 4. 删除缓存文件:在rosdep update过程中,可能会因为本地缓存文件损坏而导致更新失败。可以通过删除缓存文件的方式解决问题。具体操作步骤如下: (1)执行命令sudo rm -rf /var/lib/apt/lists/*。 (2)执行命令sudo apt-get clean。 (3)执行命令sudo update。 (4)执行命令rosdep update。 总之,针对rosdep update无法更新问题,可以从修改软件源、更新rosdep、删除缓存文件等角度入手,找到问题所在并解决之。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值