# ubuntu 16.04 安装ros-kinetic 版本

ubuntu 16.04 安装ros-kinetic 版本

最近因工作需要安装ros 选择了ubuntu16.04版本的,在安装的过程中遇到了一些问题,最终解决问题,安装成功分享给大家一下过程
第一步:
在ubuntu系统 打开 系统设置->软件与更新->Ubuntu软件 中把下载自:改成清华大学提供的镜像(其他的镜像也行)
这是为了保证安装速度,选择国内的镜像
国内有很多镜像源,这里选用清华大学开源软件镜像站: https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/.
# ubuntu 16.04 安装ros-kinetic 版本_第1张图片第二步:
在ubuntu系统 打开 系统设置->软件与更新->其他软件->添加

deb https://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ xenial main

或者按照https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/.在其中找到ros选择相应的版本把他粘贴复制到# ubuntu 16.04 安装ros-kinetic 版本_第2张图片以上两步是加快下载速度,否则下载太慢容易崩溃。

第三步:
打开终端输入ROS的GPG Key,并更新索引

sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt-get update && sudo apt-get upgrade -y

这是在设置公钥并且及时更新一下你的镜像源

第四步
做完以上三步就可以轻松加愉快的下载ros了我下载的是ros-kinetic-desktop-full(建议下载这个)

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

如果想安装其他ROS功能包,可以使用apt-cache命令搜索ros-kinetic开头的所有功能包。

$ apt-cache search ros-kinetic

如果想安装个别功能包,就试一试如下命令

$ sudo apt-get install ros-kinetic-[功能包名称]

下载需要一定时间请耐心等待

第五步:
终端输入

$ sudo rosdep init
$ rosdep update

有可能会出现
ubuntu16.04 运行rosdep init 返回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.

这是因为此时可能是因为raw.githubusercontent.com网站被隔在墙外了。
解决这个问题的方法有三种
一、需要架个梯子出去就行了,电脑VPN架个梯,手机VPN架个梯子后开热点。
二、更改跳跃网站

#打开hosts文件
sudo gedit /etc/hosts
#在文件末尾添加
151.101.84.133  raw.githubusercontent.com
#保存后退出再尝试

三、参考此博主的办法
sudo rosdep init 出现 ERROR: cannot download default sources list from:.
以上三种方法,一三比较好,二也可以试一试

如果出现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

然后就可以继续

sudo rosdep init

第六步:
安装rosinstall工具

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

以下是建议可用可不用,就是随便的意思
建议使用

sudo aptitude install python-rosintallpython-rosinstall-generator python-wstool build-essential

因为aptitude能自动补全相关的需要的依赖、链接库等

安装aptitude

sudo apt-get install aptitude

第七步:
环境配置

echo ''source /opt/ros/kinetic/setup.bash'' >> ~/.bashrc
source ~/.bashrc

这是把电脑中ros中的位置添加到bash中,好可以通过终端直接启动ros,这步很重要不能忽略。

第八步
打开另一个终端输入

roscore

再打开另一个终端

rosrun turtlesim turtlesim_node

至此ubuntu安装ros就已经圆满完成。也不枉我一步一步试错的纠结。
参考文档:sudo rosdep init 出现 ERROR: cannot download default sources list from:
参考文档:rosdep init 或者rosdep update 连接错误的解决办法

你可能感兴趣的:(ros)