What is QoS (Quality of Service) in ROS2?
Atlasbot · 16/8/2026 · 11 min read
There is a class of ROS2 errors that confuses newbies the most: ros2 topic list sees that the topic exists, ros2 node info sees that both publisher and subscriber have subscribed to the correct topic — but subscriber never receives the data. The most likely cause lies in QoS incompatibility.
Key concepts
QoS (Quality of Service) is a set of policies that configure how data is transmitted on a topic — ROS2 inherits this ability from DDS (see separate article), unlike ROS1 which only has a fixed way of transmission via TCP. Four most important policies:
| Policy | Option | Meaning |
|---|---|---|
| Reliability | Reliable | Guaranteed resend if packet loss — slower but no data loss |
| Best Effort | Send once, lose forever — faster, suitable for high frequency data | |
| Durability | Volatile | Subsequent subscribers miss previously published messages |
| Transient Local | Subscribers later still receive the last message published | |
| History | Keep Last (N) | Keep only the N most recent messages in the queue |
| Keep All | Holds all (limited by memory) |
Why do publishers and subscribers have to "match" QoS
DDS has a compatibility rule: some QoS combinations between publisher and subscriber will never connect, even though both have the same topic name and message type. Classic example: publisher configures Best Effort, subscriber requests Reliable — DDS sees this as a subscriber request that cannot be accommodated with what the publisher provides, and refuses to pair completely, silently, with no visible error.
Summary: High frequency sensor data (LiDAR, IMU) often uses Best Effort — losing one data frame is okay, the next frame arrives shortly after. Important data that cannot be lost (emergency stop command, configuration) should be used Reliable. Configuring the wrong type for the right data is the most common source of "nothing received" errors when first learning ROS2.
How it works
Configure QoS explicitly when creating publisher/subscriber in Python:
from rclpy.qos import QoSProfile, ReliabilityPolicy, DurabilityPolicy
qos = QoSProfile(
reliability=ReliabilityPolicy.BEST_EFFORT, # high frequency LiDAR data
durability=DurabilityPolicy.VOLATILE,
depth=5
)
self.create_subscription(LaserScan, '/scan', self.callback, qos)
Many packages (like maps from SLAM) publish with QoS Transient Local — because the map only updates infrequently, a node that starts later (like RViz2 that opens after SLAM has been running for a while) still needs to receive the latest map immediately instead of having to wait for the next publish.
Technical details
Parameters
Reliability compatibility table — the relationship is not symmetrical, remember the correct direction to avoid misconfiguration:
| Publisher | Subscriber Reliable | Subscriber Best Effort |
|---|---|---|
| Reliable | ✅ Can connect to | ✅ Can connect to |
| Best Effort | ❌ Unable to connect | ✅ Can connect to |
General rule: subscribers can only request guarantees less than or equal to what the publisher offers — subscribers who "demand more" than the publisher can offer will always fail.
Protocol
ROS2 provides standardized QoS presets for common situations, so you do not have to declare each field yourself: rclcpp::SensorDataQoS() (Best Effort + Volatile + small depth, used for high frequency sensor data), rclcpp::SystemDefaultsQoS() (Reliable + Volatile, default for most general cases). Using this preset correctly instead of manually configuring it helps the code be consistent with the common conventions of the ROS2 community, reducing the risk of creating a strange QoS combination that is incompatible with other standard drivers/packages.
Practical applications
Two typical data types on AMR clearly illustrate when to use which QoS combination: high frequency LiDAR/IMU data uses Best Effort + Volatile (it's okay to lose 1 frame, new frames will arrive immediately, no need to keep old history); while static maps (/map) or robot geometry descriptions (/robot_description, usually published once at startup) use Reliable + Transient Local — ensuring any nodes that start up later (eg: opening RViz2 to debug mid-session) still receive this important data immediately, without having to wait or miss it forever.
Practical example
$ ros2 topic info /scan --verbose
Output:
Type: sensor_msgs/msg/LaserScan
Publisher count: 1
Node name: lidar_driver
QoS profile:
Reliability: BEST_EFFORT
Durability: VOLATILE
History (Depth): KEEP_LAST (5)
Subscription count: 0
Subscription count: 0 even if the publisher is running fine — if the subscriber code is running but still showing 0 here, it is almost certainly due to QoS incompatibility (eg: subscriber requests Reliable while publisher only provides Best Effort) — check QoS both sides before suspecting code logic errors.
Common mistakes
- Subscriber requires Reliable while publisher only provides Best Effort — as mentioned in the Parameters section, this is a combination that can never be connected — check with
ros2 topic info --verboseas in the example above. - Using Reliable for extremely high frequency data — forcing DDS to guarantee resending of any lost packets can create cumulative latency (backpressure) when the network is unstable, worse than accepting the loss of a few frames with Best Effort — Reliable is not always "safer" in all situations.
- Not paying attention to the default QoS difference between the self-written publisher and the available driver — the default publisher in the self-written code is usually
Reliable, but many standard sensor drivers default toBest Effort— connecting 2 nodes thinking "just leave it as default" sometimes still encounter compatibility errors just because of different code sources. - Forgot to set Transient Local for configuration data to only publish once — if the subscription node starts after that data has been published (with default Durability Volatile), it will never receive it, have to wait until the next publish (if any) or be lost forever if the publisher only sends it exactly once.
Conclusion
QoS is a powerful tool for fine-tuning how data is transferred between nodes, but is also the most common source of "silent connection failed" errors for ROS2 newbies — always use ros2 topic info --verbose as a test when in doubt. The next article in this section is about DDS — the middleware layer that is actually behind the entire QoS, Topic, and Service mechanism just learned.
Get new articles and lessons by email
When a new technical article or course module is published, Atlas Robotics sends you a short email. No spam.
Unsubscribe any time with the link in each email. See our Privacy policy.