ROS 101
https://www.clearpathrobotics.com/blog/2014/01/how-to-guide-ros-101/
什么是ROS
ROS(robot operating system)是一个用于PC控制机器人组件的开源系统.一个ROS系统包含多个独立nodes,nodes直接通过pub/sub(发布/订阅)模式通信.比如传感器可以实现为一个传感器Node,传感器node采集数据,数据可以被其他node,比如导航node,路径查找node等等消费.
Why ROS
ROS的node不一定非得在一个computer上,甚至是不需要在同种结构的设备上.比如你可以用一个硬件设备采集数据,pub msg,在笔记本电脑上订阅这个msg,在手机上收取msg。这使得ROS具有高度灵活性.而且ROS是开源的.
基础概念
- ROS Master
- ROS Node
每一个node都要向master注册,master类似于消息中间件.node之间通过向master注册进行通信.node之间通过pub/sub模式通信.pub/sub 一个topic.类似于zmq里的pub/sub topic概念.
举个例子:
camera node负责和cmaera交互,image process node负责图片处理,image display node负责图片展示。在开始的时候,每一个node都要注册到master,
camera node注册的时候告诉master,他将要发布topic为image_data的消息,其余node注册的时候告诉master,想要订阅topic为image_data的数据.这样,当camera node收到来自camera采集的数据时,它就会发送image_data数据到image process node和image display node。
- Services
上面的例子中,process node是被动接收camera数据的,如果process node想要主动获取数据呢?
process node向master注册一个specific service。然后process node就可以向camera node发一个request,请求image_data,然后camera node控制camera采集数据,reply给process node。
http://wiki.ros.org/ROS/Concepts
Concepts
- Filesystem level
提供一些基础层面,硬件层面的操作 - Computation Graph level
- Community level
Filesystem level
- Packages: Packages are the main unit for organizing software in ROS. A package may contain ROS runtime processes (nodes), a ROS-dependent library, datasets, configuration files, or anything else that is usefully organized together. Packages are the most atomic build item and release item in ROS. Meaning that the most granular thing you can build and release is a package.
- Metapackages: Metapackages are specialized Packages which only serve to represent a group of related other packages. Most commonly metapackages are used as a backwards compatible place holder for converted rosbuild Stacks.
- Package Manifests: Manifests (package.xml) provide metadata about a package, including its name, version, description, license information, dependencies, and other meta information like exported packages. The package.xml package manifest is defined in REP-0127.
- Repositories: A collection of packages which share a common VCS system. Packages which share a VCS share the same version and can be released together using the catkin release automation tool bloom. Often these repositories will map to converted rosbuild Stacks. Repositories can also contain only one package.
- Message (msg) types: Message descriptions, stored in my_package/msg/MyMessageType.msg, define the data structures for messages sent in ROS.
- Service (srv) types: Service descriptions, stored in my_package/srv/MyServiceType.srv, define the request and response data structures for services in ROS.
Computation Graph level
Node
可以理解为一个程序.比如node1控制激光测距仪,node2控制车轮,nodes控制路径规划等等.Master
类似dsn。各个node都注册过来,提供查找lookup功能. node之间是直接通信的,并不经过master.Nodes connect to other nodes directly; the Master only provides lookup information, much like a DNS server. Nodes that subscribe to a topic will request connections from nodes that publish that topic, and will establish that connection over an agreed upon connection protocol. The most common protocol used in a ROS is called TCPROS, which uses standard TCP/IP sockets.
- Parameter Server
Messages
just a data structureNodes communicate with each other by passing messages. A message is simply a data structure, comprising typed fields. Standard primitive types (integer, floating point, boolean, etc.) are supported, as are arrays of primitive types. Messages can include arbitrarily nested structures and arrays (much like C structs).
Topics
pub/sub一个topic. 为了解耦,puber不需要知道有没有suber,puber只管produce这个topic的msg.suber不需要知道有没有puber,suber只管消费这个topic的msgMessages are routed via a transport system with publish / subscribe semantics. A node sends out a message by publishing it to a given topic. The topic is a name that is used to identify the content of the message. A node that is interested in a certain kind of data will subscribe to the appropriate topic. There may be multiple concurrent publishers and subscribers for a single topic, and a single node may publish and/or subscribe to multiple topics. In general, publishers and subscribers are not aware of each others' existence. The idea is to decouple the production of information from its consumption. Logically, one can think of a topic as a strongly typed message bus. Each bus has a name, and anyone can connect to the bus to send or receive messages as long as they are the right type.
- Services
通过service完成request/reply. pub/sub中消息的消费是被动的,一个Node想要主动去向另一个node要消息,就得通过service完成request/reply. Bags
Bags are a format for saving and playing back ROS message data. Bags are an important mechanism for storing data, such as sensor data, that can be difficult to collect but is necessary for developing and testing algorithms.
ROS Master在ROS计算图中扮演nameservice角色,存储topics和services注册信息.当注册信息改变,相应node就收到信息,类似zk里对某些node的watch机制.
names在ROS里作用巨大.
Names have a very important role in ROS: nodes, topics, services, and parameters all have names. Every ROS client library supports command-line remapping of names, which means a compiled program can be reconfigured at runtime to operate in a different Computation Graph topology.
比如,刚开始我们有个激光传感器node,在topic:scan上pub消息.相应的,suber在scan上消费消息. 后来我们想换个激光传感器,我们只需要重配置我们的系统.把names remap就行.比如新的激光传感器采集到的数据,我们定义一个新topic:scan_base,rename原来的scan->scan_base.我们再起一个激光传感器node,这个时候他就在scan_base上发消息了.
Names
Before we describe names further, here are some example names:
- / (the global namespace)
- /foo
- /stanford/robot/name
/wg/node1
每一个resource都define在一个namespace下,多个resources可能定义在同一个namespace下.resource可以在自己的namespace下create一个resource.resource可以访问自己的namespace下的resource或者更上层namespace下的resource.Graph Resource Names are an important mechanism in ROS for providing encapsulation. Each resource is defined within a namespace, which it may share with many other resources. In general, resources can create resources within their namespace and they can access resources within or above their own namespace
There are four types of Graph Resource Names in ROS: base, relative, global, and private, which have the following syntax:
- base
- relative/name
- /global/name
- ~private/name
解析规则如下
ROS 101的更多相关文章
- Learning Roadmap of Robotic Operating System (ROS)
ROS Wiki: http://wiki.ros.org/ Robots Using ROS Textbooks: A Gentle Introduction to ROS Learning ROS ...
- windows系统下安装和使用ROS的解决方案 (1 win_ros 2 rosserial_windows)
具体请参考官网: 1 http://wiki.ros.org/win_ros 2 https://github.com/ros-windows/win_ros 3 http://wiki.ros ...
- ROS机器人操作系统在线练习
废话不说,先看图吧: 1. ROS in 5 Days Entering ROS 2. ROS Navigation in 5 Days Mastering ROS 3. ROS Autonomous ...
- ROS(indigo) 安装和使用更新版本的Gazebo----3,4,5,6,7 附:中国机器人大赛中型组仿真比赛说明
ROS(indigo) 安装和使用更新版本的Gazebo,本文以7为例. Gazebo7支持更多新的功能,如果使用下面命令安装ROS(indigo): ~$ sudo apt-get install ...
- ROS(indigo) 用于机器人控制的图形化编程工具--code_it robot_blockly
0 简介: 编程语言有汇编,高级语言,解释语言等,现在图形化编程也越来越流行.图形化编程简单易学.8年前,微软推出了VPL用于机器人程序设计,如Python和JavaScript都可以用图形化框图实现 ...
- ROS常用三維機器人仿真工具Gazebo教程匯總
參考網址: 1. http://gazebosim.org/tutorials 2. http://gazebosim.org/tutorials/browse Gazebo Tutorials Ga ...
- ROS kinetic语音识别
1.安装依赖 1.1安装ros-kinetic-audio-common sudo apt-get install ros-kinetic-audio-common 1.2 安装libasound2 ...
- ROS下利用realsense采集RGBD图像合成点云
摘要:在ROS kinetic下,利用realsense D435深度相机采集校准的RGBD图片,合成点云,在rviz中查看点云,最后保存成pcd文件. 一. 各种bug 代码编译成功后,打开rviz ...
- Linux学习和ROS安装(1)
参考文档:https://www.cnblogs.com/liu-fa/p/5779206.html#undefined 系统环境:Window7 64bit+VMware11 ubuntu-gnom ...
随机推荐
- 请输入一个大于7的整数,输出小于k并且至少满足下面2个条件中的1个条件的所有正整数
import java.util.Scanner; /** * @author:(LiberHome) * @date:Created in 2019/3/6 22:06 * @description ...
- 2sat
之前做的两发 https://vjudge.net/problem/UVALive-3211 #include<cstdio> #include<cstring> #inclu ...
- Java 2018 面试
1.Java的引用有什么作用?传递的是什么? Java的引用可以用来操作对象,传递的是对象的地址 2.引用分为几种?他们的区别是什么?弱引用用在什么地方? 分四种:强引用 . 软引用 . 弱引用 . ...
- .NET Core跨平台的奥秘[中篇]:复用之殇
在<.NET Core跨平台的奥秘[上篇]:历史的枷锁>中我们谈到:由于.NET是建立在CLI这一标准的规范之上,所以它天生就具有了"跨平台"的基因.在微软发布了第一个 ...
- .NET Core多平台开发体验[4]: Docker
对于一个 .NET开发人员,你可能没有使用过Docker,但是你不可能没有听说过Docker.Docker是Github上最受欢迎的开源项目之一,它号称要成为所有云应用的基石,并把互联网升级到下一代. ...
- Nginx实现集群服务器的负载均衡
1.安装nginx和tomcat 我这里是使用docker安装的.安装流程可参照 dockerfile 这里安装了两个tomcat,端口分别是42000和42001.第二个tomcat的首页随便加了些 ...
- Python开发虚拟环境使用virtualenvwrapper的搭建及pycharm链接步骤
virtualenv 是一个创建隔绝的Python环境的工具.virtualenv创建一个包含所有必要的可执行文件的文件夹,用来使用Python工程所需的包.创建的环境是独立的,互不干扰,无需sudo ...
- Python学习笔记【Nginx】:Nginx使用与完全卸载
安装与启动nginx 第一步:通过指令安装包 sudo apt install nginx sudo apt install nginx 第二步:安装成功后查看相关配置文件 ls /etc/n ...
- Python数据挖掘指南
Data Mining in Python: A Guide 转载原文:https://www.springboard.com/blog/data-mining-python-tutorial/(全英 ...
- VSCode与Deepin资源管理器冲突
解决方式: xdg-mime default dde-file-manager.desktop inode/directory 此外,网上有较多推荐(在deepin 15.8版本上测试无效): gvf ...