ROS常见问题解决

rosdep update  出现错误

如下图所示 rosdep update出现错误

image

终止正在进行的程序:出现如下的信息

image

1
sudo gedit usr/lib/python2.7/urllib2.py

具体步骤如下:

1、通过以下命令,修改hosts文件,将其改为如下:

1
sudo gedit /etc/hosts

image

1
2
3
4
5
6
7
8
9
10
11
12
13
14
127.0.0.1   localhost
127.0.1.1 yww

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
#151.101.84.133 raw.githubusercontent.com
199.232.28.133 raw.githubusercontent.com
#151.101.228.133 raw.github.com
#199.232.28.133 raw.githubusercontent.com
#151.101.228.133 raw.github.com

2、更改 /etc/ros/rosdep/sources.list.d/20-default.list  文件为如下图所示:

image

1
2
3
4
5
6
7
8
9
10
# os-specific listings first
yaml https://raw.fastgit.org/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx

# generic
yaml https://raw.githubusercontents.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://raw.fastgit.org/ros/rosdistro/master/rosdep/python.yaml
yaml https://raw.githubusercontents.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://raw.githubusercontents.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

3、通过以下命令打开rep3.py并将下载时间调为100000000.0

1
sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/rep3.py

image

同理,也将/usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py文件中的DOWNLOAD_TIMEOUT时间改为100000000.0

4、通过以下命令打开urllib2.py并加入图片中的代码:

1
sudo gedit /usr/lib/python2.7/urllib2.py

image

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
if url=="https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml":
url="https://raw.githubusercontents.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml"

if url=="https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml":
url="https://raw.githubusercontents.com/ros/rosdistro/master/rosdep/base.yaml"

if url=="https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml":
url="https://raw.githubusercontents.com/ros/rosdistro/master/rosdep/python.yaml"

if url=="https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml":
url="https://raw.githubusercontents.com/ros/rosdistro/master/rosdep/ruby.yaml"

if url=="https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml":
url="https://raw.githubusercontents.com/ros/rosdistro/master/rosdep/ruby.yaml"

if url=="https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml":
url="https://raw.githubusercontents.com/ros/rosdistro/master/index-v4.yaml"

if url=="https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml":
url="https://raw.githubusercontents.com/ros/rosdistro/master/index-v4.yaml"

if url=="https://raw.githubusercontent.com/ros/rosdistro/master/foxy/distribution.yaml":
url="https://raw.githubusercontents.com/ros/rosdistro/master/foxy/distribution.yaml"

if url=="https://raw.githubusercontent.com/ros/rosdistro/master/galactic/distribution.yaml":
url="https://raw.githubusercontents.com/ros/rosdistro/master/galactic/distribution.yaml"


if url=="https://raw.githubusercontent.com/ros/rosdistro/master/melodic/distribution.yaml":
url="https://raw.githubusercontents.com/ros/rosdistro/master/melodic/distribution.yaml"

if url=="https://raw.githubusercontent.com/ros/rosdistro/master/noetic/distribution.yaml":
url="https://raw.githubusercontents.com/ros/rosdistro/master/noetic/distribution.yaml"

if url=="https://raw.githubusercontent.com/ros/rosdistro/master/rolling/distribution.yaml":
url="https://raw.githubusercontents.com/ros/rosdistro/master/rolling/distribution.yaml"