pub struct QoSProfile {
pub history: QoSHistoryPolicy,
pub reliability: QoSReliabilityPolicy,
pub durability: QoSDurabilityPolicy,
pub liveliness_kind: QoSLivelinessPolicy,
pub depth: u32,
pub deadline_ms: u32,
pub lifespan_ms: u32,
pub liveliness_lease_ms: u32,
pub avoid_ros_namespace_conventions: bool,
pub tx_express: bool,
}Expand description
Full DDS-shaped QoS profile. Matches the field set of upstream
rmw_qos_profile_t.
Backends advertise per-policy support via
Session::supported_qos_policies; entities created with a
profile the active backend can’t honour return
TransportError::IncompatibleQos synchronously at create time
— no silent downgrade.
Zero-valued time-window fields (“off”) mean infinite — the policy is effectively disabled for the entity.
Fields§
§history: QoSHistoryPolicyHistory policy
reliability: QoSReliabilityPolicyReliability policy
durability: QoSDurabilityPolicyDurability policy
liveliness_kind: QoSLivelinessPolicyLiveliness policy
depth: u32History depth (only used if history is KeepLast)
deadline_ms: u32Subscription max-inter-arrival / publisher offered-rate, ms.
0 = infinite (no deadline check).
lifespan_ms: u32Sample expiry, ms. Subscribers filter samples older than this.
0 = infinite (no expiry).
liveliness_lease_ms: u32Liveliness lease, ms. 0 = infinite.
avoid_ros_namespace_conventions: boolIf true, topic-name encoding skips the /rt/ ROS prefix.
tx_express: boolPhase 282 (#145) — publisher-side “express” hint: this publisher’s samples bypass transport tx batching (zenoh: the wire EXPRESS flag; a batching zenoh-pico session sends them immediately instead of queueing them for the next flush). A transport hint, not a DDS policy — no RxO matching, no backend-compat validation; ignored by subscriptions and by backends without a batching concept.
Implementations§
Source§impl QoSProfile
impl QoSProfile
Sourcepub fn apply_overrides(
self,
topic: &str,
role: QoSOverrideRole,
overrides: &[QoSOverride],
) -> Self
pub fn apply_overrides( self, topic: &str, role: QoSOverrideRole, overrides: &[QoSOverride], ) -> Self
Phase 211.H — fold the plan’s qos_overrides matching topic + role
into this profile, returning the overridden profile. Setup-time only
(called from create_publisher/create_subscription): a single linear
scan over the baked &'static table, no alloc, RT-safe. Later entries
win on a duplicate (topic, role, policy) (last-write), matching the
planner’s sorted, de-conflicted emit. Non-matching entries are ignored,
so passing the whole node table to every entity is cheap + correct.
Sourcepub fn apply_override_value(&mut self, value: QoSOverrideValue)
pub fn apply_override_value(&mut self, value: QoSOverrideValue)
Issue 0303 — apply ONE decoded override value. The single place a
policy maps to the field it sets; apply_overrides and the FFI folds
both go through it, so a new policy cannot reach some paths only.
Sourcepub fn apply_override_codes(
self,
topic: &str,
role: QoSOverrideRole,
codes: &[QoSOverrideCode],
) -> Self
pub fn apply_override_codes( self, topic: &str, role: QoSOverrideRole, codes: &[QoSOverrideCode], ) -> Self
Issue 0303 — fold baked QoSOverrideCodes for one (topic, role).
Unrecognised codes are skipped; the producers reject them at BAKE time
(nros_orchestration_ir::qos_override), so a code reaching here that
this build does not know is an older image running newer data, not a
user error to diagnose at runtime.
Source§impl QoSProfile
impl QoSProfile
Sourcepub const BEST_EFFORT: Self
pub const BEST_EFFORT: Self
Best-effort QoS (for real-time)
Sourcepub const QOS_PROFILE_SYSTEM_DEFAULT: Self
pub const QOS_PROFILE_SYSTEM_DEFAULT: Self
rmw_qos_profile_system_default — an absence, not a profile.
issue 0829. Every field is the sentinel: upstream’s constant names no
concrete policy at all, and the two reference RMWs fill the absence with
different numbers — rmw_cyclonedds_cpp’s create_readwrite_qos folds
RMW_QOS_POLICY_DEPTH_SYSTEM_DEFAULT to KEEP_LAST(1), while
rmw_zenoh_cpp’s QoS::QoS() fills it from
RMW_ZENOH_DEFAULT_HISTORY_DEPTH, which is 42, over a comment stating
the contract outright: “If the depth field in the qos profile is set to
0, the RMW implementation has the liberty to assign a default depth.”
So no baked number can be right. This carried a concrete
Reliable / Volatile / KeepLast(1) until 2026-09-03, and
nros::qos::SYSTEM_DEFAULT carried a concrete depth 10, which is how
one name shipped two queue depths. Both are gone; the backend resolves
this at its create entry via QoSProfile::resolve_system_default.
liveliness_kind is QoSLivelinessPolicy::None, which IS the
sentinel on that policy — it lowers to
NROS_RMW_LIVELINESS_SYSTEM_DEFAULT (0), the two having collapsed onto
one value in phase-376 W5/B2.
Sourcepub const QOS_PROFILE_DEFAULT: Self
pub const QOS_PROFILE_DEFAULT: Self
Default QoS profile (matches rmw_qos_profile_default)
Sourcepub const QOS_PROFILE_SENSOR_DATA: Self
pub const QOS_PROFILE_SENSOR_DATA: Self
Sensor data QoS profile (matches rmw_qos_profile_sensor_data)
Sourcepub const QOS_PROFILE_SERVICES_DEFAULT: Self
pub const QOS_PROFILE_SERVICES_DEFAULT: Self
Services default QoS profile (matches rmw_qos_profile_services_default)
Sourcepub const QOS_PROFILE_PARAMETERS: Self
pub const QOS_PROFILE_PARAMETERS: Self
Parameters QoS profile (matches rmw_qos_profile_parameters)
Mirrors rmw_qos_profile_parameters: KEEP_LAST(1000), RELIABLE,
VOLATILE.
issue 0793 — this said TransientLocal until 2026-08-25, disagreeing
both with upstream (/opt/ros/<distro>/include/rmw/rmw/qos_profiles.h)
and with our own second copy of the same profile, nros::qos::PARAMETERS,
which was already correct. Two copies of one profile that disagree is the
defect; the wrong one being the one named after the upstream constant is
what made it hard to see.
Sourcepub const QOS_PROFILE_CLOCK: Self
pub const QOS_PROFILE_CLOCK: Self
Clock QoS profile - same as sensor data but with depth 1
Sourcepub const QOS_PROFILE_PARAMETER_EVENTS: Self
pub const QOS_PROFILE_PARAMETER_EVENTS: Self
Parameter events QoS profile (matches rmw_qos_profile_parameter_events)
Sourcepub const QOS_PROFILE_ACTION_STATUS_DEFAULT: Self
pub const QOS_PROFILE_ACTION_STATUS_DEFAULT: Self
Action status default QoS profile (matches rcl_action_qos_profile_status_default)
Sourcepub const QOS_PROFILE_PX4: Self
pub const QOS_PROFILE_PX4: Self
PX4 companion QoS profile (Phase 233 / RFC-0039 Track B). Matches the
QoS PX4’s uxrce_dds_client uses on /fmu/out/* and /fmu/in/* —
BEST_EFFORT + VOLATILE + KEEP_LAST(1). A nano-ros node talking to
the same MicroXRCEAgent must use this (a reliable or
TRANSIENT_LOCAL reader will not match PX4’s volatile best-effort
writers). Verified against real PX4 SITL (nros-px4-sitl-test):
TRANSIENT_LOCAL durability silently fails to match /fmu/out/*.
Adjust depth via .keep_last(n) for higher-rate streams.
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Create new QoS settings with defaults (matches QOS_PROFILE_DEFAULT:
Reliable, Volatile, KeepLast(10)).
Sourcepub const fn topics_default() -> Self
pub const fn topics_default() -> Self
Get the default QoS profile for ordinary topics
Sourcepub const fn px4() -> Self
pub const fn px4() -> Self
The PX4 companion QoS profile (QOS_PROFILE_PX4)
— use for /fmu/out/* subscriptions and /fmu/in/* publications against
a MicroXRCEAgent.
Sourcepub const fn sensor_data_default() -> Self
pub const fn sensor_data_default() -> Self
Get the default QoS profile for sensor data topics
Sourcepub const fn services_default() -> Self
pub const fn services_default() -> Self
Get the default QoS profile for services
Sourcepub const fn parameters_default() -> Self
pub const fn parameters_default() -> Self
Get the default QoS profile for parameter services
Sourcepub const fn parameter_events_default() -> Self
pub const fn parameter_events_default() -> Self
Get the default QoS profile for parameter events
Sourcepub const fn system_default() -> Self
pub const fn system_default() -> Self
Get the system default QoS profile
Sourcepub const fn action_status_default() -> Self
pub const fn action_status_default() -> Self
Get the default QoS profile for action status topics
Sourcepub const fn clock_default() -> Self
pub const fn clock_default() -> Self
Get the default QoS profile for clock topics
Sourcepub const fn best_effort(self) -> Self
pub const fn best_effort(self) -> Self
Set reliability to best-effort
Sourcepub const fn transient_local(self) -> Self
pub const fn transient_local(self) -> Self
Set durability to transient local
Sourcepub const fn reliability(self, policy: QoSReliabilityPolicy) -> Self
pub const fn reliability(self, policy: QoSReliabilityPolicy) -> Self
Set reliability policy explicitly
Sourcepub const fn durability(self, policy: QoSDurabilityPolicy) -> Self
pub const fn durability(self, policy: QoSDurabilityPolicy) -> Self
Set durability policy explicitly
Sourcepub const fn history(self, policy: QoSHistoryPolicy) -> Self
pub const fn history(self, policy: QoSHistoryPolicy) -> Self
Set history policy explicitly
Sourcepub const fn tx_express(self, express: bool) -> Self
pub const fn tx_express(self, express: bool) -> Self
Phase 282 (#145) — mark this publisher’s samples “express”: they 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.
Sourcepub const fn history_depth(&self) -> u8
pub const fn history_depth(&self) -> u8
Get history depth (for backwards compatibility)
Source§impl QoSProfile
impl QoSProfile
Sourcepub fn required_policies(&self) -> QoSPolicyMask
pub fn required_policies(&self) -> QoSPolicyMask
Compute the set of QoS policies actually requested by this profile.
Zero-valued time fields and LivelinessKind::None count as “not
requesting” the corresponding policy — the cheap default.
issue 0829 — the four CORE bits (reliability, durability, history,
depth) used to be added UNCONDITIONALLY, on the reasoning that every
nano-ros backend honours them. That is true and still not the right
test: this function answers what did the caller ASK FOR, and a
SYSTEM_DEFAULT policy asks for nothing. Starting from CORE made
QOS_PROFILE_SYSTEM_DEFAULT demand all four, so a backend that could
not honour one would reject the profile with IncompatibleQos — for
requesting nothing. The pattern was already here for the extended
policies three lines down (a zero deadline_ms declines its bit); it
just never reached the four CORE ones.
This RELAXES the mask, so it can only turn a rejection into an
acceptance, never the reverse — and it flips no verdict today: every
supported_qos_policies impl in the tree returns at least CORE
(traits.rs default impl, nros-node/src/mock.rs:259,
nros-rmw-cffi/src/lib.rs:2580, nros-rmw-zenoh/src/shim/session.rs:1245),
so a CORE bit has never been the reason for a failure.
Sourcepub fn validate_against(
&self,
supported: QoSPolicyMask,
) -> Result<(), TransportError>
pub fn validate_against( &self, supported: QoSPolicyMask, ) -> Result<(), TransportError>
Returns Err(TransportError::IncompatibleQos) if any policy this
profile requires is missing from the backend’s supported mask.
Used at entity-create time to enforce the no silent
degradation contract.
Sourcepub const fn resolve_system_default(self, defaults: &QoSSystemDefaults) -> Self
pub const fn resolve_system_default(self, defaults: &QoSSystemDefaults) -> Self
Replace every SYSTEM_DEFAULT field with the backend’s own answer.
issue 0829 — a backend calls this at its create entry, before
anything is derived from the profile (see QoSSystemDefaults for why
the ordering matters on the zenoh path). Fields the caller DID state
are left exactly as they are: this resolves an absence, it never
overrides a request.
Idempotent, and safe to call on a fully concrete profile — a profile with no sentinel in it is returned unchanged.
Sourcepub const fn has_unresolved_system_default(&self) -> bool
pub const fn has_unresolved_system_default(&self) -> bool
true if any field is still the SYSTEM_DEFAULT sentinel.
Depth is deliberately NOT part of this test: a KEEP_ALL profile
legitimately carries depth 0 forever (QOS_PROFILE_PARAMETER_EVENTS),
and a backend that resolves the sentinel depth to 0 — XRCE does, on
purpose — leaves a resolved profile reading 0 here. This asks about the
three POLICY fields, where the sentinel is a distinct variant and so
cannot be confused with a stated value.
Trait Implementations§
Source§impl Clone for QoSProfile
impl Clone for QoSProfile
Source§fn clone(&self) -> QoSProfile
fn clone(&self) -> QoSProfile
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for QoSProfile
Source§impl Debug for QoSProfile
impl Debug for QoSProfile
Source§impl Default for QoSProfile
impl Default for QoSProfile
impl Eq for QoSProfile
Source§impl PartialEq for QoSProfile
impl PartialEq for QoSProfile
Source§fn eq(&self, other: &QoSProfile) -> bool
fn eq(&self, other: &QoSProfile) -> bool
self and other values to be equal, and is used by ==.