ubuntu24.04 ros2 rosdep相关

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.

<urlopen error <urlopen error [Errno 111] Connection refused>

说明 `rosdep` 无法连接到 GitHub 上的 `rosdistro` 仓库。

这几乎可以肯定是由于**网络连接问题**或**防火墙/代理设置**导致的。以下是详细的排查步骤和解决方案:

可以手动创建 `rosdep` 试图下载的文件。

  1. **创建源列表目录**:

```bash

sudo mkdir -p /etc/ros/rosdep/sources.list.d

```

  1. **手动创建 `20-default.list` 文件**:

使用 `gedit` 或其他编辑器打开该文件。

```bash

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

```

  1. **复制并粘贴以下内容**:

将下面的官方源列表内容复制到打开的 `gedit` 文件中并保存。

复制代码
# os-specific listings first yaml 
https://mirrors.tuna.tsinghua.edu.cn/rosdistro/rosdep/osx-homebrew.yaml osx # generic 
yaml https://mirrors.tuna.tsinghua.edu.cn/rosdistro/rosdep/base.yaml 
yaml https://mirrors.tuna.tsinghua.edu.cn/rosdistro/rosdep/python.yaml 
yaml https://mirrors.tuna.tsinghua.edu.cn/rosdistro/rosdep/ruby.yaml 

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

完成以上操作后,`sudo rosdep init` 的工作就已经手动完成了。你可以继续执行后续的 `rosdep update` 命令。

rosdep update 异常

  1. 修订源

sudo gedit /etc/ros/rosdep/sources.list.d/20-default.list 如上,

  1. 修改文件

/usr/lib/python3/dist-packages/rosdistro/init.py

这个修订很重要

复制代码
#DEFAULT_INDEX_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'
DEFAULT_INDEX_URL = 'https://mirrors.tuna.tsinghua.edu.cn/rosdistro/index-v4.yaml'

rosdep update

复制代码
~/ros2_ws$ rosdep  update 
/usr/bin/rosdep:6: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  from pkg_resources import load_entry_point
reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit https://mirrors.tuna.tsinghua.edu.cn/rosdistro/rosdep/osx-homebrew.yaml
Hit https://mirrors.tuna.tsinghua.edu.cn/rosdistro/rosdep/base.yaml
Hit https://mirrors.tuna.tsinghua.edu.cn/rosdistro/rosdep/python.yaml
Hit https://mirrors.tuna.tsinghua.edu.cn/rosdistro/rosdep/ruby.yaml
Query rosdistro index https://mirrors.tuna.tsinghua.edu.cn/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"
Skip end-of-life distro "foxy"
Skip end-of-life 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 "iron"
Skip end-of-life distro "jade"
Add distro "jazzy"
Add distro "kilted"
Skip end-of-life distro "kinetic"
Skip end-of-life distro "lunar"
Skip end-of-life distro "melodic"
Skip end-of-life distro "noetic"
Add distro "rolling"

好运!

相关推荐
wzyannn9 小时前
Ubuntu24.04下ROS2和MoveIt2控制六轴机械臂(持续更新)
ros·机械臂·ros2
小屁猪qAq14 小时前
ROS2 节点中使用参数
开发语言·c++·参数·ros2
WWZZ20252 天前
Isaac Sim入门——基础用法
机器人·大模型·机械臂·ros2·具身智能·isaac sim
General_G3 天前
ROS2资源汇总
linux·机器人·ros2
-点灯-9 天前
【无标题】
ros2
General_G10 天前
irobot_benchmark的编译和使用
linux·中间件·机器人·ros2
阿豪只会阿巴11 天前
【多喝热水系列】从零开始的ROS2之旅——Day10 话题的订阅与发布1:Python
开发语言·c++·python·ubuntu·ros2
阿豪只会阿巴11 天前
【多喝热水系列】从零开始的ROS2之旅——Day9 初识话题通信:基本命令
c++·笔记·python·ubuntu·ros2
阿豪只会阿巴11 天前
项目心得——发布者和订阅者问题解决思路
linux·开发语言·笔记·python·ubuntu·ros2
Tipriest_13 天前
ROS 2 rosbag2 播放出现 “Message queue starved. Messages will be delayed.” 的处理步骤
消息队列·ros2·缓存机制