解决Ubuntu18.04 安装ROS中 sudo rosdep init 和 rosdep update 失败问题

本文详细介绍了在Ubuntu18.04上安装ROS时遇到的sudorosdepinit命令找不到、无法下载及rosdepupdate连接超时等问题的解决方案。包括手动创建并编辑rosdep配置文件、使用代理加速以及修改gbpdistro_support.py文件来解决网络连接问题。
摘要由CSDN通过智能技术生成

解决Ubuntu18.04 安装ROS中 sudo rosdep init 和 rosdep update 失败问题


目录

解决Ubuntu18.04 安装ROS中 sudo rosdep init 和 rosdep update 失败问题

一、sudo rosdep init  找不到命令提示

二、运行sudo rosdep init无法下载 

三、运行rosdep update连接超时(Errno 104)


一、sudo rosdep init  找不到命令提示

sudo apt-get install python-rosdep

二、运行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.

主要原因是被樯了,我测试了网上多种方法 ,如修改DNS、修改IP、设置hosts文件等,都不行,所以一气之下我就直接翻墙出去查看这个文件内容,拷贝手动存储。结果可行(时间:2021年5月27日)

具体方法如下:

sudo mkdir -p /etc/ros/rosdep/sources.list.d/
sudo gedit /etc/ros/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

然后直接运行rosdep update即可;如果再运行 sudo rosdep init 可能依然会提示无法下载或者提示以存在。


三、运行rosdep update连接超时(Errno 104)

reading in sources list data from /etc/ros/rosdep/sources.list.d
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml]:
	<urlopen error timed out> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml)
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml]:
	<urlopen error timed out> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml)
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml]:
	<urlopen error timed out> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml)
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml]:
	<urlopen error [Errno 104] Connection reset by peer> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml)
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml]:
	Failed to download target platform data for gbpdistro:
	<urlopen error ('_ssl.c:711: The handshake operation 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)>

上面 为本色更改DNS 等后的错误 ,在本人运行时以改回 ,主要看代码 104 的问题即可

本人最终是通过这里解决的,即利用https://ghproxy.com/进行代理加速,本文不再进行介绍,下面只对自己遇到的问题进行接受;

经过上篇文章进行修改后出现了:

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 https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml]:
	Failed to download target platform data for gbpdistro:
	<urlopen error [Errno 104] Connection reset by peer>
Query rosdistro index https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
Skip end-of-life distro "ardent"
Skip end-of-life distro "bouncy"
Skip end-of-life distro "crystal"
Add 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 /home/user/.ros/rosdep/sources.cache
ERROR: Not all sources were able to be updated.
[[[
ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml]:
	Failed to download target platform data for gbpdistro:
	<urlopen error [Errno 104] Connection reset by peer>
]]]

经过评论区大佬的提示:需要在/usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py中插入     gbpdistro_url = "https://ghproxy.com/" + gbpdistro_url ,如下:

gedit /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py

如图插入:

再运行rosdep update 即可:

  • 13
    点赞
  • 51
    收藏
    觉得还不错? 一键收藏
  • 13
    评论
### 回答1: 以下是树莓派安装Ubuntu 18.04和ROS的步骤: 1. 下载Ubuntu 18.04的镜像文件,并将其烧录到SD卡。 2. 将SD卡插入树莓派,并启动树莓派。 3. 连接到树莓派的终端,更新软件源: ``` sudo apt-get update sudo apt-get upgrade ``` 4. 安装ROS: ``` sudo apt-get install ros-melodic-desktop-full ``` 5. 初始化ROS: ``` sudo rosdep init rosdep update echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc source ~/.bashrc ``` 6. 创建ROS工作空间: ``` mkdir -p ~/catkin_ws/src cd ~/catkin_ws/ catkin_make ``` 7. 测试ROS是否安装成功: ``` roscore ``` 如果没有错误,说明ROS已经成功安装。 以上就是在树莓派上安装Ubuntu 18.04和ROS的步骤。 ### 回答2: 树莓派是一款广泛应用于嵌入式系统的小型计算机,而ROS则是一种机器人开发框架,也被广泛应用于机器人领域。因此,在树莓派上装上ROS,便能够为机器人开发提供一个简单而强大的工具。下面是安装过程: 1. 安装Ubuntu 18.04. 在树莓派上运行ROS,需要运行Ubuntu 18.04或更高版本。因此,首先需要在树莓派上安装Ubuntu 18.04操作系统。可以从Ubuntu官网直接下载Ubuntu 18.04的镜像文件,然后将其烧录到SD卡。 2. 安装ROS. 在安装ROS之前,需要设置好Ubuntu软件源,以便能够顺利下载和安装ROS。具体步骤如下: - 设置Ubuntu源:sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu bionic main" > /etc/apt/sources.list.d/ros-latest.list' - 设置ROS key:sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 0xB01FA116 - 安装ROS桌面完整版:sudo apt-get update && sudo apt-get install ros-melodic-desktop-full - 初始化ROSsudo rosdep init && rosdep update - 设置环境变量:echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc && source ~/.bashrc 3. 测试ROS. 在安装ROS之后,需要测试它是否已经正确安装。可以使用ROS的demo节点进行测试。具体步骤如下: - 打开一个终端,输入:roscore - 打开另一个终端,输入:rosrun turtlesim turtlesim_node - 打开第三个终端,输入:rosrun turtlesim turtle_teleop_key - 然后你可以使用键盘控制乌龟向前、向后、向左、向右运动,从而完成ROS的测试。 以上就是在树莓派上安装ROS的步骤。值得注意的是,由于树莓派的性能和运行环境的限制,ROS在树莓派上运行可能会比较慢,因此在实际的机器人开发,需要根据实际情况进行性能优化。 ### 回答3: 树莓派是一种小型的计算机,广泛应用于各种嵌入式系统,而ros则是一个开源机器人操作系统。通过在树莓派安装ros,我们可以在树莓派上开发实现各种机器人应用。本文将详细介绍如何在树莓派上安装ubuntu18.04ros。 首先,我们需要一个SD卡,将树莓派的操作系统安装在里面。我们可以通过Raspberry Pi Imager软件将ubuntu18.04镜像写入SD卡。写入完成后,将SD卡插入树莓派,开机。 接下来,我们需要为树莓派配置网络,可以通过以下命令来配置: ``` sudo nano /etc/network/interfaces ``` 将文件原有的内容替换为以下内容: ``` auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp ``` 保存退出后,执行以下命令使配置生效: ``` sudo ifdown eth0 && sudo ifup eth0 ``` 接下来,我们需要配置ubuntu软件源,以便安装ros。 ``` sudo nano /etc/apt/sources.list.d/ros-latest.list ``` 将文件原有的内容替换为以下内容: ``` deb http://packages.ros.org/ros/ubuntu bionic main ``` 保存退出后,执行以下命令添加ROS keys: ``` curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - ``` 接下来,我们需要安装ROS的核心组件。执行以下命令: ``` sudo apt update sudo apt install ros-melodic-ros-base -y ``` 安装完成后,我们需要初始化ROS: ``` sudo rosdep init rosdep update echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc source ~/.bashrc ``` 接下来,我们需要创建一个catkin工作区,以用于开发ros应用。 ``` mkdir -p ~/catkin_ws/src cd ~/catkin_ws/ catkin_make echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc source ~/.bashrc ``` 至此,ros安装完成,我们可以进行一些简单的测试: ``` roscore ``` 打开另一个终端,执行以下命令: ``` rosrun turtlesim turtlesim_node ``` 此时,我们应该能够看到海龟图形的窗口,表示ros已经成功安装并运行。
评论 13
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值