你是否在安装ros 和实际应用过程中执行 rosdep update 一直无法成功,提示链接 https://raw.github 相关的链接无法成功。
现在有两种方式处理,一种是直接修改远程对应的链接位置,是可以命令行过程中可以连接上;
另外一种就是将链接调整为本地化操作
1.远程链接化
参考fishros的操作
wget http://fishros.com/install -O fishros && . fishros
[3]:一键安装:rosdep(小鱼的rosdepc,又快又好用)
参考 tool_config_rosdep.py
# -*- coding: utf-8 -*-
from .base import BaseTool
from .base import PrintUtils,CmdTask,FileUtils,AptUtils,ChooseTask
from .base import osversion
from .base import run_tool_file
class Tool(BaseTool):
def __init__(self):
self.type = BaseTool.TYPE_CONFIG
self.name = "模板工程"
self.autor = '小鱼'
def install_rosdepc(self):
CmdTask("sudo apt install python3-pip -y", 0).run()
CmdTask("sudo pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple rosdepc", 0).run()
CmdTask("sudo rosdepc init", 0).run()
CmdTask("sudo rosdepc fix-permissions", 0).run()
PrintUtils.print_info('已为您安装好rosdepc,请使用:\nrosdepc update \n进行测试更新,最后欢迎关注微信公众号《鱼香ROS》')
def run(self):
#正式的运行
self.install_rosdepc()
执行更新成功
rosdepc 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 https://mirrors.tuna.tsinghua.edu.cn/github-raw/ros/rosdistro/master/rosdep/osx-homebrew.yaml
Hit https://mirrors.tuna.tsinghua.edu.cn/github-raw/ros/rosdistro/master/rosdep/base.yaml
Hit https://mirrors.tuna.tsinghua.edu.cn/github-raw/ros/rosdistro/master/rosdep/python.yaml
Hit https://mirrors.tuna.tsinghua.edu.cn/github-raw/ros/rosdistro/master/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"
Add distro "iron"
Skip end-of-life distro "jade"
Skip end-of-life distro "kinetic"
Skip end-of-life distro "lunar"
Skip end-of-life distro "melodic"
Add distro "noetic"
Add distro "rolling"
updated cache in /root/.ros/rosdep/sources.cache
但是还是在源码安装ros(ubuntu22.04 + noetic),使用其它的dep工具执行中还是有问题
/opt/ros/noetic_ws$ rosinstall_generator desktop --rosdistro noetic --deps --tar > noetic-desktop.rosinstall
Traceback (most recent call last):
File "/usr/lib/python3.10/urllib/request.py", line 1348, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "/usr/lib/python3.10/http/client.py", line 1283, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.10/http/client.py", line 1329, in _send_request
2. 本地rosdep链接化
参考原博客:ROS与gazebo中常见问题【持续更新中】rosdep update time out及失败解决方案
2.1 indigo kinetic melodic 对应 python2 的处理
- clone rosdistro 到本地
mkdir -p ~/.ros/rosdep
cd ~/.ros/rosdep
git clone https://github.com/ros/rosdistro
修改本地repo内链接
cat rosdep/sources.list.d/20-default.list
yaml file:///home/robot/.ros/rosdep/rosdistro/rosdep/osx-homebrew.yaml osx
# generic
yaml file:///home/kint/.ros/rosdep/rosdistro/rosdep/base.yaml
yaml file:///home/kint/.ros/rosdep/rosdistro/rosdep/python.yaml
yaml file:///home/kint/.ros/rosdep/rosdistro/rosdep/ruby.yaml
gbpdistro file:///kint/robot/.ros/rosdep/rosdistro/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
- 修改 20-default.list 连接为本地下载的rosdistro 里面的对应文件
将文件中的网址https://raw.githubusercontent.com/ros/rosdistro/master修改为下载目录file:///home/xxx/rosdistro
sudo vim /etc/ros/rosdep/sources.list.d/20-default.list
yaml file:///home/kint/.ros/rosdep/rosdistro/rosdep/osx-homebrew.yaml osx
#generic
yaml file:///home/kint/.ros/rosdep/rosdistro/rosdep/base.yaml
yaml file:///home/kint/.ros/rosdep/rosdistro/rosdep/python.yaml
yaml file:///home/kint/.ros/rosdep/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/kint/.ros/rosdep/rosdistro/releases/fuerte.yaml fuerte
#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
- 修改sources_list.py文件
sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/sources_list.py
#DEFAULT_SOURCES_LIST_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list'
DEFAULT_SOURCES_LIST_URL = 'file:///etc/ros/rosdep/sources.list.d/20-default.list'
- 修改rep3.py
sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/rep3.py
REP3_TARGETS_URL = 'file:///home/kint/.ros/rosdep/rosdistro/releases/targets.yaml'
#REP3_TARGETS_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/releases/targets.yaml'
- . 修改_init_.py文件
sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/__init__.py
DEFAULT_INDEX_URL = 'file:///home/kint/.ros/rosdep/rosdistro/index-v4.yaml'
#DEFAULT_INDEX_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'
- 重新更新
sudo rosdep init
如果20-default.list 已经存在,可以先删除,再执行一遍sudo rosdep init
rosdep update
---------正确更新的log
kint@kint:~/.ros/rosdep$ rosdep update
reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit file:///home/kint/.ros/rosdep/rosdistro/rosdep/osx-homebrew.yaml
Hit file:///home/kint/.ros/rosdep/rosdistro/rosdep/base.yaml
Hit file:///home/kint/.ros/rosdep/rosdistro/rosdep/python.yaml
Hit file:///home/kint/.ros/rosdep/rosdistro/rosdep/ruby.yaml
Hit file:///home/kint/.ros/rosdep/rosdistro/releases/fuerte.yaml
Query rosdistro index file:///home/kint/.ros/rosdep/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"
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/kint/.ros/rosdep/sources.cache
-----------------
2.2 noetic对应 python2 的处理
ubuntu 22.04对应python3相关的
下载rosdep到本地
mkdir -p ~/.ros/rosdep
cd ~/.ros/rosdep
git clone git@github.com:ros/rosdistro.git
修改repo内链接
robot@robot:~/.ros/rosdep/rosdistro$ git status
modified: rosdep/sources.list.d/20-default.list
robot@robot:~/.ros/rosdep/rosdistro$ git diff
diff --git a/rosdep/sources.list.d/20-default.list b/rosdep/sources.list.d/20-default.list
index fb6744c4d..d232d62af 100644
--- a/rosdep/sources.list.d/20-default.list
+++ b/rosdep/sources.list.d/20-default.list
@@ -1,10 +1,10 @@
-# os-specific listings first
-yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
+
+yaml file:///home/robot/.ros/rosdep/rosdistro/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
+yaml file:///home/robot/.ros/rosdep/rosdistro/rosdep/base.yaml
+yaml file:///home/robot/.ros/rosdep/rosdistro/rosdep/python.yaml
+yaml file:///home/robot/.ros/rosdep/rosdistro/rosdep/ruby.yaml
+gbpdistro file:///home/robot/.ros/rosdep/rosdistro/releases/fuerte.yaml fuerte
+
+# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
\ No newline at end of file
cat rosdep/sources.list.d/20-default.list
yaml file:///home/robot/.ros/rosdep/rosdistro/rosdep/osx-homebrew.yaml osx
# generic
yaml file:///home/robot/.ros/rosdep/rosdistro/rosdep/base.yaml
yaml file:///home/robot/.ros/rosdep/rosdistro/rosdep/python.yaml
yaml file:///home/robot/.ros/rosdep/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/robot/.ros/rosdep/rosdistro/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
修改链接为本地
sudo gedit /etc/ros/rosdep/sources.list.d/20-default.list
yaml file:///home/robot/.ros/rosdep/rosdistro/rosdep/osx-homebrew.yaml osx
# generic
yaml file:///home/robot/.ros/rosdep/rosdistro/rosdep/base.yaml
yaml file:///home/robot/.ros/rosdep/rosdistro/rosdep/python.yaml
yaml file:///home/robot/.ros/rosdep/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/robot/.ros/rosdep/rosdistro/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
sudo gedit /usr/lib/python3/dist-packages/rosdep2/sources_list.py
#DEFAULT_SOURCES_LIST_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list'
DEFAULT_SOURCES_LIST_URL = 'file:///home/robot/.ros/rosdep/rosdistro/rosdep/sources.list.d/20-default.list'
sudo gedit /usr/lib/python3/dist-packages/rosdep2/rep3.py
#REP3_TARGETS_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/releases/targets.yaml'
REP3_TARGETS_URL = 'file:///home/robot/.ros/rosdep/rosdistro/releases/targets.yaml'
sudo gedit /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:///home/robot/.ros/rosdep/rosdistro/index-v4.yaml'
命令更新
sudo rm /etc/ros/rosdep/sources.list.d/20-default.list
sudo rosdep init
rosdep update
成功输出:
robot@robot:~$ rosdep update
reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit file:///home/robot/.ros/rosdep/rosdistro/rosdep/osx-homebrew.yaml
Hit file:///home/robot/.ros/rosdep/rosdistro/rosdep/base.yaml
Hit file:///home/robot/.ros/rosdep/rosdistro/rosdep/python.yaml
Hit file:///home/robot/.ros/rosdep/rosdistro/rosdep/ruby.yaml
Hit file:///home/robot/.ros/rosdep/rosdistro/releases/fuerte.yaml
Query rosdistro index file:///home/robot/.ros/rosdep/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"
Add distro "iron"
Skip end-of-life distro "jade"
Skip end-of-life distro "kinetic"
Skip end-of-life distro "lunar"
Skip end-of-life distro "melodic"
Add distro "noetic"
Add distro "rolling"
updated cache in /home/robot/.ros/rosdep/sources.cache