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 structure

    Nodes 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的msg

    Messages 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的更多相关文章

  1. Learning Roadmap of Robotic Operating System (ROS)

    ROS Wiki: http://wiki.ros.org/ Robots Using ROS Textbooks: A Gentle Introduction to ROS Learning ROS ...

  2. 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 ...

  3. ROS机器人操作系统在线练习

    废话不说,先看图吧: 1. ROS in 5 Days Entering ROS 2. ROS Navigation in 5 Days Mastering ROS 3. ROS Autonomous ...

  4. ROS(indigo) 安装和使用更新版本的Gazebo----3,4,5,6,7 附:中国机器人大赛中型组仿真比赛说明

    ROS(indigo) 安装和使用更新版本的Gazebo,本文以7为例. Gazebo7支持更多新的功能,如果使用下面命令安装ROS(indigo): ~$ sudo apt-get install ...

  5. ROS(indigo) 用于机器人控制的图形化编程工具--code_it robot_blockly

    0 简介: 编程语言有汇编,高级语言,解释语言等,现在图形化编程也越来越流行.图形化编程简单易学.8年前,微软推出了VPL用于机器人程序设计,如Python和JavaScript都可以用图形化框图实现 ...

  6. ROS常用三維機器人仿真工具Gazebo教程匯總

    參考網址: 1. http://gazebosim.org/tutorials 2. http://gazebosim.org/tutorials/browse Gazebo Tutorials Ga ...

  7. ROS kinetic语音识别

    1.安装依赖 1.1安装ros-kinetic-audio-common sudo apt-get install ros-kinetic-audio-common 1.2 安装libasound2 ...

  8. ROS下利用realsense采集RGBD图像合成点云

    摘要:在ROS kinetic下,利用realsense D435深度相机采集校准的RGBD图片,合成点云,在rviz中查看点云,最后保存成pcd文件. 一. 各种bug 代码编译成功后,打开rviz ...

  9. Linux学习和ROS安装(1)

    参考文档:https://www.cnblogs.com/liu-fa/p/5779206.html#undefined 系统环境:Window7 64bit+VMware11 ubuntu-gnom ...

随机推荐

  1. Vue(二十八)el-cascader 动态加载 - 省市区组件

    1.后台接口为点击加载下一级 ,传省市区id <template> <el-cascader v-model="selectedOptions" placehol ...

  2. React(九)create-react-app创建项目 + 按需加载Ant Design

    (1)create-react-app如何创建项目我前面第一章介绍过了,这里就不过多写了, (2)我们主要来说说按需加载的问题 1. 引入antd npm install antd --save 2. ...

  3. vs2010 sp1 安装Silverlight5 语言版本不匹配的问题

    好久之前用silverlight写了个程序,今天心血来潮想给朋友看一下,朋友更新了sl5,但是运行不起来. 所以有点郁闷,于是打算更新项目到silverlight5. 装sp1后,下载silverli ...

  4. HTTP Status 500 - Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

    今天整合ssm框架 时 遇到的问题 困扰我好长时间     原因就是  mapper文件 没有被加载进来 但是 为什么没有被加载进来呢  因为中间的配置文件出了一些问题 网上大多数说法是   在pom ...

  5. Hadoop集群搭建过程中ssh免密码登录(二)

    一.为什么设置ssh免密码登录 在集群中,Hadoop控制脚本依赖SSH来执行针对整个集群的操作.例如,某个脚本能够终止并重启集群中的所有守护进程.所以,需要安装SSH,但是,SSH远程登陆的时候,需 ...

  6. 【安富莱】【RL-TCPnet网络教程】第8章 RL-TCPnet网络协议栈移植(RTX)

    第8章        RL-TCPnet网络协议栈移植(RTX) 本章教程为大家讲解RL-TCPnet网络协议栈的RTX操作系统移植方式,学习了第6章讲解的底层驱动接口函数之后,移植就比较容易了,主要 ...

  7. git克隆项目出现remote: HTTP Basic: Access denied

    换新电脑,重新装了git,从gitlab上面拉公司项目,出现了remote: HTTP Basic: Access denied错误,说验证失败,百度很多说了很多答案,最后试了这种可以,成功拉下来项目 ...

  8. [Swift]LeetCode856. 括号的分数 | Score of Parentheses

    Given a balanced parentheses string S, compute the score of the string based on the following rule: ...

  9. 一个简单IP防刷工具类, x秒内最多允许y次单ip操作

    IP防刷,也就是在短时间内有大量相同ip的请求,可能是恶意的,也可能是超出业务范围的.总之,我们需要杜绝短时间内大量请求的问题,怎么处理? 其实这个问题,真的是太常见和太简单了,但是真正来做的时候,可 ...

  10. Maven项目执行java入口main方法

    在Maven项目中配置pom.xml文件加载maven-surefire-plugin插件来执行testng.xml,相信大家对此种用法已经非常熟悉了.但是有些场景可能需要我们去加载执行java的ma ...