nros C++ API
Lightweight ROS 2 client for embedded real-time systems (C++ headers)
Loading...
Searching...
No Matches
rclcpp::QoS Class Reference

#include <qos.hpp>

Inheritance diagram for rclcpp::QoS:

Public Member Functions

constexpr bool avoid_ros_namespace_conventions () const
 Whether to skip the /rt/ ROS topic-name prefix.
constexpr QoS & avoid_ros_namespace_conventions (bool on)
constexpr QoS & best_effort ()
 Set reliability to BEST_EFFORT (fire-and-forget; default for sensors).
constexpr Duration deadline () const
 The deadline window. Duration() (zero) = infinite.
constexpr QoS & deadline (const Duration &d)
constexpr int depth () const
 Configured queue depth (only meaningful for KEEP_LAST).
constexpr DurabilityPolicy durability () const
 The durability policy.
constexpr QoS & durability_best_available ()
constexpr QoS & durability_volatile ()
 Set durability to VOLATILE — late joiners get nothing (default).
constexpr ::rmw_qos_profile_s get_rmw_qos_profile () const
constexpr HistoryPolicy history () const
 The history policy.
constexpr QoS & keep_all ()
 Use KEEP_ALL history (bounded by transport).
constexpr QoS & keep_last (int depth)
constexpr Duration lifespan () const
 The lifespan window. Duration() (zero) = infinite.
constexpr QoS & lifespan (const Duration &d)
constexpr LivelinessPolicy liveliness () const
 The liveliness policy kind.
constexpr QoS & liveliness (LivelinessPolicy kind)
constexpr Duration liveliness_lease_duration () const
 The liveliness lease window. Duration() (zero) = infinite.
constexpr QoS & liveliness_lease_duration (const Duration &d)
constexpr QoS ()
constexpr QoS (::size_t depth)
constexpr QoS (const QoSInitialization &init)
constexpr QoS (const QoSInitialization &init, const ::rmw_qos_profile_s &profile)
constexpr ReliabilityPolicy reliability () const
 The reliability policy.
constexpr QoS & reliability_best_available ()
constexpr QoS & reliable ()
 Set reliability to RELIABLE (acked transport, retransmits on loss).
constexpr QoS & transient_local ()
 Set durability to TRANSIENT_LOCAL — late joiners get the last value.
constexpr bool tx_express () const
 Whether this publisher's samples bypass transport tx batching.
constexpr QoS & tx_express (bool on)

Static Public Member Functions

static constexpr QoS default_profile ()
 Default profile: RELIABLE + VOLATILE + KEEP_LAST(10).
static constexpr QoS sensor_data ()
 Sensor-data profile: BEST_EFFORT + VOLATILE + KEEP_LAST(5).
static constexpr QoS services ()
 Services profile: RELIABLE + VOLATILE + KEEP_LAST(10).

Friends

constexpr QoS detail::qos_from_ffi (const nros_cpp_qos_t &f)

Detailed Description

QoS profile for publishers and subscriptions.

Mirrors rclcpp::QoS with chainable setters and predefined profiles. All methods are constexpr — profiles can be computed at compile time.

Phase 108.B.7 — extended with full DDS QoS surface (deadline, lifespan, liveliness kind + lease, avoid_ros_namespace_conventions). Backends advertise per-policy support; entities created with a profile the active backend can't honour return NROS_CPP_RET_NOT_ALLOWED (an IncompatibleQos refusal; NROS_CPP_RET_INCOMPATIBLE_QOS before) synchronously at create time.

Phase 379 W5 — the policy enums moved to namespace scope, the getters return them instead of int, and the three time windows take and return rclcpp::Duration instead of carrying an _ms suffix. The old spellings were deleted by phase-482 W6.

Constructor & Destructor Documentation

◆ QoS() [1/4]

rclcpp::QoS::QoS ( )
inlineconstexpr

Default QoS: reliable, volatile, keep-last(10), automatic liveliness, no deadline / lifespan / lease.

◆ QoS() [2/4]

rclcpp::QoS::QoS ( ::size_t depth)
inlineconstexpr

rclcpp's depth ctor: QoS(1) == default profile with keep-last(1). IMPLICIT, as upstream's QoS(size_t history_depth) is, so a bare depth converts wherever a profile is expected (create_publisher<M>(t, 10)). Before phase-483 this was an explicit int ctor on nros::QoS and a derived rclcpp::QoS added the implicit one; the two are one class now.

◆ QoS() [3/4]

rclcpp::QoS::QoS ( const QoSInitialization & init)
explicitconstexpr

Upstream's QoS(QoSInitialization, rmw_qos_profile_t) and its one-argument form, which starts from rmw_qos_profile_default (issue 2054): the profile's policies, with the history and depth init states. rclcpp::QoS(rclcpp::QoSInitialization::from_rmw(p), p) is the ported spelling. Defined beside rmw_qos_profile_t at the bottom of this file.

◆ QoS() [4/4]

rclcpp::QoS::QoS ( const QoSInitialization & init,
const ::rmw_qos_profile_s & profile )
constexpr

Member Function Documentation

◆ avoid_ros_namespace_conventions() [1/2]

bool rclcpp::QoS::avoid_ros_namespace_conventions ( ) const
inlineconstexpr

Whether to skip the /rt/ ROS topic-name prefix.

◆ avoid_ros_namespace_conventions() [2/2]

QoS & rclcpp::QoS::avoid_ros_namespace_conventions ( bool on)
inlineconstexpr

Skip the ROS /rt/ topic-name prefix. Off by default; enable when interoperating with non-ROS DDS endpoints.

◆ best_effort()

QoS & rclcpp::QoS::best_effort ( )
inlineconstexpr

