excel表格vba编程的方法步骤(excel vba编程基础知识)
751
2022-05-29
About ROS2 client libraries
关于ROS2客户端库
Table of Contents 目录
Overview 概述
Supported client libraries 支持的客户端库
Common functionality: the RCL 常用功能:RCL
Language-specific functionality 特定的语言功能
Demo 演示案例
Comparison to ROS 1 与ROS1的比较
Summary 总结
Overview 概述
Client libraries are the APIs that allow users to implement their ROS code. They are what users use to get access to ROS concepts such as nodes, topics, services, etc. Client libraries come in a variety of programming languages so that users may write ROS code in the language that is best-suited for their application. For example, you might prefer to write visualization tools in Python because it makes prototyping iterations faster, while for parts of your system that are concerned with efficiency, the nodes might be better implemented in C++.
客户端库是允许用户实现其ROS代码的API。它们是用户用来访问ROS概念(如节点、主题、服务等)的内容。客户端库有各种编程语言,因此用户可以使用最适合其应用程序的语言编写ROS代码。例如,可能更喜欢在Python中编写可视化工具,因为它可以更快地进行原型设计迭代,而对于系统中与效率相关的部分,可以在C ++中更好地实现节点。
Nodes written using different client libraries are able to share messages with each other because all client libraries implement code generators that provide users with the capability to interact with ROS interface files in the respective language.
使用不同客户端库编写的节点能够彼此共享消息,因为所有客户端库都实现了代码生成器,这些代码生成器为用户提供了与相应语言的ROS接口文件交互的能力。
In addition to the language-specific communication tools, client libraries expose to users the core functionality that makes ROS “ROS”. For example, here is a list of functionality that can typically be accessed through a client library:
除了特定于语言的通信工具之外,客户端库还向用户展示了使ROS成为“ROS”的核心功能。例如,以下是通常可以通过客户端库访问的功能列表:
Names and namespaces 命名和命名空间
Time (real or simulated) 时间(真实或模拟)
Parameters 参数
Console logging 控制台记录
Threading model 线程模型
Intra-process communication 进程内通信
Supported client libraries 支持的客户端库
The C++ client library (rclcpp) and the Python client library (rclpy) are both client libraries which utilize common functionality in the RCL.
C ++客户端库(rclcpp)和Python客户端库(rclpy)都是RCL中常见功能的客户端库。
While the C++ and Python client libraries are maintained by the core ROS 2 team, members of the ROS 2 community have created additional client libraries:
虽然C ++和Python客户端库由核心ROS 2团队维护,但ROS 2社区的成员已创建了其他客户端库:
JVM and Android
Objective C and iOS
C#
Swift
Node.js
Ada
_.NET Core, UWP and C#
Common functionality: the RCL 常用功能:RCL
Most of the functionality found in a client library is not specific to the programming language of the client library. For example, the behavior of parameters and the logic of namespaces should ideally be the same across all programming languages. Because of this, rather than implementing the common functionality from scratch, client libraries make use of a common core ROS Client Library (RCL) interface that implements logic and behavior of ROS concepts that is not language-specific. As a result, client libraries only need to wrap the common functionality in the RCL with foreign function interfaces. This keeps client libraries thinner and easier to develop. For this reason the common RCL functionality is exposed with C interfaces as the C language is typically the easiest language for client libraries to wrap.
客户端库中的大多数功能并非特定于客户端库的编程语言。例如,参数的行为和命名空间的逻辑在理想情况下应该在所有编程语言中都是相同的。因此,客户端库不是从头开始实现通用功能,而是使用通用核心ROS客户端库(RCL)接口,该接口实现非特定语言的ROS概念的逻辑和行为。因此,客户端库只需要使用外部函数接口封装RCL中的公共功能。这使客户端库更透明(薄),更容易开发。因此,C语言通常是用于客户端库封装的最简单的语言,因此公共RCL功能通过C接口公开。
In addition to making the client libraries light-weight, an advantage of having the common core is that the behavior between languages is more consistent. If any changes are made to the logic/behavior of the functionality in the core RCL – namespaces, for example – all client libraries that use the RCL will have these changes reflected. Furthermore, having the common core means that maintaining multiple client libraries becomes less work when it comes to bug fixes.
除了使客户端库轻量化之外,拥有共同核心的一个优点是语言之间的行为更加一致。如果对核心RCL中的功能的逻辑/行为进行任何更改-例如,命名空间-所有使用RCL的客户端库都会反映这些更改。此外,拥有通用核心意味着在修复错误时,维护多个客户端库的工作量会减少。
The API documentation for the RCL can be found here. 可以在此处找到RCL的API文档。
Language-specific functionality 语言特定功能
Client library concepts that require language-specific features/properties are not implemented in the RCL but instead are implemented in each client library. For example, threading models used by “spin” functions will have implementations that are specific to the language of the client library.
需要特定于语言的功能/属性的客户端库概念未在RCL中实现,而是在每个客户端库中实现。例如,“spin”函数使用的线程模型将具有特定于客户端库的语言的实现。
Demo 演示实例
For a walkthrough of the message exchange between a publisher using rclpy and a subscriber using rclcpp, we encourage you to watch this ROSCon talk starting at 17:25 (here are the slides).
有关发布器使用rclpy和订阅器使用之间的消息交换的演练rclcpp,我们建议您从17:25开始观看此ROSCon演讲(这是幻灯片讲稿)。
Comparison to ROS 1 与ROS 1的比较
In ROS 1, all client libraries are developed “from the ground up”. This allows for the ROS 1 Python client library to be implemented purely in Python, for example, which brings benefits of such as not needing to compile code. However, naming conventions and behaviors are not always consistent between client libraries, bug fixes have to be done in multiple places, and there is a lot of functionality that has only ever been implemented in one client library (e.g. UDPROS).
在ROS 1中,所有客户端库都是“从头开始”开发的。例如,这允许ROS 1 Python客户端库纯粹用Python实现,这带来了诸如不需要编译代码等好处。但是,命名约定和行为在客户端库之间并不总是一致的,错误修复必须在多个位置完成,并且有许多功能只在一个客户端库(例如UDPROS)中实现。
Summary 摘要
By utilizing the common core ROS client library, client libraries written in a variety of programming languages are easier to write and have more consistent behavior.
通过使用通用核心ROS客户端库,使各种编程语言编写的客户端库更易于编写并具有更一致的行为。
Python
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。