ubuntu rosdep init或rosdep update失败

本文档详细介绍了如何解决ROS的rosdep初始化和更新失败的问题,包括修改源列表、替换为本地文件、编辑rosdistro的__init__.py文件等步骤,旨在帮助用户成功执行rosdepupdate。

1、换热点,换wifi,多试试

2、sudo rosdep init失败
手动:在/etc/ros/rosdep/sources.list.d目录下新建一个文件,名20-defau.list,然后将https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/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

3、执行rosdep update失败
从下面github中直接下载,放到到/etc/ros/rosdistro目录下,rosdistro需要新建

git clone https://github.com/Jiangjianyu/ros-use.git

修改20-default.list脚本

# os-specific listings first
#yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
yaml file:///etc/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
 
yaml file:///etc/ros/rosdistro/master/rosdep/base.yaml
yaml file:///etc/ros/rosdistro/master/rosdep/python.yaml
yaml file:///etc/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro file:///etc/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。在更新过程中,还有部分配置信息会从raw.githubusercontent.com上下载,但是反复几次,基本上就可以成功了。
经过上面两步,还是失败,请继续往下看。
sudo 打开/usr/lib/python2.7/dist-packages/rosdistro/下的__init__.py这个文件,按照下面的代码进行修改。

sudo gedit /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/rosdistro/master/index-v4.yaml'

保存后,执行

sudo apt-get update
rosdep update。

祝你成功!!!

当执行 `sudo rosdep init && rosdep update` 时提示 `sudo: rosdep:找不到命令`,通常是由于 ROS 相关工具未正确安装者环境变量未正确配置导致的。以下是一些可能的解决办法: ### 1. 确认 ROS 已正确安装 确保 ROS 已经成功安装到系统中。如果没有安装,需要按照官方文档进行安装。以 Ubuntu 系统安装 ROS Melodic 为例,安装命令如下: ```bash sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C65 sudo apt update sudo apt install ros-melodic-desktop-full ``` ### 2. 初始化 ROS 环境变量 安装完成后,需要初始化 ROS 环境变量。可以通过以下命令来完成: ```bash echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc source ~/.bashrc ``` 这里假设安装的是 ROS Melodic 版本,如果是其他版本,需要相应修改版本名称。 ### 3. 检查 rosdep 是否安装 `rosdep` 是 ROS 的依赖管理工具,需要确保它已经安装。可以使用以下命令进行安装: ```bash sudo apt install python-rosdep ``` ### 4. 重新尝试命令 完成上述步骤后,再次尝试执行 `sudo rosdep init && rosdep update` 命令。 ### 5. 手动创建配置文件(可选) 如果上述方法都无法解决问题,可以尝试手动创建 `rosdep` 的配置文件。参考引用[3],可以通过以下命令创建并编辑 `20-default.list` 文件: ```bash sudo mkdir -p /etc/ros/rosdep/sources.list.d cd /etc/ros/rosdep/sources.list.d sudo gedit 20-default.list ``` 然后在文件中添加以下内容(参考引用[4]): ```plaintext yaml https://raw.ctl.app/ros/rosdistro/master/rosdep/base.yaml yaml https://raw.ctl.app/ros/rosdistro/master/rosdep/python.yaml yaml https://raw.raw.ctl.app/ros/rosdistro/master/rosdep/ruby.yaml gbpdistro https://raw.ctl.app/ros/rosdistro/master/releases/fuerte.yaml fuerte ``` 保存文件后,再次尝试执行 `sudo rosdep init && rosdep update` 命令。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

姜聿于

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值