Set reliability to BEST_EFFORT (fire-and-forget; default for sensors).

◆ deadline() [1/2]

Duration rclcpp::QoS::deadline ( ) const
inlineconstexpr

The deadline window. Duration() (zero) = infinite.

◆ deadline() [2/2]

QoS & rclcpp::QoS::deadline ( const Duration & d)
inlineconstexpr

Subscriber max-inter-arrival / publisher offered-rate. A zero or negative duration = infinite (no deadline check).

The C ABI underneath is uint32_t milliseconds, so a sub-millisecond window ROUNDS UP to 1 ms — it never truncates to 0, which the ABI reads as infinity. Above ~49.7 days it saturates. See detail::qos_window_ms.

◆ default_profile()

QoS rclcpp::QoS::default_profile ( )
staticconstexpr

Default profile: RELIABLE + VOLATILE + KEEP_LAST(10).

◆ depth()

int rclcpp::QoS::depth ( ) const
inlineconstexpr

Configured queue depth (only meaningful for KEEP_LAST).

◆ durability()

DurabilityPolicy rclcpp::QoS::durability ( ) const
inlineconstexpr

The durability policy.

◆ durability_best_available()

QoS & rclcpp::QoS::durability_best_available ( )
inlineconstexpr

Set durability to BEST_AVAILABLE — rclcpp::QoS::durability_best_available (issue 1973). Same creation-time resolution as reliability_best_available(), over TRANSIENT_LOCAL / VOLATILE.

◆ durability_volatile()

QoS & rclcpp::QoS::durability_volatile ( )
inlineconstexpr

Set durability to VOLATILE — late joiners get nothing (default).

◆ get_rmw_qos_profile()

constexpr::rmw_qos_profile_s rclcpp::QoS::get_rmw_qos_profile ( ) const

Upstream's get_rmw_qos_profile() — this profile as an rmw_qos_profile_t (issue 2054). Returns by VALUE where upstream hands back a reference to its stored struct: QoS stores the C ABI's fields, not upstream's, so there is no struct to refer to, and a copy is what every ported caller (auto p = qos.get_rmw_qos_profile();) takes anyway.

◆ history()

HistoryPolicy rclcpp::QoS::history ( ) const
inlineconstexpr

The history policy.

◆ keep_all()

QoS & rclcpp::QoS::keep_all ( )
inlineconstexpr

Use KEEP_ALL history (bounded by transport).

◆ keep_last()

QoS & rclcpp::QoS::keep_last ( int depth)
inlineconstexpr

Use KEEP_LAST history with the given depth.

Parameters
depthmaximum number of messages buffered per entity.

◆ lifespan() [1/2]

Duration rclcpp::QoS::lifespan ( ) const
inlineconstexpr

The lifespan window. Duration() (zero) = infinite.

◆ lifespan() [2/2]

QoS & rclcpp::QoS::lifespan ( const Duration & d)
inlineconstexpr

Sample expiry. A zero or negative duration = infinite. Same millisecond boundary as deadline().

◆ liveliness() [1/2]

LivelinessPolicy rclcpp::QoS::liveliness ( ) const
inlineconstexpr

The liveliness policy kind.

◆ liveliness() [2/2]

QoS & rclcpp::QoS::liveliness ( LivelinessPolicy kind)
inlineconstexpr

Liveliness kind. Pair with liveliness_lease_duration() for MANUAL_BY_TOPIC / MANUAL_BY_NODE. AUTOMATIC is the default.

◆ liveliness_lease_duration() [1/2]

Duration rclcpp::QoS::liveliness_lease_duration ( ) const
inlineconstexpr

The liveliness lease window. Duration() (zero) = infinite.

◆ liveliness_lease_duration() [2/2]

QoS & rclcpp::QoS::liveliness_lease_duration ( const Duration & d)
inlineconstexpr

Liveliness lease duration. A zero or negative duration = infinite. Same millisecond boundary as deadline().

◆ reliability()

ReliabilityPolicy rclcpp::QoS::reliability ( ) const
inlineconstexpr

The reliability policy.

◆ reliability_best_available()

QoS & rclcpp::QoS::reliability_best_available ( )
inlineconstexpr

Set reliability to BEST_AVAILABLE — rclcpp::QoS::reliability_best_available (issue 1973). Resolved when the entity is created: a subscription takes RELIABLE only if every publisher already discovered offers it, a publisher always takes RELIABLE. get_actual_qos() reports the result.

◆ reliable()

QoS & rclcpp::QoS::reliable ( )
inlineconstexpr

Set reliability to RELIABLE (acked transport, retransmits on loss).

◆ sensor_data()

QoS rclcpp::QoS::sensor_data ( )
staticconstexpr

Sensor-data profile: BEST_EFFORT + VOLATILE + KEEP_LAST(5).

◆ services()

QoS rclcpp::QoS::services ( )
staticconstexpr

Services profile: RELIABLE + VOLATILE + KEEP_LAST(10).

◆ transient_local()

QoS & rclcpp::QoS::transient_local ( )
inlineconstexpr

Set durability to TRANSIENT_LOCAL — late joiners get the last value.

◆ tx_express() [1/2]

bool rclcpp::QoS::tx_express ( ) const
inlineconstexpr

Whether this publisher's samples bypass transport tx batching.

◆ tx_express() [2/2]

QoS & rclcpp::QoS::tx_express ( bool on)
inlineconstexpr

Phase 282 (#145) — mark this publisher "express": its samples bypass transport tx batching (sent immediately even when the batching knob is on). A transport hint for control-tier / latency-sensitive topics; ignored on subscriptions and by backends without batching.

◆ detail::qos_from_ffi


The documentation for this class was generated from the following file: