A Deep Dive into ROS 2 Quality of Service Settings and Their Application in Robotic Systems
2026-10-29

A Deep Dive into ROS 2 Quality of Service Settings and Their Application in Robotic Systems

Quality of Service (QoS) settings are crucial for ensuring reliable communication in ROS 2. This article explores the QoS policies available in ROS 2 and how they can be applied in robotic systems, using practical examples and real-world scenarios.

Overview of QoS Policies

ROS 2 provides a rich set of QoS policies that can be configured to meet the specific requirements of robotic applications. These policies control how messages are stored, delivered, and managed, ensuring that communication is robust and efficient. The base QoS profile includes policies such as history, depth, reliability, durability, deadline, and lifespan. Each policy contributes to the overall QoS profile, which can be tailored to suit the needs of the application.

For example, the history policy determines how many message samples are stored. The depth policy, which is relevant when the history policy is set to "keep last," controls the queue size. The reliability policy can be set to "best effort" for applications where occasional message loss is acceptable, or to "reliable" for critical applications where message loss must be avoided. The durability policy is crucial for applications where nodes may join or leave the network at any time, with "transient local" ensuring that samples are persisted for late-joining subscribers, and "volatile" ensuring that no samples are stored.

Choosing the Right QoS Policies

Choosing the correct QoS policies for a given scenario is a complex task. ROS 2 provides predefined QoS profiles for common use cases, such as sensor data, but developers also have the flexibility to control specific policies. For instance, in a robotic system where real-time performance is critical, the "reliable" policy combined with "transient local" durability might be necessary to ensure that messages are delivered even in lossy networks.

Consider a scenario where a robot needs to process sensor data in real-time. The QoS policies might be configured as follows: the history policy set to "keep last" with a queue depth of 10 samples, the reliability policy set to "reliable," and the durability policy set to "transient local." This configuration ensures that the robot can handle up to 10 recent sensor readings while guaranteeing that these readings are delivered to the processing node, even if the network is not robust.

Applying QoS Profiles to Nodes

QoS profiles can be specified for publishers, subscriptions, service servers, and clients. Each instance of these entities can have its own QoS profile, but it is important to ensure that the profiles are compatible to avoid message delivery issues. For example, if a publisher and a subscription use different QoS profiles, they may not be able to communicate effectively.

Suppose a robot has a camera that publishes images at a high frequency. The camera's publisher might be configured with a low history depth and a reliable reliability policy to ensure that only the most recent images are stored and that they are delivered reliably. On the other hand, the image processing node, which subscribes to these images, might use a high history depth to store a larger number of images for processing. This configuration ensures that the processing node can access the most recent images while still maintaining reliability.

Practical Example: A Robot with a Camera

Let's take a practical example of a robot equipped with a camera. The camera publishes images at a high frequency, and the robot's control system needs to process these images in real-time. We can configure the QoS settings as follows:

  • Publisher: Set the history policy to "keep last" with a queue depth of 10, the reliability policy to "reliable," and the durability policy to "transient local."
  • Subscriber: Set the history policy to "keep last" with a queue depth of 50, the reliability policy to "reliable," and the durability policy to "volatile."

This configuration ensures that the camera can store up to 10 recent images, ensuring that the control system always receives the most recent images. The subscriber, on the other hand, can store up to 50 images, providing a buffer for processing. The "volatile" durability policy in the subscriber ensures that images are not stored unnecessarily, reducing the risk of data loss.

Conclusion: Applying QoS Settings in Robotic Systems

QoS settings are essential for ensuring reliable communication in robotic systems. By understanding the various QoS policies and their interactions, developers can configure their applications to meet specific requirements. The predefined QoS profiles provided by ROS 2 can be a good starting point, but developers should also have the flexibility to fine-tune these settings to meet the unique needs of their applications.

To learn more about QoS settings and how to apply them in your robotic systems, refer to the official ROS 2 documentation and explore the ROS 2 tutorials and example applications. Additionally, the URDF tutorial provides practical examples of building visual robot models, which can help you better understand how QoS settings impact the performance of your robotic systems.

Evidence and related reading:官方来源1;官方来源2

18028484626 CONTACT US

公司:智联海(惠州)科技有限公司

地址:惠州仲恺高新区陈江街道白云山工业大道 5 号六楼 601

Q Q:18028484626

Copyright © 2002-2026

粤xxx

咨询 在线留言 电话:18028484626
微信 微信扫码添加我