@@ -44,6 +44,7 @@ enum class ReliabilityPolicy
4444 BestEffort = RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT,
4545 Reliable = RMW_QOS_POLICY_RELIABILITY_RELIABLE,
4646 SystemDefault = RMW_QOS_POLICY_RELIABILITY_SYSTEM_DEFAULT,
47+ BestAvailable = RMW_QOS_POLICY_RELIABILITY_BEST_AVAILABLE,
4748 Unknown = RMW_QOS_POLICY_RELIABILITY_UNKNOWN,
4849};
4950
@@ -52,6 +53,7 @@ enum class DurabilityPolicy
5253 Volatile = RMW_QOS_POLICY_DURABILITY_VOLATILE,
5354 TransientLocal = RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL,
5455 SystemDefault = RMW_QOS_POLICY_DURABILITY_SYSTEM_DEFAULT,
56+ BestAvailable = RMW_QOS_POLICY_DURABILITY_BEST_AVAILABLE,
5557 Unknown = RMW_QOS_POLICY_DURABILITY_UNKNOWN,
5658};
5759
@@ -60,6 +62,7 @@ enum class LivelinessPolicy
6062 Automatic = RMW_QOS_POLICY_LIVELINESS_AUTOMATIC,
6163 ManualByTopic = RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_TOPIC,
6264 SystemDefault = RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT,
65+ BestAvailable = RMW_QOS_POLICY_LIVELINESS_BEST_AVAILABLE,
6366 Unknown = RMW_QOS_POLICY_LIVELINESS_UNKNOWN,
6467};
6568
@@ -180,6 +183,10 @@ class RCLCPP_PUBLIC QoS
180183 QoS &
181184 best_effort ();
182185
186+ // / Set the reliability setting to best available.
187+ QoS &
188+ reliability_best_available ();
189+
183190 // / Set the durability setting.
184191 QoS &
185192 durability (rmw_qos_durability_policy_t durability);
@@ -199,6 +206,10 @@ class RCLCPP_PUBLIC QoS
199206 QoS &
200207 transient_local ();
201208
209+ // / Set the durability setting to best available.
210+ QoS &
211+ durability_best_available ();
212+
202213 // / Set the deadline setting.
203214 QoS &
204215 deadline (rmw_time_t deadline);
@@ -488,6 +499,36 @@ class RCLCPP_PUBLIC SystemDefaultsQoS : public QoS
488499 ));
489500};
490501
502+ /* *
503+ * Best available QoS class
504+ *
505+ * Match majority of endpoints currently available while maintaining the highest level of service.
506+ * Policies are chosen at the time of creating a subscription or publisher.
507+ * The middleware is not expected to update policies after creating a subscription or publisher,
508+ * even if one or more policies are incompatible with newly discovered endpoints.
509+ * Therefore, this profile should be used with care since non-deterministic behavior can occur due
510+ * to races with discovery.
511+ *
512+ * - History: Keep last,
513+ * - Depth: 10,
514+ * - Reliability: Best available,
515+ * - Durability: Best available,
516+ * - Deadline: Best available,
517+ * - Lifespan: Default,
518+ * - Liveliness: Best available,
519+ * - Liveliness lease duration: Best available,
520+ * - avoid ros namespace conventions: false
521+ */
522+ class RCLCPP_PUBLIC BestAvailableQoS : public QoS
523+ {
524+ public:
525+ explicit
526+ BestAvailableQoS (
527+ const QoSInitialization & qos_initialization = (
528+ QoSInitialization::from_rmw (rmw_qos_profile_best_available)
529+ ));
530+ };
531+
491532} // namespace rclcpp
492533
493534#endif // RCLCPP__QOS_HPP_
0 commit comments