Ubuntu16.04安装ROS Kinetic

一、ROS介绍

ROS(Robot Operating System)机器人操作系统,是面向机器人的开源的元操作系统。ROS系统是起源于2007年斯坦福大学人工智能实验室的项目与机器人技术公司Willow Garage的个人机器人项目之间的合作,2008年之后就由WillowGarage来进行推动。2010年Willow Garage公司发布了开源机器人操作系统ROS(robot operating system),很快在机器人研究领域展开了学习和使用ROS的热潮。ROS主要特点是点对点设计、多语言支持、精简与集成、开源免费等。

二、ROS版本

ROS版本Ubuntu版本
ROS Melodic MoreniaUbuntu Artful(17.10)/Bionic(18.04 LTS)/Debian Stretch
ROS Kinetic KnameUbuntu 16.04(Xenial)/Ubuntu 15.10(Wily)
ROS Jade TurtleUbuntu 15.04(Wily)/Ubuntu LTS 14.04(Trusty)

三、安装ROS

  • 配置Ubuntu软件仓库
    这里用的是清华的镜像源:在这里插入图片描述
  • 设置sources.list
sudo sh -c 'echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
  • 设置密钥
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

在这里插入图片描述

  • 更新
sudo apt-get update

然后有一个错
在这里插入图片描述
就把/var/lib/apt/lists/lock删掉就可以了
在这里插入图片描述

  • 安装ROS
sudo apt-get install ros-kinetic-desktop-full
  • 初始化rosdep,并更新
sudo rosdep init
rosdep update

这里因为网络的原因,之中有问题,然后就参考了别人的博客,可以先把所需的压缩包下到本地,再进行更新就可以了。

unzip rosdistro-master.zip
mv rosdistro-master rosdistro
  • 修改20-dafault.list文件
sudo gedit /etc/ros/rosdep/sources.list.d/20-default.list

内容如下:

# os-specific listings first
yaml file:///home/xxx/rosdistro/rosdep/osx-homebrew.yaml osx

# generic
yaml file:///home/xxx/rosdistro/rosdep/base.yaml
yaml file:///home/xxx/rosdistro/rosdep/python.yaml
yaml file:///home/xxx/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/xxx/rosdistro/releases/fuerte.yaml fuerte

# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead

其中xxx为自己的用户名,本人是luy

  • 修改sources_list.py文件
sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/sources_list.py

注释掉DEFAULT_SOURCES_LIST_URL一行,再添加一行

DEFAULT_SOURCES_LIST_URL = 'file:///home/xxx/rosdistro/rosdep/sources.list.d/20-default.list'
  • 修改rep3.py文件
sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/rep3.py

注释掉REP3_TARGETS_URL一行,再添加一行

REP3_TARGETS_URL = 'file:///home/xxx/rosdistro/releases/targets.yaml'
  • 修改__init__.py
sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/__init__.py

注释掉DEFAULT_INDEX_URL一行,再添加一行

DEFAULT_INDEX_URL = 'file:///home/xxx/rosdistro/index-v4.yaml'
  • 再更新rosdep
    在这里插入图片描述
    这样就成功了
  • 配置环境
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc

在这里插入图片描述

  • 构建依赖
sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential

在这里插入图片描述

四、小海龟例子

  • 重新打开一个终端,使用roscore初始化ROS环境
roscore

会显示ROS的版本、一些节点、端号等信息
在这里插入图片描述

  • 再打开一个终端,输入如下指令,就会弹出一个小海龟窗口
rosrun turtlesim turtlesim_node

在这里插入图片描述

  • 再打开一个终端,输入如下指令就可以控制小海龟
rosrun turtlesim turtle_teleop_key

这时可以使用键盘的上下左右键来控制小海龟(需要选中最新打开的这个终端,按方向键才有效)
在这里插入图片描述

  • 再打开一个终端,输入如下指令可以查看ROS节点信息
rosrun rqt_graph rqt_graph

在这里插入图片描述

五、参考

1、ROS探索总结(一)——ROS简介
2、Ubuntu16.04安装ROS Kinetic详细步骤

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值