Skip to content

Commit 463fb3d

Browse files
author
Florian Gramß
committed
feat: update README with comments from the PR.
1. Include in the server binding links and change to none instead of localhost. 2. Include the link to the non-negative less than 232. 3. Explain better the message binding with links. 4. Put at the end a whole example of a ROS application with its explanation.
1 parent a1e9876 commit 463fb3d

File tree

1 file changed

+110
-21
lines changed

1 file changed

+110
-21
lines changed

Diff for: ros2/README.md

+110-21
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,23 @@ Current version is `0.1.0`.
1616

1717
This object contains information about the server representation in ROS 2.
1818
ROS 2 can use either DDS or Zenoh as its middleware.
19-
DDS is decentralized with no central server, so the field `host` can be set to `localhost`.
19+
DDS is decentralized with no central server, so the field `host` can set to `none`.
20+
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).
2021
When using Zenoh, the `host` field specifies the Zenoh Router IP address.
2122

2223
###### Fixed Fields
2324

2425
Field Name | Type | Description
2526
---|:---:|---|
26-
`rmwImplementation` | string | Specifies the ROS 2 middleware implementation to be used. Valid values include the different [ROS 2 middleware vendors](https://docs.ros.org/en/rolling/Concepts/Intermediate/About-Different-Middleware-Vendors.html). This determines the underlying middleware implementation that handles communication.
27-
`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.
27+
`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.
28+
`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).
2829

2930
### Examples
3031

3132
```yaml
3233
servers:
3334
ros2:
34-
host: localhost
35+
host: none
3536
protocol: ros2
3637
protocolVersion: humble
3738
bindings:
@@ -82,22 +83,22 @@ Field Name | Type | Description
8283
ROS 2 subscriber example:
8384

8485
```yaml
85-
receiveCmdVel:
86-
action: receive
87-
channel:
88-
$ref: "#/channels/CmdVel"
89-
bindings:
90-
ros2:
91-
role: subscriber
92-
node: /turtlesim
93-
qosPolicies:
94-
history: unknown
95-
reliability: reliable
96-
durability: volatile
97-
lifespan: -1
98-
deadline: -1
99-
liveliness: automatic
100-
leaseDuration: -1
86+
receiveCmdVel:
87+
action: receive
88+
channel:
89+
$ref: "#/channels/CmdVel"
90+
bindings:
91+
ros2:
92+
role: subscriber
93+
node: /turtlesim
94+
qosPolicies:
95+
history: unknown
96+
reliability: reliable
97+
durability: volatile
98+
lifespan: -1
99+
deadline: -1
100+
liveliness: automatic
101+
leaseDuration: -1
101102
```
102103

103104
ROS 2 publisher example:
@@ -176,4 +177,92 @@ RotateAbsolute:
176177

177178
## Message Binding Object
178179

179-
This object MUST NOT contain any properties. Its name is reserved for future use.
180+
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).
181+
182+
ROS 2 Type | AsyncAPI Type | AsyncAPI Format |
183+
---|:---:|---|
184+
bool | boolean | boolean
185+
byte | string | octet
186+
char | integer | uint8
187+
float32 | number | float
188+
float64 | number | double
189+
int8 | integer | int8
190+
uint8 | integer | uint8
191+
int16 | integer | int16
192+
uint16 | integer | uint16
193+
int32 | integer | int32
194+
uint32 | integer | uint32
195+
int64 | integer | int64
196+
uint64 | integer | uint64
197+
string | string | string
198+
array | array | --
199+
200+
201+
## Complete example:
202+
From the AsyncAPI specification example it could be extracted that:
203+
- It consist on a ROS2 jazzy application running with Fast DDS as RMW.
204+
- `/turtlesim` node is a subscriber of the `/turtle1/cmd_vel` topic and its qos policies.
205+
- The interface of the `/turtle1/cmd_vel` topic is `Twist` that has a nested type: `Vector3`
206+
- `Vector3` has already the types converted to AsyncAPI types and formats (number and double), instead of using the ROS2 types.
207+
208+
```yaml
209+
asyncapi: 3.0.0
210+
info:
211+
title: Head AsyncAPI definition
212+
version: 1.0.0
213+
servers:
214+
ros2:
215+
host: none
216+
protocol: ros2
217+
protocolVersion: jazzy
218+
bindings:
219+
x-ros2:
220+
rmwImplementation: rmw_fastrtps_cpp
221+
domainId: 0
222+
channels:
223+
Twist:
224+
address: /turtle1/cmd_vel
225+
messages:
226+
Twist:
227+
$ref: "#/components/messages/Twist"
228+
operations:
229+
Twist:
230+
action: receive
231+
channel:
232+
$ref: "#/channels/Twist"
233+
bindings:
234+
x-ros2:
235+
role: subscriber
236+
node: /turtlesim
237+
qosPolicies:
238+
history: unknown
239+
reliability: reliable
240+
durability: volatile
241+
lifespan: -1
242+
deadline: -1
243+
liveliness: automatic
244+
leaseDuration: -1
245+
components:
246+
Twist:
247+
tags:
248+
- name: msg
249+
payload:
250+
type: object
251+
properties:
252+
linear:
253+
$ref: "#/components/messages/Vector3/payload"
254+
angular:
255+
$ref: "#/components/messages/Vector3/payload"
256+
Vector3:
257+
payload:
258+
properties:
259+
x:
260+
type: number
261+
format: double
262+
y:
263+
type: number
264+
format: double
265+
z:
266+
type: number
267+
format: double
268+
```

0 commit comments

Comments
 (0)