目录
1. rosdep init 失败的解决办法
有时由于服务器,网络等问题,无法执行rosdep init操作,可以手动创建20-default.list文件,然后进行rosdep update操作。
1.2 Error
#出现如下错误
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.
1.3 手动创建20-default.list文件
$ 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
1.4 更新
$ rosdep update
2. rosdep update 失败的解决办法
无法执行rosdep update操作,可以先更新Ubuntu,再更新ROS。
2.1 Error
#出现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]:
<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 timed out> (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 timed out>
2.2 更新Ubuntu
$ sudo apt-get update
2.3 更新ROS
$ rosdep update
3. Ubuntu18.04安装ROS-melodic
#添加中科大的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
Reference
[1] ROS Melodic安装教程[EB/OL]. 2019.
[2] ROS国内镜像源[EB/OL]. 2019.