nros C++ API
Lightweight ROS 2 client for embedded real-time systems (C++ headers)
Loading...
Searching...
No Matches
qos.hpp
Go to the documentation of this file.
1// nros-cpp: QoS (Quality of Service) profiles
2// Freestanding C++ — no STL required
3
10#ifndef NROS_RCLCPP_QOS_HPP
11#define NROS_RCLCPP_QOS_HPP
12
13#include <stdint.h>
14
15// Phase 379 W5 — the deadline / lifespan / lease accessors take and return
16// `rclcpp::Duration`, so this header names it. `nros.hpp` includes `qos.hpp`
17// before `duration.hpp`, so the dependency is spelled HERE rather than left to
18// the umbrella's ordering: a header that names a type must be able to be
19// included first.
20#include "rclcpp/duration.hpp"
21// phase-417 G7 — `NROS_PUBLIC`, for the one C entry point this header
22// declares (`qos_policy_kind_to_cstr`, below). Macros only; the file includes
23// nothing and compiles freestanding, so it costs this header's
24// self-containment nothing.
25#include "rclc/visibility_control.h"
26// phase-417 stage 6 step A — `rclcpp::detail::refuse` and the
27// `NROS_RCLCPP_REFUSE_*` diagnostics, used by `SystemDefaultsQoS` below.
28// `log.hpp` includes nothing of ours, so this adds no cycle.
29#include "rclcpp/logging.hpp"
30// `<type_traits>` is GATED, and this is issue 0112's class one step further
31// than step A caught it. Zephyr's minimal libcpp ships exactly THREE headers --
32// `cstddef`, `cstdint`, `new` (`zephyr/lib/cpp/minimal/include/`) -- so an
33// UNGATED include here made `#include <rclcpp/rclcpp.hpp>` fail to compile on every
34// Zephyr C++ image. Step A verified against a SYNTHESISED minimal libcpp that
35// happened to provide `<type_traits>`, so the lane stayed green.
36//
37// `is_qos_arg` exists only to disambiguate `rclcpp::Node`'s create_service
38// overloads, and that node type is itself hosted-only, so nothing freestanding
39// can reach the predicate.
40// This header includes NOTHING, deliberately -- see `is_qos_arg` below.
41
42// FFI struct definition — mirrors `nros_cpp_qos_t` in
43// nros_cpp_ffi.h. Phase 118.D: guarded by `NROS_CPP_FFI_H`. If
44// `nros_cpp_ffi.h` was included earlier (it sets that guard), the
45// canonical types are already in scope; otherwise emit local
46// definitions so this header stays self-contained for callers that
47// don't pull the cbindgen header directly.
48//
49// The FIELD names below are ABI. `deadline_ms` / `lifespan_ms` /
50// `liveliness_lease_ms` are `uint32_t` milliseconds and are mirrored again in
51// `rclc/component.h` (issue 0160, gated by `check-ffi-struct-mirrors`). The
52// `_ms` suffix on a `QoS` METHOD was renamed in phase-379 W5; the suffix on a
53// STRUCT FIELD was not, and must not be — the C ABI carries milliseconds.
54#ifndef NROS_CPP_FFI_H
55extern "C" {
93}
94#endif // NROS_CPP_FFI_H
95
96namespace rclcpp {
97
98// -- Policy enums (phase 379 W5) ------------------------------------------
99//
100// At NAMESPACE scope and public, under rclcpp's names, because that is where a
101// ported node looks for them (`rclcpp::ReliabilityPolicy`, `qos.hpp:34-58`).
102// Three of these were PRIVATE members of `QoS` until phase-379 W5, which is why
103// the getters had to hand back `int` — a public getter cannot name a private
104// type. Ledger: `cpp:ReliabilityPolicy` and its three siblings.
105//
106// The two rclcpp enumerators we used to decline ARRIVED in phase-444 (issue
107// 1437), and the reason each was declined is the reason it is now needed:
108//
109// * `SystemDefault` — "defer to the middleware". Declined because nothing
110// DEFERS: the backend is linked at build time (RFC-0036). True of a
111// REQUEST, and a `QoS` is no longer only a request — `get_actual_qos()`
112// hands one back, and a backend CAN report that a policy was never stated.
113// * `Unknown` — declined as "a discovery artefact for a policy read off a
114// remote endpoint, and we do no dynamic discovery". It is not that: it is
115// what `rmw_*_get_actual_qos` owes for a policy the backend looked at and
116// cannot determine, on the LOCAL endpoint. `rmw_vtable.h` has always said
117// so, and until issue 1437 no implementation anywhere wrote one.
118//
119// What is still declined is `rclcpp::SystemDefaultsQoS` — the all-sentinel
120// PRESET, whose two RMWs resolve it to depth 1 and depth 42 (issue 0829).
121// A value a backend may REPORT is not a profile a caller may REQUEST, and the
122// refusal on that class stands (`NROS_RCLCPP_REFUSE_SYSTEM_DEFAULTS_QOS`).
123//
124// The enumerators are upstream's and SCOPED (phase-483 W1): one
125// `SystemDefault` and one `Unknown` per policy, reached as
126// `rclcpp::ReliabilityPolicy::Unknown`. The prefixed spellings
127// (`ReliabilityUnknown`, `LivelinessNone`) existed only because these were
128// unscoped enums, and the bare `rclcpp::Reliable` form went with them.
129
136enum class ReliabilityPolicy : int {
137 Reliable = 0,
138 BestEffort = 1,
141 SystemDefault = 2,
143 Unknown = 3,
144};
145
147enum class DurabilityPolicy : int {
148 Volatile = 0,
149 TransientLocal = 1,
151 SystemDefault = 2,
153 Unknown = 3,
154};
155
157enum class HistoryPolicy : int {
158 KeepLast = 0,
159 KeepAll = 1,
161 SystemDefault = 2,
163 Unknown = 3,
164};
165
172enum class LivelinessPolicy : int {
173 SystemDefault = 0,
174 Automatic = 1,
175 ManualByTopic = 2,
176 ManualByNode = 3,
179 Unknown = 4,
180};
181
182class QoS;
183
184namespace detail {
185
201constexpr uint32_t qos_window_ms(const Duration& d) {
202 return d.nanoseconds() <= 0
203 ? 0u
204 : (d.nanoseconds() > static_cast<int64_t>(UINT32_MAX) * 1000000
205 ? UINT32_MAX
206 : static_cast<uint32_t>((d.nanoseconds() + 999999) / 1000000));
207}
208
212 return Duration::from_nanoseconds(static_cast<int64_t>(ms) * 1000000);
213}
214
218constexpr QoS qos_from_ffi(const nros_cpp_qos_t& f);
219
220} // namespace detail
221
237class QoS {
238 public:
241 constexpr QoS()
242 : reliability_(ReliabilityPolicy::Reliable), durability_(DurabilityPolicy::Volatile),
243 history_(HistoryPolicy::KeepLast), liveliness_(::rclcpp::LivelinessPolicy::SystemDefault),
244 depth_(10), deadline_ms_(0), lifespan_ms_(0), liveliness_lease_ms_(0),
245 avoid_ros_namespace_conventions_(0), tx_express_(0) {}
246
252 // NOLINTNEXTLINE(google-explicit-constructor)
253 constexpr QoS(::size_t depth) : QoS() { depth_ = static_cast<int>(depth); }
254
255 // -- Chainable setters (match rclcpp fluent API) --
256
258 constexpr QoS& reliable() {
259 reliability_ = ReliabilityPolicy::Reliable;
260 return *this;
261 }
262
264 constexpr QoS& best_effort() {
265 reliability_ = ReliabilityPolicy::BestEffort;
266 return *this;
267 }
268
270 constexpr QoS& transient_local() {
272 return *this;
273 }
274
277 durability_ = DurabilityPolicy::Volatile;
278 return *this;
279 }
280
283 constexpr QoS& keep_last(int depth) {
284 history_ = HistoryPolicy::KeepLast;
285 depth_ = depth;
286 return *this;
287 }
288
290 constexpr QoS& keep_all() {
291 history_ = HistoryPolicy::KeepAll;
292 return *this;
293 }
294
302 constexpr QoS& deadline(const Duration& d) {
303 deadline_ms_ = detail::qos_window_ms(d);
304 return *this;
305 }
306
309 constexpr QoS& lifespan(const Duration& d) {
310 lifespan_ms_ = detail::qos_window_ms(d);
311 return *this;
312 }
313
317 liveliness_ = kind;
318 return *this;
319 }
320
324 liveliness_lease_ms_ = detail::qos_window_ms(d);
325 return *this;
326 }
327
331 avoid_ros_namespace_conventions_ = on ? 1 : 0;
332 return *this;
333 }
334
339 constexpr QoS& tx_express(bool on) {
340 tx_express_ = on ? 1 : 0;
341 return *this;
342 }
343
344 // -- Predefined profiles (match rclcpp named constructors) --
345 //
346 // phase-428 W10 — DECLARED here, DEFINED below from `rclcpp::detail::qos_table`,
347 // which is the one place this header spells a profile's fields. Until W10
348 // these three carried their own literals AND the `rclcpp::*QoS` classes at
349 // the bottom of the file carried a second, independent set: `sensor_data`
350 // and `services_default` were each written twice inside ONE header, with
351 // nothing asserting they agreed. That is the hand-mirror class
352 // (issues 0088 / 0160 / 0245) at file scope.
353
355 static constexpr QoS default_profile();
356
358 static constexpr QoS sensor_data();
359
361 static constexpr QoS services();
362
363 // -- Accessors --
364
366 constexpr ReliabilityPolicy reliability() const { return reliability_; }
368 constexpr DurabilityPolicy durability() const { return durability_; }
370 constexpr HistoryPolicy history() const { return history_; }
372 constexpr LivelinessPolicy liveliness() const { return liveliness_; }
374 constexpr int depth() const { return depth_; }
376 constexpr Duration deadline() const { return detail::qos_window_duration(deadline_ms_); }
378 constexpr Duration lifespan() const { return detail::qos_window_duration(lifespan_ms_); }
381 return detail::qos_window_duration(liveliness_lease_ms_);
382 }
384 constexpr bool avoid_ros_namespace_conventions() const {
385 return avoid_ros_namespace_conventions_ != 0;
386 }
388 constexpr bool tx_express() const { return tx_express_ != 0; }
389
390 private:
391 // issue 1437 — the ONE function allowed to write these directly.
392 //
393 // `qos_from_ffi` builds the profile a backend GRANTED, and a grant can
394 // state `ReliabilityPolicy::Unknown` / `HistoryPolicy::SystemDefault` / ... which NO
395 // public setter can produce: the setters are `reliable()`,
396 // `best_effort()`, `keep_last(n)` — the vocabulary of a REQUEST, and a
397 // request may not carry a sentinel. Adding enum-taking setters to reach
398 // them would hand every caller a way to ask for one, which is the refusal
399 // `NROS_RCLCPP_REFUSE_SYSTEM_DEFAULTS_QOS` exists to keep. A friend for
400 // the read-back direction alone keeps both properties.
401 friend constexpr QoS detail::qos_from_ffi(const nros_cpp_qos_t& f);
402
403 // The private members keep their `_ms_` spelling: they hold exactly what
404 // the C ABI carries (`uint32_t` milliseconds), and renaming them would say
405 // the storage changed when only the accessors did.
406 ReliabilityPolicy reliability_;
407 DurabilityPolicy durability_;
408 HistoryPolicy history_;
409 LivelinessPolicy liveliness_;
410 int depth_;
411 uint32_t deadline_ms_;
412 uint32_t lifespan_ms_;
413 uint32_t liveliness_lease_ms_;
414 uint8_t avoid_ros_namespace_conventions_;
415 uint8_t tx_express_;
416};
417
418// ============================================================================
419// phase-417 G6 — profile comparison. `rclcpp::operator==(const QoS&, const QoS&)`
420// ============================================================================
421//
422// FREE functions, as upstream's are, and written from the PUBLIC accessors —
423// every one of the ten members has one, so no `friend` is needed and the
424// comparison stays a thing a reader can check against the accessor list.
425//
426// TEN hand-written comparisons rather than `= default`. `operator==() =
427// default` is C++20 and this surface's floor is `cxx_std_17`
428// (`packages/api/nros-cpp/CMakeLists.txt` — `target_compile_features(
429// nros-cpp-headers INTERFACE cxx_std_17)`), so the defaulted form would not
430// compile for the targets this header exists to serve. Still `constexpr`,
431// still no allocator, still no exceptions.
432//
433// Rust's `QoSProfile` derives `PartialEq, Eq` and has had this for nothing
434// since it existed; the ledger row `cpp:operator==` recorded the asymmetry as
435// having no platform reason, and it did not.
436//
437// The three time windows are compared through `Duration::nanoseconds()`: the
438// storage is milliseconds and the conversion is exact in both directions
439// (`detail::qos_window_duration`).
440
446constexpr bool operator==(const QoS& left, const QoS& right) {
447 return left.reliability() == right.reliability() && left.durability() == right.durability() &&
448 left.history() == right.history() && left.liveliness() == right.liveliness() &&
449 left.depth() == right.depth() &&
450 left.deadline().nanoseconds() == right.deadline().nanoseconds() &&
451 left.lifespan().nanoseconds() == right.lifespan().nanoseconds() &&
452 left.liveliness_lease_duration().nanoseconds() ==
453 right.liveliness_lease_duration().nanoseconds() &&
454 left.avoid_ros_namespace_conventions() == right.avoid_ros_namespace_conventions() &&
455 left.tx_express() == right.tx_express();
456}
457
460constexpr bool operator!=(const QoS& left, const QoS& right) {
461 return !(left == right);
462}
463
464// ============================================================================
465// phase-417 G7 — naming a QoS policy
466// ============================================================================
467
507
513
514namespace detail {
515
516// --- THE C++ QoS profile table (phase-428 W10) -------------------------------
517//
518// Every named profile the C++ surface offers is spelled HERE and nowhere else.
519// `rclcpp::QoS`'s three named statics and all six concrete `rclcpp::*QoS` classes
520// are defined by calling into this block; none of them restates a policy.
521//
522// Why a table and not a hand copy per class: W10 exists because upstream's 7
523// profiles were transcribed in four places across the repo — this header,
524// `nros-rmw/src/traits.rs`, `nros/src/lib.rs` and `nros-rmw-abi/.../
525// rmw_entity.h` — about 26 constants for a 7-row table, with no gate binding
526// them. `QOS_PROFILE_PARAMETER_EVENTS` is the proof: `KeepAll, 0` in Rust under
527// a comment claiming it matched `rmw_qos_profile_parameter_events`, which is
528// `KEEP_LAST, 1000`. This header had the same profile right, which is exactly
529// what an ungated mirror looks like until the day it is not.
530//
531// This block cannot CONSUME the cross-language SSoT. The C spellings in
532// `rmw_entity.h` are `((rmw_qos_profile_t){...})` compound literals, which are
533// C99 and not standard C++, over a struct whose field types differ from
534// `nros_cpp_qos_t`'s; and `qos.hpp` is deliberately self-contained and
535// freestanding (see issue 0112 at the top of this file), so it cannot take a
536// dependency on a build-generated header either. What the table DOES buy is
537// that the C++ side has ONE row per profile for a cross-language gate to read,
538// instead of nine constructor bodies to parse.
539//
540// phase-454 W1 collected on that. `scripts/check-qos-profile-ssot.py` now
541// EVALUATES these rows — the ctor supplies the base profile and each chained
542// call applies its one effect — and compares every field against
543// `QoSProfile::QOS_PROFILE_*`. So the table is bound after all; what it is not
544// is DERIVED, which is the weaker of the two and the strongest available to a
545// freestanding header. A `.setter()` the gate does not model is a hard failure
546// there, not a skipped field.
547//
548// Values read 2026-09-05 against ROS 2 Humble as installed:
549// /opt/ros/humble/include/rmw/rmw/qos_profiles.h :25,38,51,64,77,90
550// /opt/ros/humble/include/rcl/rcl/logging_rosout.h :36
551// /opt/ros/humble/include/rclcpp/rclcpp/qos.hpp :371-500
552//
553// Three fields are identical in EVERY upstream profile and are therefore folded
554// into `QoS`'s default constructor rather than spelled per row:
555// * `avoid_ros_namespace_conventions` is `false` upstream, `0` here.
556// * liveliness is `RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT` upstream, and
557// `rclcpp::QoS` now defaults to `LivelinessPolicy::SystemDefault`, which is our spelling of
558// that sentinel. It defaulted to `LivelinessAutomatic` — "what every
559// reference RMW folds that sentinel to" — under a
560// `nros-qos-mirror-deviation` record whose own reason was that this
561// surface and `nros-c`'s "move together with the C ABI or not at all".
562// They moved together (issue 1329): this constructor, `nros-c`'s
563// `NROS_QOS_*` statics and (until phase-492 W4) `component.h`'s
564// `rclc_c_qos_default()`.
565//
566// The forcing argument is issue 1329's per-backend QoS mask. XRCE honours
567// no liveliness, so an AUTOMATIC default would have made
568// `required_policies()` demand `LIVELINESS_AUTOMATIC` and refuse every C++
569// default profile on that backend — over a policy upstream leaves unset
570// and the application never asked for. A caller that wants automatic
571// liveliness states `.liveliness(rclcpp::LivelinessPolicy::Automatic)`.
572//
573// * deadline and the liveliness lease are `RMW_QOS_*_DEFAULT` (infinite)
574// upstream and `0` here, which `qos_window_ms` above documents as infinite.
575//
576// `rmw_qos_profile_system_default` has NO row: every one of its fields is a
577// sentinel, so no value could be right. `rclcpp::SystemDefaultsQoS` refuses at
578// compile time instead — see the class below.
579struct qos_table {
584 static constexpr QoS default_profile() { return QoS(); }
585
587 static constexpr QoS sensor_data() { return QoS().best_effort().keep_last(5); }
588
594 static constexpr QoS services_default() { return QoS().reliable().keep_last(10); }
595
597 static constexpr QoS parameters() { return QoS().reliable().keep_last(1000); }
598
604 static constexpr QoS parameter_events() { return QoS().reliable().keep_last(1000); }
605
608 static constexpr QoS rosout() {
609 return QoS().reliable().transient_local().keep_last(1000).lifespan(
610 ::rclcpp::Duration::from_nanoseconds(10000000000LL));
611 }
612
618 static constexpr QoS clock() { return QoS().best_effort().keep_last(1); }
619};
620
634constexpr nros_cpp_qos_t qos_to_ffi(const QoS& qos) {
635 nros_cpp_qos_t f{};
636 f.reliability = static_cast<nros_cpp_qos_reliability_t>(qos.reliability());
637 f.durability = static_cast<nros_cpp_qos_durability_t>(qos.durability());
638 f.history = static_cast<nros_cpp_qos_history_t>(qos.history());
639 f.liveliness_kind = static_cast<nros_cpp_qos_liveliness_t>(qos.liveliness());
640 f.depth = qos.depth();
641 // The FFI FIELDS are milliseconds and keep their `_ms` names; only the
642 // accessors changed. `qos_window_ms` is the exact inverse of the
643 // `Duration` the getter built, so this round-trip loses nothing.
644 f.deadline_ms = qos_window_ms(qos.deadline());
645 f.lifespan_ms = qos_window_ms(qos.lifespan());
646 f.liveliness_lease_ms = qos_window_ms(qos.liveliness_lease_duration());
647 f.avoid_ros_namespace_conventions = qos.avoid_ros_namespace_conventions() ? 1 : 0;
648 f.tx_express = qos.tx_express() ? 1 : 0;
649 return f;
650}
651
668constexpr QoS qos_all_unknown() {
669 nros_cpp_qos_t f{};
671 f.durability = static_cast<nros_cpp_qos_durability_t>(DurabilityPolicy::Unknown);
672 f.history = static_cast<nros_cpp_qos_history_t>(HistoryPolicy::Unknown);
673 f.liveliness_kind = static_cast<nros_cpp_qos_liveliness_t>(LivelinessPolicy::Unknown);
674 f.depth = 0;
675 return qos_from_ffi(f);
676}
677
693constexpr QoS qos_from_ffi(const nros_cpp_qos_t& f) {
694 QoS q;
695 q.reliability_ = static_cast<ReliabilityPolicy>(f.reliability);
696 q.durability_ = static_cast<DurabilityPolicy>(f.durability);
697 q.history_ = static_cast<HistoryPolicy>(f.history);
698 q.liveliness_ = static_cast<LivelinessPolicy>(f.liveliness_kind);
699 q.depth_ = f.depth;
700 q.deadline_ms_ = f.deadline_ms;
701 q.lifespan_ms_ = f.lifespan_ms;
702 q.liveliness_lease_ms_ = f.liveliness_lease_ms;
703 q.avoid_ros_namespace_conventions_ = f.avoid_ros_namespace_conventions;
704 q.tx_express_ = f.tx_express;
705 return q;
706}
707
708} // namespace detail
709
710// phase-428 W10 — the three named statics declared on `QoS`, defined from the
711// one table. Out of line because the table needs a COMPLETE `QoS` and these are
712// members of it; `constexpr` implies `inline`, so this is still header-only and
713// still usable in the `static_assert`s and default arguments that call it.
715 return detail::qos_table::default_profile();
716}
718 return detail::qos_table::sensor_data();
719}
720constexpr QoS QoS::services() {
721 return detail::qos_table::services_default();
722}
723
724} // namespace rclcpp
725
726// ============================================================================
727// rclcpp:: — the ROS 2 spelling of the QoS surface (RFC-0089 stage 6, step A)
728// ============================================================================
729//
730// Moved here from `nros/rclcpp_compat.hpp`, which no longer exists as a
731// separate surface: RFC-0089 §"Naming: replace, with alias as the migration
732// step" makes the ROS 2 spelling a first-class name declared by the API header
733// that owns the concept. Step B, retiring the in-tree `nros::QoS` spelling,
734// landed in phase-483 W1.
735//
736// Everything below is freestanding-safe — `constexpr` classes over `rclcpp::QoS`
737// and one `<type_traits>` predicate — so a `no_std` C++ build gets the ROS 2
738// QoS vocabulary too, which the hosted-STL shim could never offer it.
739
740namespace rclcpp {
741
742namespace detail {
743
777template <typename F> struct qos_arg_strip {
778 typedef F type;
779};
780template <typename F> struct qos_arg_strip<F&> {
781 typedef F type;
782};
783template <typename F> struct qos_arg_strip<const F&> {
784 typedef F type;
785};
786template <typename F> struct qos_arg_strip<const F> {
787 typedef F type;
788};
789
790template <typename F> class is_qos_arg {
791 typedef char yes_t[1];
792 typedef char no_t[2];
793 // Declared, never defined: both calls live in `sizeof`, which does not
794 // evaluate its operand.
795 static yes_t& probe(const ::rclcpp::QoS*);
796 static no_t& probe(...);
797 static typename qos_arg_strip<F>::type* arg();
798
799 public:
800 static const bool value = sizeof(probe(arg())) == sizeof(yes_t);
801};
802
803} // namespace detail
804
805// --- Named QoS profiles (RFC-0089 W3.f; bound to one table, phase-428 W10) ---
806//
807// Each class below is a NAME for a row of `rclcpp::detail::qos_table`, and states
808// no policy of its own. Before W10 each carried its own literals, so
809// `SensorDataQoS` and `ServicesQoS` restated what `rclcpp::QoS::sensor_data()` and
810// `rclcpp::QoS::services()` already said, 400 lines up in the same header — the
811// shape upstream itself avoids: rclcpp's `SensorDataQoS` is
812// `QoSInitialization::from_rmw(rmw_qos_profile_sensor_data)`, a REFERENCE to the
813// rmw constant, never a re-transcription of it (`rclcpp/qos.hpp:391-399`).
814//
815// The reason a name-only class is still worth having is unchanged: two of these
816// shipped WRONG, which is why the values are pinned by a test rather than by
817// review.
818//
819// * `ParametersQoS()` returned `QoS(10)` where `rmw_qos_profile_parameters`
820// is KEEP_LAST/**1000** — a hundredfold history difference under a name
821// that claims to be the ROS 2 profile, costing samples under load with
822// nothing to read.
823// * `SystemDefaultsQoS()` returned `QoS(10)`, which is
824// `rmw_qos_profile_default` — a DIFFERENT upstream profile. It is now
825// REFUSE-LOUD; see the class below for why no value can be right.
826//
827// The upstream sources, and the three fields folded into `QoS()` rather than
828// spelled per row, are documented on `qos_table` itself — one place, because
829// that is the whole point of this work item.
830//
831// These are CLASSES, as upstream's are, so `rclcpp::SensorDataQoS{}` — the
832// brace form — compiles alongside `rclcpp::SensorDataQoS()`. They are
833// `constexpr`, so the table-driven check lives in `static_assert`s
834// (`tests/compile/ros2_api_adoption_stage2.cpp`) rather than in a runtime test
835// no embedded lane runs.
836
838class SensorDataQoS : public QoS {
839 public:
840 constexpr SensorDataQoS() : QoS(::rclcpp::detail::qos_table::sensor_data()) {}
841};
842
847class ServicesQoS : public QoS {
848 public:
849 constexpr ServicesQoS() : QoS(::rclcpp::detail::qos_table::services_default()) {}
850};
851
855class ParametersQoS : public QoS {
856 public:
857 constexpr ParametersQoS() : QoS(::rclcpp::detail::qos_table::parameters()) {}
858};
859
867class ParameterEventsQoS : public QoS {
868 public:
869 constexpr ParameterEventsQoS() : QoS(::rclcpp::detail::qos_table::parameter_events()) {}
870};
871
880class RosoutQoS : public QoS {
881 public:
882 constexpr RosoutQoS() : QoS(::rclcpp::detail::qos_table::rosout()) {}
883};
884
886class ClockQoS : public QoS {
887 public:
888 constexpr ClockQoS() : QoS(::rclcpp::detail::qos_table::clock()) {}
889};
890
899class SystemDefaultsQoS : public QoS {
900 public:
901 template <typename T = void> SystemDefaultsQoS() {
902 static_assert(detail::refuse<T>::value, NROS_RCLCPP_REFUSE_SYSTEM_DEFAULTS_QOS);
903 }
904};
905
916constexpr QoS KeepLast(::size_t depth) {
917 return QoS(depth);
918}
919
921constexpr QoS KeepAll() {
922 return QoS(::rclcpp::QoS().keep_all());
923}
924
925} // namespace rclcpp
926
927#endif // NROS_RCLCPP_QOS_HPP
Definition client.hpp:129
rclcpp::ClockQoS — KEEP_LAST(1), BEST_EFFORT, VOLATILE. ADOPT.
Definition qos.hpp:886
constexpr ClockQoS()
Definition qos.hpp:888
Definition qos.hpp:867
constexpr ParameterEventsQoS()
Definition qos.hpp:869
Definition qos.hpp:855
constexpr ParametersQoS()
Definition qos.hpp:857
Definition qos.hpp:237
constexpr Duration lifespan() const
The lifespan window. Duration() (zero) = infinite.
Definition qos.hpp:378
constexpr Duration deadline() const
The deadline window. Duration() (zero) = infinite.
Definition qos.hpp:376
constexpr QoS & liveliness_lease_duration(const Duration &d)
Definition qos.hpp:323
constexpr QoS & keep_all()
Use KEEP_ALL history (bounded by transport).
Definition qos.hpp:290
constexpr QoS()
Definition qos.hpp:241
constexpr QoS & deadline(const Duration &d)
Definition qos.hpp:302
constexpr Duration liveliness_lease_duration() const
The liveliness lease window. Duration() (zero) = infinite.
Definition qos.hpp:380
constexpr bool tx_express() const
Whether this publisher's samples bypass transport tx batching.
Definition qos.hpp:388
constexpr QoS & best_effort()
Set reliability to BEST_EFFORT (fire-and-forget; default for sensors).
Definition qos.hpp:264
constexpr QoS & transient_local()
Set durability to TRANSIENT_LOCAL — late joiners get the last value.
Definition qos.hpp:270
constexpr QoS & lifespan(const Duration &d)
Definition qos.hpp:309
constexpr QoS & keep_last(int depth)
Definition qos.hpp:283
constexpr HistoryPolicy history() const
The history policy.
Definition qos.hpp:370
constexpr QoS & reliable()
Set reliability to RELIABLE (acked transport, retransmits on loss).
Definition qos.hpp:258
constexpr LivelinessPolicy liveliness() const
The liveliness policy kind.
Definition qos.hpp:372
constexpr DurabilityPolicy durability() const
The durability policy.
Definition qos.hpp:368
constexpr QoS & tx_express(bool on)
Definition qos.hpp:339
constexpr ReliabilityPolicy reliability() const
The reliability policy.
Definition qos.hpp:366
constexpr QoS & liveliness(LivelinessPolicy kind)
Definition qos.hpp:316
constexpr QoS & avoid_ros_namespace_conventions(bool on)
Definition qos.hpp:330
constexpr QoS & durability_volatile()
Set durability to VOLATILE — late joiners get nothing (default).
Definition qos.hpp:276
static constexpr QoS services()
Services profile: RELIABLE + VOLATILE + KEEP_LAST(10).
Definition qos.hpp:720
static constexpr QoS sensor_data()
Sensor-data profile: BEST_EFFORT + VOLATILE + KEEP_LAST(5).
Definition qos.hpp:717
constexpr QoS(::size_t depth)
Definition qos.hpp:253
constexpr bool avoid_ros_namespace_conventions() const
Whether to skip the /rt/ ROS topic-name prefix.
Definition qos.hpp:384
constexpr int depth() const
Configured queue depth (only meaningful for KEEP_LAST).
Definition qos.hpp:374
static constexpr QoS default_profile()
Default profile: RELIABLE + VOLATILE + KEEP_LAST(10).
Definition qos.hpp:714
Definition qos.hpp:880
constexpr RosoutQoS()
Definition qos.hpp:882
rmw_qos_profile_sensor_data — KEEP_LAST(5), BEST_EFFORT, VOLATILE. ADOPT.
Definition qos.hpp:838
constexpr SensorDataQoS()
Definition qos.hpp:840
Definition qos.hpp:847
constexpr ServicesQoS()
Definition qos.hpp:849
Definition qos.hpp:899
SystemDefaultsQoS()
Definition qos.hpp:901
Definition qos.hpp:790
static const bool value
Definition qos.hpp:800
constexpr Duration qos_window_duration(uint32_t ms)
Definition qos.hpp:211
constexpr QoS qos_from_ffi(const nros_cpp_qos_t &f)
Definition qos.hpp:693
constexpr uint32_t qos_window_ms(const Duration &d)
Definition qos.hpp:201
Definition rclcpp.hpp:75
constexpr bool operator==(const QoS &left, const QoS &right)
Definition qos.hpp:446
const char * rclc_qos_policy_kind_to_cstr(uint32_t policy)
constexpr bool operator!=(const QoS &left, const QoS &right)
Definition qos.hpp:460
const char * qos_policy_kind_to_cstr(uint32_t policy)
Definition qos.hpp:510
constexpr QoS KeepAll()
rclcpp::KeepAll(). Same ADOPT-BOUNDED note as KeepLast.
Definition qos.hpp:921
ReliabilityPolicy
Definition qos.hpp:136
@ Unknown
The backend could not determine this policy. An ABSENCE.
LivelinessPolicy
Definition qos.hpp:172
HistoryPolicy
History policy. Matches DDS HISTORY_QOS_POLICY.
Definition qos.hpp:157
@ Unknown
The backend could not determine this policy. An ABSENCE.
DurabilityPolicy
Durability policy. Matches DDS DURABILITY_QOS_POLICY.
Definition qos.hpp:147
@ Unknown
The backend could not determine this policy. An ABSENCE.
nros_cpp_qos_history_t
Definition qos.hpp:68
@ NROS_CPP_QOS_HISTORY_UNKNOWN
Definition qos.hpp:72
@ NROS_CPP_QOS_KEEP_LAST
Definition qos.hpp:69
@ NROS_CPP_QOS_KEEP_ALL
Definition qos.hpp:70
@ NROS_CPP_QOS_HISTORY_SYSTEM_DEFAULT
Definition qos.hpp:71
nros_cpp_qos_liveliness_t
Definition qos.hpp:74
@ NROS_CPP_QOS_LIVELINESS_MANUAL_BY_NODE
Definition qos.hpp:78
@ NROS_CPP_QOS_LIVELINESS_AUTOMATIC
Definition qos.hpp:76
@ NROS_CPP_QOS_LIVELINESS_UNKNOWN
Definition qos.hpp:79
@ NROS_CPP_QOS_LIVELINESS_MANUAL_BY_TOPIC
Definition qos.hpp:77
@ NROS_CPP_QOS_LIVELINESS_NONE
Definition qos.hpp:75
nros_cpp_qos_durability_t
Definition qos.hpp:62
@ NROS_CPP_QOS_DURABILITY_UNKNOWN
Definition qos.hpp:66
@ NROS_CPP_QOS_VOLATILE
Definition qos.hpp:63
@ NROS_CPP_QOS_TRANSIENT_LOCAL
Definition qos.hpp:64
@ NROS_CPP_QOS_DURABILITY_SYSTEM_DEFAULT
Definition qos.hpp:65
nros_cpp_qos_reliability_t
Definition qos.hpp:56
@ NROS_CPP_QOS_RELIABLE
Definition qos.hpp:57
@ NROS_CPP_QOS_RELIABILITY_UNKNOWN
Definition qos.hpp:60
@ NROS_CPP_QOS_BEST_EFFORT
Definition qos.hpp:58
@ NROS_CPP_QOS_RELIABILITY_SYSTEM_DEFAULT
Definition qos.hpp:59
Definition qos.hpp:81
enum nros_cpp_qos_durability_t durability
Definition qos.hpp:83
uint32_t liveliness_lease_ms
Definition qos.hpp:89
uint32_t lifespan_ms
Definition qos.hpp:88
enum nros_cpp_qos_history_t history
Definition qos.hpp:84
uint8_t tx_express
Definition qos.hpp:91
enum nros_cpp_qos_liveliness_t liveliness_kind
Definition qos.hpp:85
enum nros_cpp_qos_reliability_t reliability
Definition qos.hpp:82
uint8_t avoid_ros_namespace_conventions
Definition qos.hpp:90
uint32_t deadline_ms
Definition qos.hpp:87
int depth
Definition qos.hpp:86
F type
Definition qos.hpp:781
Definition qos.hpp:777
F type
Definition qos.hpp:778