初始化 rosdep
sudo 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.
为解决该问题,首先,克隆 rosdistro 仓库:
git clone https://github.com/ros/rosdistro.git
然后,本地新建对应目录:
sudo mkdir -p /etc/ros/rosdep/sources.list.d
最后,将克隆下来的 rosdistro
仓库中的 list
文件拷贝到上述目录:
cd rosdistro sudo cp rosdep/sources.list.d/20-default.list /etc/ros/rosdep/sources.list.d/
更新本地 rosdep 数据库
rosdep update
同样是由于域名污染,这一步往往会报下面的错误:
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 [Errno 111] Connection refused> (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 [Errno 111] Connection refused> (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 [Errno 111] Connection refused> (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 [Errno 111] Connection refused> (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 [Errno 111] Connection refused> Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml ERROR: error loading sources list: <urlopen error <urlopen error [Errno 111] Connection refused> (https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml)>
假设已经解决上面步骤中 rosdep init
遇到的问题,现在需要编辑以下四个文件:
-
/etc/ros/rosdep/sources.list.d/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
搜索文件中的 https://raw.githubusercontent.com/ros/rosdistro/master
字段,将其替换为本地 rosdistro
仓库的绝对地址,例如本示例中为 file:///home/xxx/rosdistro
。(xxx对应自己的安装路径)
编辑后的 list
文件如下所示:
# os-specific listings first yaml file:///home/xxx/rosdistro/rosdep/osx-homebrew.yaml osx # generic yaml file:///home/xxx/rosdistro/rosdep/base.yaml yaml file:///home/xxx/rosdistro/rosdep/python.yaml yaml file:///home/xxx/rosdistro/rosdep/ruby.yaml gbpdistro file:///home/xxx/rosdistro/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
命令即可:
reading in sources list data from /etc/ros/rosdep/sources.list.d Hit file:///home/xxx/rosdistro/rosdep/osx-homebrew.yaml Hit file:///home/xxx/rosdistro/rosdep/base.yaml Hit file:///home/xxx/rosdistro/rosdep/python.yaml Hit file:///home/xxx/rosdistro/rosdep/ruby.yaml Hit file:///home/xxx/rosdistro/releases/fuerte.yaml Query rosdistro index file:///home/xxx/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" 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/xxx/.ros/rosdep/sources.cache