ROS2编程基础课程--概念

网友投稿 694 2022-05-30

Concepts 概念

Overview of ROS 2 Concepts ROS 2概念概述

ROS 2 and different DDS/RTPS vendors ROS 2和不同的DDS / RTPS供应商

About Quality of Service Settings 关于服务质量设置

About ROS 2 Interfaces 关于ROS 2接口

About ROS2 client libraries 关于ROS2客户端库

Logging and logger configuration 日志记录和日志记录器配置

See also http://docs.ros2.org/ for ROS 2 high level documentation.

有关ROS 2高级文档,另请参考http://docs.ros2.org/。

Overview of ROS 2 Concepts

ROS 2概念综述

Table of Contents 目录

Quick Overview of Graph Concepts 图概念的快速概述

Nodes 节点

Client Libraries 客户端库

Discovery 消息发现机制

Example: talker-listener 示例:发布器-订阅器

ROS is a middleware based on an anonymous publish/subscribe mechanism that allows for message passing between different ROS processes.

ROS是一种基于匿名发布/订阅机制的中间件,允许在不同的ROS进程之间传递消息。

At the heart of any ROS 2 system is the ROS graph. The ROS graph refers to the network of nodes in a ROS system and the connections between them by which they communicate.

任何ROS 2系统的核心是ROS图。ROS图指的是ROS系统中的节点网络以及它们之间通信的连接。

ROS2 turtlesim Graph

Quick Overview of Graph Concepts

图概念的快速概述

Nodes: A node is an entity that uses ROS to communicate with other nodes.

节点:节点是使用ROS与其他节点通信的实体(或实例)。

Messages: ROS data type used when subscribing or publishing to a topic.

消息:订阅或发布到主题时ROS使用的数据类型。

Topics: Nodes can publish messages to a topic as well as subscribe to a topic to receive messages.

主题:节点可以将消息发布到主题,也可以订阅主题以接收消息。

Discovery: The automatic process through which nodes determine how to talk to each other.

发现:节点确定如何相互通信的自动过程。

Nodes 节点

A node is a participant in the ROS graph. ROS nodes use a ROS client library to communicate with other nodes. Nodes can publish or subscribe to a Topic. Nodes can also provide or use a Service. There are configurable Parameters associated with a node. Connections between nodes are established through a distributed discovery process. Nodes may be located in the same process, in different processes, or on different machines. These concepts will be described in more detail in the sections that follow.

节点是ROS图中的参与者。ROS节点使用ROS客户端库与其他节点通信。节点可以发布或订阅主题。节点还可以提供或使用服务。可以对节点相关联的参数进行配置。节点之间的连接是通过分布式发现过程建立的。节点可以位于相同的进程中,也可以位于不同的进程中,还可以位于不同的机器上。这些概念将在以下部分中更详细地介绍说明。

Client Libraries 客户端库

ROS client libraries allow nodes written in different programming languages to communicate. There is a core ROS client library (RCL) that implements common functionality needed for the ROS APIs of different languages. This makes it so that language-specific client libraries are easier to write and that they have more consistent behavior.

ROS客户端库支持不同编程语言编写的节点进行通信。一个核心的ROS客户端库(ROS client library, RCL)实现了不同语言ROS API所需的通用功能。这使得特定语言的客户端库更易于编写,并且它们具有更一致的行为。

The following client libraries are maintained by the ROS 2 team:

以下客户端库由ROS 2团队维护:

rclcpp = C++ client library

rclcpp = C ++客户端库

rclpy = Python client library

rclpy = Python客户端库

Additionally, other client libraries have been developed by the ROS community. See the ROS 2 Client Libraries article for more details.

此外,ROS社区还开发了其他客户端库。有关这方面内容的更多详细信息,请参考ROS 2客户端库文章。

Discovery 消息发现机制

Discovery of nodes happens automatically through the underlying middleware of ROS 2. It can be summarized as follows: 节点的发现通过ROS 2的底层中间件自动实现完成。可以总结如下:

When a node is started, it advertises its presence to other nodes on the network with the same ROS domain (set with the ROS_DOMAIN_ID environment variable). Nodes respond to this advertisement with information about themselves so that the appropriate connections can be made and the nodes can communicate.

启动节点时,它会将其存在通告给具有相同ROS域的网络上的其他节点(使用ROS_DOMAIN_ID环境变量 设置ROS域)。节点使用有关自身的信息响应此通告,以便可以进行适当的连接并且节点可以进行通信。

Nodes periodically advertise their presence so that connections can be made with new-found entities, even after the initial discovery period.

节点定期通告其存在,以便即使在初始发现期之后也可以与新发现的实体建立连接。

Nodes advertise to other nodes when they go offline.

节点在离线时通告其他节点。

Nodes will only establish connections with other nodes if they have compatible Quality of Service settings.

只有节点具有兼容的服务质量设置,它们之间才可以建立连接。

Example: talker-listener 例如:发布器-订阅器

In one terminal, start a node (written in C++) that will publish messages on a topic.

在一个终端中,启动将在主题上发布消息的节点(用C ++编写)。

ROS2编程基础课程--概念

ros2 run demo_nodes_cpp talker

In another terminal, start a second node (written in Python) that will subscribe to messages on the same topic.

在另一个终端中,启动第二个节点(用Python编写),该节点将订阅同一主题的消息。

ros2 run demo_nodes_py listener

You should see that these nodes discover each other automatically, and begin to exchange messages.

如果运行正常,应该看到这些节点自动发现彼此,并开始交换消息。

多试几组案例,熟练掌握ros2 run和rqt的基本使用。

任务调度

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:❤️【Android精进之路-04】Android核心组件Activity,必须掌握的知识点(Activity是什么,生命周期是
下一篇:few-shot在关系抽取中的应用
相关文章