ROS2 from the Ground Up: Part 7- Achieving Reliable Communication in ROS 2 with QoS Configurations
In a Robot Operating System (ROS) 2 system, Quality of Service (QoS) is used to specify various policies that determine how messages are transmitted and received over a ROS 2 topic or service. QoS policies allow you to optimize the performance and reliability of communication between nodes in a ROS 2 system. These settings can be used to tune the performance and behaviour of a DDS system to meet the specific needs of an application.
rclcpp::QoS
is a class in the rclcpp
library, which is the primary client library for ROS2. It is used to specify the Quality of Service settings for ROS2 publishers/subscribers and Services.
rclcpp::QoS
has two constructors: one that takes a single history_depth
parameter, and another that takes a qos_profile
parameter.
The history_depth
parameter specifies the number of past messages that a subscriber should retain. This can be used to control the amount of memory used by a subscriber and to ensure that new subscribers can receive a certain number of past messages when they start subscribing.