admin管理员组

文章数量:1567647

问题简述
操作系统:Ubuntu16.04/Ubuntu18.04/Ubuntu20.04
ROS版本:kinetic/melodic/noetic
最近在学习ORB-SLAM2的安装使用,编译过程中发现在ROS下需要用到rosdep命令:

sudo rosdep init

出现如下报错:

ERROR: cannot download default sources list from:
https://raw.githubusercontent/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.

1.常规方法

古月博主曾经对此问题进行了整理,但是按照目前的网络环境,依然存在问题。
参考文章:
https://www.guyuehome/12640
https://blog.csdn/JanKin_BY/article/details/105509383

根本原因在于网络不通,如果上述文章没有帮助,请参考以下解决方案:
1.把电脑带去大学校园(学校网站是后缀为.edu的),利用其校园网络使用rosdep命令;
2.尝试利用手机热点(移动、联通、电信都尝试一下)。

希望有所帮助!如果问题已解决后文不必再看

2.终极解决方法:

raw.githubusercontent实际上就是github的用户数据服务器,rosdep程序下载的就是github/ros/rosdistro这个repo里的yaml文件。

虽然raw.githubusercontent服务器无法访问,但是yaml文件可以直接从git clone的repo中获得。

所以,只要将ros/rosdistro整个git下来,然后再将
•20-default.list
•/usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py
•/usr/lib/python2.7/dist-packages/rosdep2/rep3.py
•/usr/lib/python2.7/dist-packages/rosdistro/init.py

中的默认url全部指向本地的git,即可解决这个问题。

解决步骤
1.git clone https://github/ros/rosdistro.git;
2.在本地rosdistro中搜索20-default.list,将其url指向本地repo;
3.搜索rosdep2和rosdistro中出现http://raw.githubusercontent的位置,将其指向本地repo。
4:打开一个终端,执行以下指令创建root并切换至root用户

sudo passwd    //接着提示输入UNIX密码,输入你的用户密码即可
sudo su //或者su root 然后输入密码切换至root用户
sudo mkdir -p /etc/ros/rosdep/sources.list.d
cd /etc/ros/rosdep/sources.list.d
sudo gedit 20-default.list

5:将以下内容复制进20-default.list文件中

#os-specific listings first
yaml file:///home/yourname/rosdistro/rosdep/osx-homebrew.yaml osx
#generic
yaml file:///home/yourname/rosdistro/rosdep/base.yaml
yaml file:///home/yourname/rosdistro/rosdep/python.yaml
yaml file:///home/yourname/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/yourname/rosdistro/rosdep/fuerte.yaml fuerte

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

rosdep update

效果如图所示:

本文标签: 报错解决方法rosdeprosupdate