ROS 2 Protocol Bindings
The ROS 2 (Robot Operating System 2) protocol bindings for AsyncAPI enable seamless integration between ROS 2 robotics systems and event-driven architectures. These bindings provide comprehensive configuration options for ROS 2 nodes, Quality of Service (QoS) policies, and middleware implementations.
Overview
Section titled “Overview”ROS 2 is a set of software libraries and tools for building robot applications. It provides a flexible framework for writing robot software with support for multiple programming languages, real-time systems, and distributed computing. The ROS 2 bindings in AsyncAPI allow you to:
- Configure ROS 2 nodes and their roles (publisher, subscriber, service, action)
- Define Quality of Service (QoS) policies for reliable communication
- Specify middleware implementations (FastRTPS, CycloneDDS, etc.)
- Set up domain IDs for network isolation
- Integrate robotics systems with event-driven architectures
Key Features
Section titled “Key Features”Node Configuration
Section titled “Node Configuration”- Publisher/Subscriber: Configure publish-subscribe communication patterns
- Service Client/Server: Set up request-response service patterns
- Action Client/Server: Configure long-running action patterns
- Node Identification: Specify ROS 2 node names and roles
Quality of Service (QoS) Policies
Section titled “Quality of Service (QoS) Policies”- Reliability: Choose between
best_effortandreliabledelivery - Durability: Configure
volatileortransient_localmessage persistence - History: Set queue depth with
keep_last,keep_all, orunknown - Deadline: Define maximum time between messages
- Lifespan: Set message expiration time
- Liveliness: Configure automatic or manual liveliness monitoring
- Lease Duration: Set publisher liveliness timeout
Middleware Support
Section titled “Middleware Support”- FastRTPS: Default DDS implementation
- CycloneDDS: Alternative DDS implementation
- OpenDDS: Additional DDS option
- Custom Implementations: Support for other RMW implementations
Use Cases
Section titled “Use Cases”Robotics Applications
Section titled “Robotics Applications”- Sensor Data Streaming: Configure publishers for sensor data (camera, lidar, IMU)
- Command Processing: Set up subscribers for robot control commands
- Service Integration: Define service clients/servers for parameter management
- Action Coordination: Configure action clients/servers for complex behaviors
System Integration
Section titled “System Integration”- Multi-Robot Systems: Use domain IDs to isolate different robot groups
- Real-time Communication: Configure QoS policies for time-sensitive data
- Reliable Messaging: Ensure critical messages are delivered reliably
- Network Optimization: Tune middleware settings for performance
Getting Started
Section titled “Getting Started”- Choose Your Version: Select the appropriate ROS 2 binding version
- Configure Nodes: Define your ROS 2 nodes and their roles
- Set QoS Policies: Configure quality of service for your use case
- Specify Middleware: Choose your preferred RMW implementation
- Test Integration: Validate your configuration with ROS 2 tools
Examples
Section titled “Examples”Basic Publisher Configuration
Section titled “Basic Publisher Configuration”channels: sensorData: publish: bindings: ros2: bindingVersion: "0.1.0" node: "/sensor_node" role: "publisher" qosPolicies: reliability: "reliable" durability: "volatile" history: "keep_last"Service Server Setup
Section titled “Service Server Setup”channels: parameterService: subscribe: bindings: ros2: bindingVersion: "0.1.0" node: "/parameter_server" role: "service_server" qosPolicies: reliability: "reliable" durability: "transient_local"Related Documentation
Section titled “Related Documentation”Community and Support
Section titled “Community and Support”- ROS 2 Community: Join the ROS 2 community for robotics discussions
- AsyncAPI Community: Connect with AsyncAPI users and contributors
- Documentation Issues: Report documentation issues or improvements
- Feature Requests: Suggest new binding features or improvements
Versions and changes
Generated from the binding JSON Schemas: every field each version added or removed.
| Version | What changed | Pages |
|---|---|---|
| 0.1.0latest | First version: server binding, operation binding. | server, channel, operation, message |
Fields in version 0.1.0
Server binding
| Field | Type | Description |
|---|---|---|
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 |
rmwImplementation | string | Specifies the ROS 2 middleware implementation to be used. This determines the underlying middleware implementation that handles communication |
Server binding 0.1.0: examples and details
Operation binding
| Field | Type | Description |
|---|---|---|
noderequired | string | The name of the ROS 2 node that implements this operation |
qosPolicies | object | |
qosPolicies.deadline | integer | The expected maximum amount of time between subsequent messages being published to a topic. -1 means infinite |
qosPolicies.durability | stringtransient_localvolatile | Persistence specification that determines message availability for late-joining subscribers |
qosPolicies.history | stringkeep_lastkeep_allunknown | Policy parameter that defines the maximum number of samples maintained in the middleware queue |
qosPolicies.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 |
qosPolicies.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 |
qosPolicies.liveliness | stringautomaticmanual | Defines the mechanism by which the system monitors and determines the operational status of communication entities within the network |
qosPolicies.reliability | stringbest_effortreliable | Specifies the communication guarantee model that determines whether message delivery confirmation between publisher and subscriber is required |
rolerequired | stringpublisheraction_clientservice_clientsubscriberaction_serverservice_server | Specifies the ROS 2 type of the node for this operation |
Operation binding 0.1.0: examples and details
Validate with JSON Schema
Point your editor, CI or AI agent at these schemas to validate the ROS 2 bindings of version 0.1.0. They come from the AsyncAPI JSON Schema registry.
- Server binding:
https://schemas.asyncapi.pavelon.dev/draft-07/bindings/ros2/0.1.0/server - Channel binding:
https://schemas.asyncapi.pavelon.dev/draft-07/bindings/ros2/0.1.0/channel - Operation binding:
https://schemas.asyncapi.pavelon.dev/draft-07/bindings/ros2/0.1.0/operation - Message binding:
https://schemas.asyncapi.pavelon.dev/draft-07/bindings/ros2/0.1.0/message
Questions
How do I describe a ROS 2 publisher or subscriber in AsyncAPI?
With the ROS 2 operation binding: role, node and qosPolicies (reliability, history, durability, lifespan, deadline, liveliness). The server binding sets rmwImplementation and domainId.