Ubuntu16.04 安装ROS Kinetic 究级详细教程

1. “软件和更新”进行配置

1.1 Ubuntu Software

配置完成后就可以关闭该窗口了。
在这里插入图片描述

1.2 Other Software

首先,打开“System Settings”->点击“Software&updates”->点击“Other Softwares”->点击左下角“Add”按钮。
在APT行里输入:
deb http://ros.exbot.net/rospackage/ros/ubuntu/ xenial main
在这里插入图片描述

2. 添加源

2.1 通过终端添加

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

2.2 输入密钥

sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

注意:如果上述显示链接超时,可用下述方式

sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 0xB01FA116

或者:可以将上述链接改成:hkp://pgp.mit.edu:80或者hkp://keyserver.ubuntu.com:80。本实验尝试hkp://keyserver.ubuntu.com:80成功。
参考(作者:稻壳特筑)文章。

3.更新软件和包

3.1 更新软件列表

sudo apt-get update

3.2 更新已安装软件到最新版本

sudo apt-get upgrade

4.安装aptitude

参考(作者:稻壳特筑)文章。
好像不装也可以安装ROS成功,并使用。

sudo apt-get install aptitude

5 安装ROS kinetic完整版

注意:该版本对应于Ubuntu 16.04 (Xenial)

5.1 安装aptitude后可用下述代码安装

sudo aptitude install ros-kinetic-desktop-full

5.2 未安装aptitude的,可用下述代码安装

sudo apt-get install ros-kinetic-desktop-full

6 初始化rosdep

6.1 sudo rosdep init

sudo rosdep init

成功会显示:
在这里插入图片描述

6.1.1 出现问题1

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.
解决方法1:

sudo gedit /etc/hosts

在文件末尾添加

151.101.84.133 raw.githubusercontent.com

或者

199.232.28.133 raw.githubusercontent.com

注意:如果还不行,参考
rosdep init 错误解决方法
中间一步骤的raw.githubusercontent.com网站的ip查询可以参考百度经验,不过实在windows下整的,有点麻烦。怎么查询网站的IP地址

参考文献:

6.1.2 出现问题2

ERROR: default sources list file already exists:
/etc/ros/rosdep/sources.list.d/20-default.list
Please delete if you wish to re-initialize

解决方法:

sudo rm /etc/ros/rosdep/sources.list.d/20-default.list

6.2 rosdep update

rosdep update

成功会显示:
在这里插入图片描述

6.2.1 问题1

$ 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)
Hit https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
Add distro “ardent”
ERROR: error loading sources list:
<urlopen error <urlopen error [Errno 111] Connection refused> (https://raw.githubusercontent.com/ros/rosdistro/master/ardent/distribution.yaml)>

6.2.2 解决方法1

ubuntu安装ROS进行到rosdep update时出现错误

sudo gedit /etc/resolv.conf

将原有的nameserver这一行注释,并添加以下两行:

nameserver 8.8.8.8 #google域名服务器

nameserver 8.8.4.4 #google域名服务器

保存退出,执行

sudo  apt-get update

再执行

rosdep update

出想6.2 中成功的显示,就是成功了。
参考文献
如果问题还是没有解决,采用下述方法(尝试有效)

6.2.3 其他解决方法

(1)打开wifi连接手机热点(如果无法连接wifi,看下一步(2))
如果台式电脑无法完成,可以买个wifi接收器(擦汗),不是想打广告,不过给大家推荐个能在Ubuntu系统上使用的,我自己买的就是这个wifi接收器

(2)安装一个软件
打开链接下载:Ubuntu 14.04 64 bit
备用链接

(3)然后打开
在左上角的搜索您的计算机中,搜索

(4)执行

sudo apt-get update
sudo rosdep init
rosdep update

到这,我的是成功了,不然的话,在重复打开软件,连接之后,再试几次。感觉这个是上述解决不了的情况下最简单的。
要是还不行,还有个解决方案可以看一下,链接如下(我自己没有尝试过,仅供参考):
安装ROS, 初始化时rosdep update出错解决办法
ubuntu安装ROS进行到rosdep update时出现错误,如ERROR: unable to process source

7 添加ros环境变量

echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc

8 安装依赖

sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential

9 测试ROS是否安装成功

(1)CTRL+ALT+T打开终端(Termial),输入以下命令,初始化ROS环境:

roscore

(2)再打开一个新的终端(Termial),输入以下命令,弹出一个小乌龟窗口:

rosrun turtlesim turtlesim_node

(3)再打开一个新的终端(Termial),输入以下命令

rosrun turtlesim turtle_teleop_key

然后,通过方向键控制小乌龟的移动。
(4)打开新的终端,输入以下命令,可以查看ROS节点信息

rosrun rqt_graph rqt_graph

完结。。。
参考文献:
Ubuntu16.04安装ROS Kinetic详细过程
ubuntu16.04环境中ROS安装
Ubuntu18.04安装ROS Melodic
安装ROS, 初始化时rosdep update出错解决办法
ubuntu安装ROS进行到rosdep update时出现错误,如ERROR: unable to process source
rosdep init 错误解决方法

猜你喜欢

转载自blog.csdn.net/chen20170325/article/details/120853610
今日推荐