Ubuntu 16.04 LTS下安装配置ROS

参考博客:

Ubuntu更换下载源:https://blog.csdn.net/zl10086111/article/details/82917462

                                     https://blog.csdn.net/maizousidemao/article/details/79127695

ROS安装:https://www.cnblogs.com/liu-fa/p/5779206.html

                     https://blog.csdn.net/u013468614/article/details/102917569

目录

1准备工作

1.1检查Ubuntu版本与对应ROS版本

1.2检查Ubuntu下载安装配置

 1.3更换国内镜像源

2.开始安装

2.1添加源并确认下载库

2.2下载并安装ROS

3.ROS安装的收尾工作

3.1检查和更新

3.2初始化环境变量

3.3安装常用依赖项

4.测试ROS


1准备工作

1.1检查Ubuntu版本与对应ROS版本

对应Ubutnu版本

ROS Kinetic Kame

Ubuntu 16.04 (Xenial) / Ubuntu 15.10 (Wily)

ROS Jade Turtle

Ubuntu 15.04 (Wily) / Ubuntu LTS 14.04 (Trusty)

ROS Indigo Igloo

Ubuntu 14.04 (Trusty)

ROS Hydro Medusa

Ubuntu 12.04 LTS (Precise)

ROS Groovy Galapagos

Ubuntu 12.04 (Precise)

1.2检查Ubuntu下载安装配置

打开Ubuntu设置界面,中间三个需要打勾。

 1.3更换国内镜像源

首先,在终端键入:

sudo gedit /etc/apt/sources.list

在这里我们更换为清华镜像源https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/,用下列清华镜像源提供的地址逐条替换原文档里地址。(建议将原文档地址用#注释而不是直接删除)

另外,清华源默认注释掉了源码,也就是以deb-src为开头的每行代码,可以提高apt update速度,有需要的人自行取消注释。最后两行的预发布源可以不用。

#默认注释掉了源代码提高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

在这里给大家多提供几个高校和公司的源,据原博说有教育网和非教育的区别。

教育网:

浙江大学源:

deb http://mirrors.zjustu.org/ubuntu/ xenial main restricted universe multiverse 
  deb http://mirrors.zjustu.org/ubuntu/ xenial-backports restricted universe multiverse 
  deb http://mirrors.zjustu.org/ubuntu/ xenial-proposed main restricted universe multiverse 
  deb http://mirrors.zjustu.org/ubuntu/ xenial-security main restricted universe multiverse 
  deb http://mirrors.zjustu.org/ubuntu/ xenial-updates main restricted universe multiverse 
  deb-src http://mirrors.zjustu.org/ubuntu/ xenial main restricted universe multiverse 
  deb-src http://mirrors.zjustu.org/ubuntu/ xenial-backports main restricted universe multiverse 
  deb-src http://mirrors.zjustu.org/ubuntu/ xenial-proposed main restricted universe multiverse 
  deb-src http://mirrors.zjustu.org/ubuntu/ xenial-security main restricted universe multiverse 
 

中国科学技术大学源:

deb https://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb http://download.virtualbox.org/virtualbox/debian xenial contrib
 

非教育网:

阿里源:

deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse  
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse  
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse  
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse  
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse  
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse  
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse  
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse  
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse  
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse

网易源:

deb http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ xenial-backports main restricted universe multiverse

更换完源保存文件,然后在终端键入:

sudo apt-get update

或者键入:

sudo apt update

等待更新完成后即可。

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'

在终端中键入以下添加密钥:

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

在终端中键入以下更新下载列表:

sudo apt-get update

2.2下载并安装ROS

在终端中键入以下以安装完整版ROS-Kinetic,注意这里是和我Ubuntu系统对应的ROS版本:

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

经过一段时间的等待(其实还挺长?),完整豪华版ROS就安装完毕了。

3.ROS安装的收尾工作

3.1检查和更新

在终端下键入以下检查安装的包:

 apt-cache search ros-kinetic

键入以下进行依赖项安装初始化:

sudo rosdep init

在sudo rosdep init后出现如下内容后方可继续:

Wrote /etc/ros/rosdep/sources.list.d/20-default.list
Recommended: please run

	rosdep update

如果出错,参考如下:

可能出现的错误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.

解决办法:

创建文件夹:

sudo mkdir -p /etc/ros/rosdep/sources.list.d

定位到该目录:

 cd /etc/ros/rosdep/sources.list.d

建立文件:

sudo gedit 20-default.list

将文档输入如下内容:

# os-specific listings first
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx

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

并将所有raw.githubusercontent.com改为raw.github.com,得到如下最终文档:

# os-specific listings first
yaml https://raw.github.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx

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

保存并运行。

可能出现的错误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

解决办法:

键入删除命令后重新进行rosdep init

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

 

 

在排除sudo rosdep init错误之后,键入以下进行依赖项安装更新:

rosdep update

 如出现时延错误等,我在网上查到的办法是换成4G网……然后还真解决了。

3.2初始化环境变量

终端键入添加初始化环境变量:

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

终端键入使生效:

source ~/.bashrc

3.3安装常用依赖项

终端键入以下指令:

sudo apt-get install python-rosinstall

4.测试ROS

终端键入:

roscore

如果出现如下画面则安装成功:

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值