有时由于服务器,网络等问题,无法执行rosdep init操作,可以手动创建20-default.list文件,然后进行rosdep update操作。
#出现如下错误
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.
$ sudo nano /etc/ros/rosdep/sources.list.d/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
无法执行rosdep update操作,可以先更新Ubuntu,再更新ROS。
#出现timeout错误
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]:
(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]:
(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]:
(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]:
(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:
$ sudo apt-get update
$ rosdep update
#添加中科大的ROS镜像源
$ sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
#配置key,原先4开头的key禁用了,换成下面的key
$ sudo apt-key del 421C365BD9FF1F717815A3895523BAEEB01FA116
$ sudo -E apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
#更新
$ sudo apt-get update
#安装melodic桌面完整版
$ sudo apt-get install ros-melodic-desktop-full
#初始化rosdep
$ sudo rosdep init
#ROS更新
$ rosdep update
#配置环境变量 source
$ echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
$ source ~/.bashrc
#创建工作空间
$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/src
$ catkin_init_workspace
#编译并配置工作空间
$ cd ..
$ catkin_make
$ echo "source ~/catkin_ws/devel/setup.bash">> ~/.bashrc
[1] ROS Melodic安装教程[EB/OL]. 2019.
[2] ROS国内镜像源[EB/OL]. 2019.