ROS(Robot Operating System) Tutorial 学习记录
编写: 王宇
2018-03-31
注: 此文档仅仅是我阅读时的流水账,也因为本人英语水平有限,仅凭个人的自我理解所编写,不可避免的存在错误和偏差,请以官方原文为准。
官方教程:http://wiki.ros.org/ROS/Tutorials
Beginner Level
1. 安装配置ROS环境
安装ROS
- 官方推荐 ROS Kinettic Kame http://wiki.ros.org/Distributions
- 安装步骤: http://wiki.ros.org/kinetic/Installation/Ubuntu
管理环境
- 概念 :notion of combining spaces using the shell environment
- 检查环境
-
$ printenv | grep ROS
- 安装命令
-
$ source /opt/ros/kinetic/setup.bash
创建ROS工作空间
- Build空间
-
$ mkdir -p ~/catkin_ws/src
-
$ cd ~/catkin_ws
-
$ catkin_make
- catkin : http://wiki.ros.org/catkin
- 设置
-
$ source devel/setup.bash
- 确认环境变量: $ROS_PACKAGE_PAHT
2. ROS文件系统
预备
- 安装教程预先准备的Package
-
$ sudo apt-get install ros-<distro>-ros-tutorials
Overview 文件系统概念
- Package : Package 组织ROS单元代码的抽象组织结构,每个Package能够包含库,可以执行文件,脚本和其他部分
- Manifests(package.xml) : Manifest是对Package的描述,它定义Package的依赖,明确Package的元数据,像版本,License等。
文件系统工具
- 使用 rospack - 得到Packages中的信息
-
$ rospack find [package_name]
- 使用 roscd - 更改目录
-
$ roscd [locationname [/subdir]]
- roscd log - 切换到日志目录
-
$ roscd log
- 使用 rosls - 查询目录
-
$ rosls [locationname [/subdir]]
Tab 补全
3.创建ROS Package
- Package 由什么组成的?
- package.xml 提供Package的元数据描述
- catkin使用的CMakeList.txt
- 每个Package必须有它自己的目录
- 在 catkin工作空间中的Package
-
- 创建catkin Package
-
$ cd ~/catkin_ws/src
$ catkin_create_pkg beginner_tutorials std_msgs rospy roscpp
- 编译和设置
$ cd ~/catkin_ws
$ catkin_make
$ . ~/catkin_ws/devel/setup.bash
- package 依赖
- 自定义你的Package
4. 编译ROS Package
编译 Packages
- 使用 catkin_make - 类似于cmake make工具
-
$ catkin_make --source my_src
$ catkon_make install --source my_src
- 构建你的Package
-
$ cd ~/catkin_ws/
$ ls src
beginner_turorials/CMakeLists.txt
$ catkin_make
5. 理解ROS Nodes节点
预备- 同ROS文件系统
Overview Graph 概念
- Node : 用ROS(roscore)协同其他node的可以执行体
- Message: 当使用subscribing和publishing topic时,被使用的数据类型
- Topics:subscribing和publishing 时的主题
- Master:ROS的服务名
- rosout:ROS的 stdout stderr
- roscore: Master + rosout + parameter server
Nodes
- ROS nodes 使用 ROS 客户端库与其他节点通讯。
- Nodes可以发布和订阅一个主题。Node
- Node能够提供和使用服务
客户端库
ROS客户端库允许nodes使用不同的程序语言编写,用于通讯,例如Python和C++
roscore
- 运行roscore
-
$ roscore
- 变更权限
-
$ sudo chown -R <your_username> ~/.ros
- 网络设置: http://wiki.ros.org/ROS/NetworkSetup#Single_machine_configuration
使用 rosnode
- 查询Node信息
-
$ rosnode list
从rosout中查看内容
- rosnode info 命令查看特定node信息
使用rosrun
$ rosrun [package_name] [node_name]
6. 理解ROS Topics主题
启动一个例子
- 启动 roscore
-
$ roscore
- 运行 turtlesim - turtlesim是package,turtlesim_node 和 turtle_turtle_teleop_key是 node
$ rosrun turtlesim turtlesim_node
- turtle键盘遥控
-
$ rosrun turtlesim turtle_teleop_key
ROS Topics
The turtlesim_node 和 turtle_teleop_key 节点使用各自的ROS Topic进行通讯。turtle_teleop_key是发布键盘消息的topic, turtlesim 订阅相同topic,去接受键盘消息。让我们使用rqt_graph(能够显示nodes和topics)去运行
- 使用 rqt_graph
rqt_graph在系统中,建立一个实时动态图像。rqt_graph是rqt package的一部分。
- 安装 rqt_graph
-
$ sudo apt-get install ros-<distro>-rqt
-
$ sudo apt-get install ros-<distro>-rqt-common-plugins
- rqt_graph的显示效果
- 介绍rostopic
-
$ rostopic -h
- 使用 Using rostopic echo
-
$ rostopic echo [topic]
- 使用 rostopic list
- rostopic list返回所有当前发布和订阅主题列表
-
$ rostopic list -h
ROS Message
在nodes之间,topics上凭借发送的ROS Message去通讯。因为发布和订阅通讯,它们必须发送接收相同类型的信息。这意味着,topic类型凭借message 类型发布被定义。
- 使用 rostopic type
-
$ rostopic type [topic]
rostopic continued
- 使用 rostopic pub
-
$ rostopic pub [topic] [msg_type] [args]
- 使用rostopic hz
-
$ rostopic hz [topic]
- 使用rqt_plot
相关推荐
Robot Operating System (ROS): The Complete Reference (Volume 4) Anis Koubaa This is the fourth volume of the successful series Robot Operating Systems: The Complete Reference, providing a ...
Robot Operating System (ROS) The Complete Reference (Volume 2) 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源...
机器人操作系统
Robot Operating System (ROS) for Absolute Beginners 2018
Building on the successful first and second volumes, this book is the third volume of the Springer book on the Robot Operating System (ROS): The Complete Reference. The Robot Operating System ...
Is the third volume of carefully edited chapters devoted to the Robot Operating System (ROS) with working examples, demonstrations and illustrations .Editors: Koubaa, Anis (Ed.)
ROS cookbook ,英文版!
ROS机器人操作系统参考手册第二部分,很不错的参考资料
Robot Operating System(ROS) The Complete Reference (Volume 1)
Operating System (ROS). In order to get started with ROS, there are some prerequisites to be satisfied. The prerequisites are to have a good understanding of Linux, especially Ubuntu; a good ...
Robot_Operating_System_for_Absolute_Beginners 针对初学者的ROS书籍,包括Ubuntu系统、Python、C++以及ROS的基础知识。
ROS By Example A Do It Yourself Guide to the Robot Operating System.pdf
Robot Operating System (ROS) The Complete Reference (Volume 1) 2016
Robot Operating System (ROS) The Complete Reference (Volume 2) 2017
ROSPlan: Planning in the Robot Operating System 英文原版论文ROS
ROS Robot Programming,包括ROS的产生、搭建、教学等一些列教学
这是一本学习ROS系统必不可少的书籍,这本书非常适合用来有往机器人控制方向发展的学者学习。
项目已移动! ROS 现在托管在 https://code.ros.org/gf/project/ros/