-
-
Notifications
You must be signed in to change notification settings - Fork 76
/
Copy pathREADME.md
268 lines (229 loc) · 8.37 KB
/
README.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# ROS 2 Bindings
This document defines how to describe ROS 2-specific information in AsyncAPI.
It applies to all [distributions of ROS 2](https://docs.ros.org/en/rolling/Releases.html).
<a name="version"></a>
## Version
Current version is `0.1.0`.
<a name="server"></a>
## Server Binding Object
This object contains information about the server representation in ROS 2.
ROS 2 can use either DDS or Zenoh as its middleware.
DDS is decentralized with no central server, so the field `host` can set to `none`.
For more information on DDS tuning, you can visit the [DDS Tuning Guide](https://docs.ros.org/en/rolling/How-To-Guides/DDS-tuning.html).
When using Zenoh, the `host` field specifies the Zenoh Router IP address.
###### Fixed Fields
Field Name | Type | Description
---|:---:|---|
`rmwImplementation` | string | Specifies the ROS 2 middleware implementation to be used. Valid values include the different [ROS 2 middleware vendors (RMW)](https://docs.ros.org/en/rolling/Concepts/Intermediate/About-Different-Middleware-Vendors.html) like `rmw_fastrtps_cpp` (Fast DDS) or `rmw_zenoh_cpp` (Zenoh). This determines the underlying middleware implementation that handles communication.
`domainId` | integer | All ROS 2 nodes use domain ID 0 by default. To prevent interference between different groups of computers running ROS 2 on the same network, a group can be set with a unique domain ID. [Must be a non-negative integer less than 232](https://docs.ros.org/en/rolling/Concepts/Intermediate/About-Domain-ID.html).
### Examples
```yaml
servers:
ros2:
host: none
protocol: ros2
protocolVersion: humble
bindings:
ros2:
rmwImplementation: rmw_fastrtps_cpp
domainId: 0
```
<a name="channel"></a>
## Channel Binding Object
This object MUST NOT contain any properties. Its name is reserved for future use.
<a name="operation"></a>
## Operation Binding Object
This object contains information about the ROS 2 node.
###### Fixed Fields
Field Name | Type | Description
---|:---:|---|
`role` | string | Specifies the ROS 2 type of the node for this operation. If the action is `send`, valid values for the role are: `publisher`, `action_client`, `service_client`. If the action is `receive`, valid values for the role are: `subscriber`, `action_server`, `service_server`. This defines how the node will interact with the associated topic, service or action.
`node` | string | The name of the ROS 2 node that implements this operation.
`qosPolicies` | [Quality of Service Policy Object](#QoSPolicyObject) | Quality of Service (QoS) for the topic.
<a name="QoSPolicyObject"></a>
### Quality of Service Object
This object contains ROS 2 specific information about the Quality of Service policies.
More information here: https://docs.ros.org/en/jazzy/Concepts/Intermediate/About-Quality-of-Service-Settings.html#qos-policies
Field Name | Type | Description
---|:---:|---|
`reliability` | string | One of `best_effort` or `reliable`. More information here: [ROS 2 QoS](https://docs.ros.org/en/jazzy/Concepts/Intermediate/About-Quality-of-Service-Settings.html#qos-policies)
`history` | string | One of `keep_last`, `keep_all` or `unknown`. More information here: [ROS 2 QoS](https://docs.ros.org/en/jazzy/Concepts/Intermediate/About-Quality-of-Service-Settings.html#qos-policies)
`durability` | string | One of `transient_local` or `volatile`. More information here: [ROS 2 QoS](https://docs.ros.org/en/jazzy/Concepts/Intermediate/About-Quality-of-Service-Settings.html#qos-policies)
`lifespan` | integer | The maximum amount of time between the publishing and the reception of a message without the message being considered stale or expired. `-1` means infinite.
`deadline` | integer | The expected maximum amount of time between subsequent messages being published to a topic. `-1` means infinite.
`liveliness` | string | One of `automatic` or `manual`. More information here: [ROS 2 QoS](https://docs.ros.org/en/jazzy/Concepts/Intermediate/About-Quality-of-Service-Settings.html#qos-policies)
`leaseDuration` | integer | The maximum period of time a publisher has to indicate that it is alive before the system considers it to have lost liveliness. `-1` means infinite.
### Examples
ROS 2 subscriber example:
```yaml
receiveCmdVel:
action: receive
channel:
$ref: "#/channels/CmdVel"
bindings:
ros2:
role: subscriber
node: /turtlesim
qosPolicies:
history: unknown
reliability: reliable
durability: volatile
lifespan: -1
deadline: -1
liveliness: automatic
leaseDuration: -1
```
ROS 2 publisher example:
```yaml
Pose:
action: receive
channel:
$ref: "#/channels/Pose"
bindings:
ros2:
role: publisher
node: /turtlesim
```
ROS 2 service server example:
```yaml
SetPen:
action: receive
channel:
$ref: "#/channels/SetPenRequest"
reply:
channel:
$ref: "#/channels/SetPenReply"
bindings:
ros2:
role: service_server
node: /turtlesim
```
ROS 2 service client example:
```yaml
SetPen:
action: send
channel:
$ref: "#/channels/SetPenRequest"
reply:
channel:
$ref: "#/channels/SetPenReply"
bindings:
ros2:
role: service_client
node: /node_client
```
ROS 2 action server example:
```yaml
receiveRotateAbsolute:
action: receive
channel:
$ref: "#/channels/RotateAbsoluteRequest"
reply:
channel:
$ref: "#/channels/RotateAbsoluteReply"
bindings:
ros2:
role: action_server
node: /turtlesim
```
ROS 2 action client example:
```yaml
RotateAbsolute:
action: send
channel:
$ref: "#/channels/RotateAbsoluteRequest"
reply:
channel:
$ref: "#/channels/RotateAbsoluteReply"
bindings:
ros2:
role: action_client
node: /teleop_turtle
```
<a name="message"></a>
## Message Binding Object
While this object DOES NOT contain any ROS 2 specific properties, it is important to understand how to express the different [ROS2 data types](https://design.ros2.org/articles/legacy_interface_definition.html#:~:text=to%20IDL%20types-,ROS%20type,string,-The%20mapping%20of) in [AsyncAPI message types and formats](https://www.asyncapi.com/docs/reference/specification/v3.0.0#dataTypeFormat:~:text=The%20formats%20defined%20by%20the%20AsyncAPI%20Specification%20are%3A).
ROS 2 Type | AsyncAPI Type | AsyncAPI Format |
---|:---:|---|
bool | boolean | boolean
byte | string | octet
char | integer | uint8
float32 | number | float
float64 | number | double
int8 | integer | int8
uint8 | integer | uint8
int16 | integer | int16
uint16 | integer | uint16
int32 | integer | int32
uint32 | integer | uint32
int64 | integer | int64
uint64 | integer | uint64
string | string | string
array | array | --
## Complete example:
From the AsyncAPI specification example it could be extracted that:
- It consist on a ROS2 jazzy application running with Fast DDS as RMW.
- `/turtlesim` node is a subscriber of the `/turtle1/cmd_vel` topic and its qos policies.
- The interface of the `/turtle1/cmd_vel` topic is `Twist` that has a nested type: `Vector3`
- `Vector3` has already the types converted to AsyncAPI types and formats (number and double), instead of using the ROS2 types.
```yaml
asyncapi: 3.0.0
info:
title: Head AsyncAPI definition
version: 1.0.0
servers:
ros2:
host: none
protocol: ros2
protocolVersion: jazzy
bindings:
x-ros2:
rmwImplementation: rmw_fastrtps_cpp
domainId: 0
channels:
Twist:
address: /turtle1/cmd_vel
messages:
Twist:
$ref: "#/components/messages/Twist"
operations:
Twist:
action: receive
channel:
$ref: "#/channels/Twist"
bindings:
x-ros2:
role: subscriber
node: /turtlesim
qosPolicies:
history: unknown
reliability: reliable
durability: volatile
lifespan: -1
deadline: -1
liveliness: automatic
leaseDuration: -1
components:
Twist:
tags:
- name: msg
payload:
type: object
properties:
linear:
$ref: "#/components/messages/Vector3/payload"
angular:
$ref: "#/components/messages/Vector3/payload"
Vector3:
payload:
properties:
x:
type: number
format: double
y:
type: number
format: double
z:
type: number
format: double
```