我使用的环境是Ubuntu16.04 + Kinetic。
按照官方的教程,执行到
rosdep update
这个命令时提示:
<urlopen error <urlopen error ('_ssl.c:574: The handshake operation timed out',)>
解决方法:
1. 将需要使用的包直接下载下来
git clone https://github.com/ros/rosdistro.git
连接github可能需要修改hosts文件
52.74.223.119 github.com
185.199.109.133 raw.githubusercontent.com
185.199.110.133 raw.githubusercontent.com
185.199.111.133 raw.githubusercontent.com
185.199.112.133 raw.githubusercontent.com
ip地址是动态的,使用IPAddress查询。
2. 修改rosdep需要执行的python文件,将其中的URL后的地址设置成这个安装包的安装位置
cd /usr/lib/python2.7/dist-packages
sudo gedit rosdep2/rep3.py
sudo gedit rosdistro/__init__.py
sudo gedit rosdep2/sources_list.py
修改rep3.py文件为REP3_TARGETS_URL = 'file:///home/chenpeng/rosdistro/releases/targets.yaml'
修改__init__.py文件为DEFAULT_INDEX_URL = 'file:///home/chenpeng/rosdistro/index-v4.yaml'
修改rosdep2/sources_list.py文件为DEFAULT_SOURCES_LIST_URL = 'file:///home/chenpeng/rosdistro/rosdep/sources.list.d/20-default.list'
3. 修改文件/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
yaml file:///home/chenpeng/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
yaml file:///home/chenpeng/rosdistro/rosdep/base.yaml
yaml file:///home/chenpeng/rosdistro/rosdep/python.yaml
yaml file:///home/chenpeng/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/chenpeng/rosdistro/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
4. 修改文件/usr/lib/python2.7/dist-packages/rosdistro/__init__.py
# index information
#DEFAULT_INDEX_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'
DEFAULT_INDEX_URL = 'file:///etc/ros/rosdistro/master/index-v4.yaml'
之后就执行成功了。