ROS 2 QoS Policy Selection for Reliable Distributed Robotics
When default QoS policies mask reliability gaps, new subscribers miss critical startup data; intentional QoS configuration restores expected behavior in distributed robotic systems.
22 Oct 2025, 16:10 UTC

The Problem: Silent QoS Defaults Cause Startup Data Gaps
When a new ROS 2 subscriber joins a publisher that has been running, the first few messages can be lost if the durability policy does not retain recent samples. This is not a hardware failure; it is a QoS configuration gap that appears only at integration time.
Useful Takeaway
Selecting the right ReliabilityPolicy (RELIABLE vs BEST_EFFORT) and DurabilityPolicy (TRANSIENT_LOCAL vs VOLATILE) for each publisher-subscriber pair prevents silent data loss and makes trust boundaries explicit.
Requirements for a Suitable QoS Design
Before adjusting QoS, clarify the system's data consistency and latency requirements. High-frequency sensor streams tolerate BEST_EFFORT with small history buffers. Critical control commands require RELIABLE reliability and TRANSIENT_LOCAL durability so no command is lost on restart.
Unfamiliar term: ReliabilityPolicy
ROS 2 maps ReliabilityPolicy directly to the DDS reliability setting. RELIABLE ensures every message is delivered or the connection is retried; BEST_EFFORT sends each message once and does not guarantee delivery.
Unfamiliar term: DurabilityPolicy
DurabilityPolicy controls whether published data remains available for late-joining subscribers. VOLATILE discards data as soon as it is sent. TRANSIENT_LOCAL retains the most recent sample for a limited time, allowing new subscribers to catch up.
Smallest Suitable Design
The minimal QoS profile that satisfies a given need is often a single-policy change from the default. For a temperature sensor publishing at 10 Hz where stale data is acceptable, keeping the default BEST_EFFORT and VOLATILE is sufficient. For a navigation command topic, replace reliability with RELIABLE and durability with TRANSIENT_LOCAL.
Unfamiliar term: HistoryPolicy
HistoryPolicy determines how many recent messages the system keeps in memory. KEEP_LAST retains the last N messages, limiting memory use. KEEP_ALL retains all messages until explicitly removed, increasing memory footprint and potentially worsening worst-case latency.
Trust and Data Boundaries
In a mixed ROS 1/ROS 2 network, QoS policy names and defaults differ. A ROS 2 publisher using RELIABLE reliability may map to a ROS 1 best-effort transport, causing the subscriber to miss messages. Explicit policy translation at the bridge is required.
Common QoS Profile Comparison
| Profile Name | Reliability | Durability | History | Typical Use Case |
|---|---|---|---|---|
| Sensor Stream | BEST_EFFORT | VOLATILE | KEEP_LAST(1) | High-frequency telemetry where lost samples are acceptable |
| Control Command | RELIABLE | TRANSIENT_LOCAL | KEEP_LAST(1) | Critical robot commands that must not be lost on restart |
| Diagnostic Stream | RELIABLE | VOLATILE | KEEP_LAST(10) | Error messages retained briefly, memory bounded |
Operational Checks
On a running ROS 2 network, verify the active QoS for any topic with:
ros2 topic info --qiThis command prints the reliability, durability, and history policies in effect. Compare the output against the intended profile. If the displayed policies differ, the publisher or subscriber is using a different QoS profile, often the default.
To validate reliability, publish a test message and count received instances:
ros2 topic pub /test/topic std_msgs/UInt32 data:42Run this on a node with the expected QoS. If messages are dropped intermittently, the reliability policy is BEST_EFFORT. If every message arrives, the policy is RELIABLE.
Required permissions: The user must have ROS 2 workspace sourced and appropriate network access to the DDS domain. Running the command without a sourced environment returns command not found.
Relevant risk: Changing QoS on a live system can temporarily disrupt communication if the new profile is incompatible with already-connected nodes. Always test on a dedicated topic before applying to critical streams.
Failure Modes and Conditions That Change the Design
- High-frequency sensor data (100+ Hz): BEST_EFFORT with KEEP_LAST(1) reduces latency and memory use. RELIABLE reliability may cause backpressure and dropped messages.
- Startup-critical commands (e.g., robot enable): RELIABLE reliability and TRANSIENT_LOCAL durability ensure the command persists across restarts.
- Bridging ROS 1 to ROS 2: Default QoS mismatches require a custom QoS profile that explicitly maps ROS 1 reliability/durability to ROS 2 equivalents.
- Limited memory on embedded hardware: KEEP_LAST(10) is preferable to KEEP_ALL, which can exhaust RAM.
- Incompatible DDS vendors: QoS XML elements vary across vendors; a profile valid for Fast-RTPS may not load on eProsima or other implementations.
Concrete Example: Configuring QoS via XML
Instead of programmatic QoS setting, many ROS 2 nodes load a QoS profile from an XML file. Below is a minimal profile that ensures RELIABLE reliability and TRANSIENT_LOCAL durability for a command topic:
RELIABLETRANSIENT_LOCALKEEP_LAST1To apply this profile, add the
--qos-overlayargument to theros2 runorros2 launchcommand, or set theROS_QOS_OVERLAYenvironment variable. Nodes that already have a subscriber on the same topic will receive the most recent sample once they join, thanks to TRANSIENT_LOCAL durability.Limitation: This XML profile must match the DDS vendor's expected syntax. Fast-RTPS, the default DDS implementation for ROS 2, accepts these elements, but other vendors may use different tags or attribute names.
Practical Verification Without Running the Example
Since the exact output of the commands cannot be guaranteed in every environment, a practical check is to inspect the XML profile referenced by the node and confirm that the intended elements appear. Use
ros2 interface describe | grep qosto list the loaded QoS library name, then verify the XML file path.Another check: run
ros2 topic list --verboseand look for a qos column if your ROS 2 version supports it. This shows the effective QoS profile name for each advertised topic.Summary
Intentional QoS policy selection turns silent defaults into explicit trust boundaries. By matching ReliabilityPolicy, DurabilityPolicy, and HistoryPolicy to the data's criticality and frequency, distributed robotic systems avoid startup gaps, reduce unnecessary retransmissions, and operate safely across ROS 1/ROS 2 bridges.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.