赞
踩
ROS安装的教程有很多,每一个版本基本都有,现在主要讲讲遇到的问题及解决办法。
你要是能成功的玩起这个王八,说明你的ROS应该是弄好了。我耗费了两天才安装好,基本上每一步都是一个坑。现在总结了一下自己的经历。
这一步是导入公钥。按照官网是这样的:http://wiki.ros.org/melodic/Installation/Ubuntu
实际上并没有成功。并且自己找的乱七八糟的导入也有点问题。最后用的这个命令,成功了。
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
总结一下,就是找个靠谱的教程,多导入几次,多尝试。
我觉得这就不错: ubuntu18.04 LTS安装ROS图文教程
第一个先看版本对不对:
sudo apt-get install ros-melodic-desktop-full
可能是你的版本搞错了。Ubuntu版本和ROS版本是需要对应的,不是随便搭配都可以的。你看,我的事Ubuntu18.04,安装的就是ros - melodic -xxx ,是啥版本就对应着换。
还有可能是源的问题,咱们把源换成清华的吧:
- cd /etc/apt/
-
- sudo cp sources.list sources.list.bk
-
- sudo gedit sources.list
修改sources.list的内容为下面的设置:
- # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
- deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
- # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
- deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
- # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
- deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
- # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
- deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
- # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
-
- # 预发布软件源,不建议启用
- # deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
- # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
更改完成之后更新一下:
sudo apt-get update
也可以尝试换成阿里云的,或者中科大的,或者换网试试,换个热点、网线本地连接等等。总之还是多试试,不要放弃。
这是阿里云的源,操作和上面一样,换完之后用sudo更新一下。
- # 阿里云源
- deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
- deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
- deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
- deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
- ##測試版源
- deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
- # 源碼
- deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
- deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
- deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
- deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
- ##測試版源
- deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
timeout的话可以修改时间,但是治标不治本。
类似下面的报错:
- ERROR: unable to process source [https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml]:
- <urlopen error [Errno 104] Connection reset by peer> (https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml)
- Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
- Hit 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 104] Connection reset by peer> (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 104] Connection reset by peer>
方案一:
- #打开hosts文件
- sudo gedit /etc/hosts
- #在文件末尾添加
- #raw.githubusercontent.com的地址一直有变化,具体的可以自己查一下
- 151.101.84.133 raw.githubusercontent.com
- #保存后退出再尝试
- rosdep update
方案二:我是用这个办法成功的
第一步:修改 sources_list.py 文件
sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/sources_list.py
添加代码:
url="https://ghproxy.com/"+url
第二步: 修改__init__.py文件中的DEFAULT_INDEX_URL
sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/__init__.py
替换原来的代码:
DEFAULT_INDEX_URL = 'https://ghproxy.com/https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'
第三步:修改其余(4个)文件中的地址,在地址 https://raw.githubusercontent.com/... 前添加https://ghproxy.com/
- sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py
- //修改第36行的地址
-
- sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/sources_list.py
- //修改第72行
-
- sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/rep3.py
- //修改第39行
-
- sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/manifest_provider/github.py
- //修改第68行、119行
gbpdistro_support.py文件中的修改:
sources_list.py文件中的修改:
rep3.py文件中的修改:
github.py文件中的修改:
第四步:修改gbpdistro_support.py文件
- sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/gbpdistro_support.py
- //在第204行添加如下代码(即在该函数块下的第一行处)
- gbpdistro_url = "https://ghproxy.com/" + gbpdistro_url
- //注意双引号是英文的,千万要主要,在这直接复制是没有问题的
最后,再次运行 rosdep update ,发现问题完美解决!(这样设置是可以解决问题的,如果不行,就是换网,换个网口有线连接,或者开个热点,用wifi,多试几次,相信到这部一定可以成功,其实这里的问题主要是因为网站被墙了,无法直接连接上,所以多了这些玄学问题)
- wood@wood:~$ echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
- wood@wood:~$ echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
- wood@wood:~$ source ~/.bashrc
- bash: /home/wood/catkin_ws/devel/setup.bash: 没有那个文件或目录
解决办法:
在终端输入:
gedit ~/.bashrc
然后它提示啥就注释掉啥
需要选中第三个打开的终端窗口,而不是鼠标点中小乌龟的窗口。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。