rosdep init和rosdep update出错的解决办法
我网络不好,运行rosdep init和rosdep update老是报timeout。很多博客上提供的修改hosts,连手机热点,改timeout数值等方法在我这里根本没用,依然报timeout。
最后解决这个问题是依靠这篇博客:
ros安裝後,初始化时rosdep update出错解决办法(親測)
按照上文的方法将index-v4.yaml,osx-homebrew.yaml,base.yaml
等yaml文件的内容下载到本地,然后修改/etc/ros/rosdep/sources.list.d/20-default.list
和/usr/lib/python2.7/dist-packages/rosdistro/__init__.py
,将其中相应的URL指向本地文件即可。
然而我在把文件存到本地之后,还遇到了一个不同的报错:
Add distro "foxy"
ERROR: error loading sources list:
<urlopen error <urlopen error [Errno 2]
No such file or directory:
'/mnt/76dce04d-5eeb-48e3-81c5-01188de3f152/
SLAM-codes/rosdep/foxy/distribution.yaml'> (file:///mnt/76dce04d-5eeb-48e3-81c5-01188de3f152
/SLAM-codes/rosdep/foxy/distribution.yaml)>
其中'/mnt/76dce04d-5eeb-48e3-81c5-01188de3f152/SLAM-codes/rosdep/'
是我存放index-v4.yaml
等yaml文件的根目录。
根据报错信息我猜测是文件夹缺少了/foxy/distribution.yaml
这个文件。解决方法是用浏览器访问https://raw.githubusercontent.com/ros/rosdistro/master/foxy/distribution.yaml
,把这个yaml文件下载到本地,相对路径存为:
[index-v4.yaml所在文件夹]/foxy/distribution.yaml。
这个错误就解决了。后面还会提示缺少/galactic/distribution.yaml
等几个文件,解决方法同理。总之缺什么你就往本地下载什么。