Ubuntu16.04安装ros

准备

1、ubuntu16.04 64位桌面版

ps:关于系统的下载和安装这里不做介绍,请自行百度,不是介绍重点

2、更改源
我使用的是清华源
Ubuntu16.04安装ros_第1张图片

开始安装

~$ sudo apt-get update

~$ sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME 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

~$ sudo apt-get install ros-kinetic-desktop-full
这里会出现一个问题,sudo apt-get update由于没有公钥,无法验证下列签名: NO_PUBKEY F42ED6FBAB17C654
sudo apt-get update由于没有公钥,无法验证下列签名: NO_PUBKEY F42ED6FBAB17C654

可以这样解决,安装公钥

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654

安装完以后

$ sudo rosdep init
$ rosdep update

这时候会出现一个错误,很烦人的错误。

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 rosdep init ERROR: cannot download default sources list from:
    采用这位老兄的终极方案:
#打开hosts文件
sudo gedit /etc/hosts
#在文件末尾添加
151.101.84.133  raw.githubusercontent.com
#保存后退出再尝试

结果

s@s:/etc/ros/rosdep/sources.list.d$ sudo  apt-get update
命中:1 http://mirrors.ustc.edu.cn/ubuntu xenial InRelease
命中:2 http://mirrors.ustc.edu.cn/ros/ubuntu xenial InRelease                  
命中:3 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu xenial InRelease   
命中:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial InRelease
获取:5 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates InRelease [109 kB]
获取:6 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-backports InRelease [107 kB]
获取:7 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security InRelease [109 kB]
获取:8 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates/main amd64 DEP-11 Metadata [322 kB]
获取:9 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates/universe amd64 DEP-11 Metadata [276 kB]
获取:10 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-updates/multiverse amd64 DEP-11 Metadata [5,980 B]
获取:11 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-backports/main amd64 DEP-11 Metadata [3,328 B]
获取:12 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-backports/universe amd64 DEP-11 Metadata [5,320 B]
获取:13 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security/main amd64 DEP-11 Metadata [74.8 kB]
获取:14 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security/universe amd64 DEP-11 Metadata [124 kB]
获取:15 https://mirrors.tuna.tsinghua.edu.cn/ubuntu xenial-security/multiverse amd64 DEP-11 Metadata [2,464 B]
已下载 1,139 kB,耗时 2秒 (416 kB/s)           
正在读取软件包列表... 完成
s@s:/etc/ros/rosdep/sources.list.d$ 
s@s:/etc/ros/rosdep/sources.list.d$ rosdep update
reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit 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
Hit 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
Skip end-of-life distro "ardent"
Skip end-of-life distro "bouncy"
Skip end-of-life distro "crystal"
Add distro "dashing"
Add distro "eloquent"
Add distro "foxy"
Skip end-of-life distro "groovy"
Skip end-of-life distro "hydro"
Skip end-of-life distro "indigo"
Skip end-of-life distro "jade"
Add distro "kinetic"
Skip end-of-life distro "lunar"
Add distro "melodic"
Add distro "noetic"
updated cache in /home/s/.ros/rosdep/sources.cache

配置环境

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

安装building package的依赖

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

测试

roscore

rosrun turtlesim turtlesim_node

rosrun turtlesim turtle_teleop_key

Ref

https://blog.csdn.net/softimite_zifeng/article/details/78632211

你可能感兴趣的:(ubuntu,ros,ubuntu)