Consider a ROS 2 QoS with:
- Durability policy
Transient local, - Reliability policy
Reliable, and - History policy
Keep last 5
This makes sense: the publisher will ensure message are delivered, and it will send the last 5 messages to late-joining subscribers.
Similarly, consider a ROS 2 QoS with:
- Durability policy
Transient local, - Reliability policy
Best effort, and - History policy
Keep last 5
This also makes sense: the publisher will send the last 5 messages to late-joining subscribers, but it does not care if a message isn't received.
However, following combinations are less clear to me:
A ROS 2 QoS with:
- Durability policy
Volatile, - Reliability policy
Reliable, and - History policy
Keep last 5
--> Does Keep last 5 make sense here? Late-joining subscribers only get the next published message, so why keep a buffer of 5? Only reason I see is maybe due to the Reliable policy, you need a buffer so publish calls don't block (or fail?) in case sending takes a long time if multiple retries are needed to deliver a message?
A ROS 2 QoS with:
- Durability policy
Volatile, - Reliability policy
Best Effort, and - History policy
Keep last 5
This is a default ROS 2 QoS policy: the SensorDataQoS, see also rmw_qos_profile_sensor_data.
However, what is the benefit of having a buffer > 1 here?
I think of maybe one use case: if there is a burst of up to 5 publish calls, faster than the actual messages can be sent through the rmw, then due to the buffer no messages will be dropped, whereas for Keep last 1 any consecutive publish call at a higher pace than the actual sending of the messages would be dropped?
Obviously this only deals with the case of short bursts; if the average publish rate is higher than the sending rate, any buffer size will fill eventually.
See also this question where long latencies are reported in case of SensorDataQoS with depth 5, as opposed to "normal latencies for history 1". So: is it recommended to use a buffer size of 1 if no bursts are expected?