Expand description
Embedded executor with build-time configured arena.
Provides Executor and Node that work with the compile-time
selected RMW backend (zenoh, XRCE-DDS, or C FFI).
§Example
ⓘ
use nros_node::executor::*;
use std_msgs::msg::Int32;
let config = ExecutorConfig::from_env().node_name("my_node");
let mut executor = Executor::open(&config)?;
let mut node = executor.create_node("my_node")?;
let publisher = node.create_publisher::<Int32>("/chatter")?;
publisher.publish(&Int32 { data: 42 })?;
loop {
executor.spin_once(core::time::Duration::from_millis(10));
}Re-exports§
pub use action::ActionClientRawHandle;pub use action::ActionServerHandle;pub use action::ActionServerRawHandle;pub use action::RawActionClientSpec;pub use action::RawActionServerSpec;pub use action_core::ActionClientCore;pub use action_core::ActionServerCore;pub use action_core::RawActiveGoal;pub use action_core::action_channel_type;pub use crate::timer::TimerClockSource;pub use node_record::NodeBuilder;pub use node_record::NodeId;pub use node_record::NodeRecord;
Modules§
- action
- Action server and client registration on the executor and handle types.
- action_
core - Type-agnostic action protocol core types.
- arena_
oracle - phase-412 #4 — the arena’s HOST ORACLE, held to at compile time.
- declared_
shape - phase-457 W5 (issue 1522) — which registration entry point a DECLARED subscription reaches, as ONE value.
- monitor
- RFC-0052 / phase-296 W3b.4/.5 — on-target contract monitors.
- node_
record - Phase 104.C.2 — multi-Node-per-Executor storage.
- port_
park - phase-436 W7 — installing a port’s park primitive, with the wake-object constraint stated once instead of per board. phase-436 W7 — installing a port’s park primitive, in one place.
- sched_
context - Phase 110.B —
SchedContextAPI + supporting types.
Structs§
- Action
Client - Typed action client handle.
- Action
Client Callback - Send handle for a callback-based typed action client.
- Action
Server - Typed action server with goal state management.
- Active
Goal - Active goal tracking for action server.
- Baked
Boot Config - Build-time-baked boot config, emitted (in W4b) into the
.nros_boot_configlinker section by the entry macro / cmake. Fixed-size + pointer-free so a future post-link tool can patch it in place (RFC-0045). The resolver reads it on embedded viaBootConfig::from_baked(innros-node). - Boot
Config - Session-identity subset a caller supplies to
ExecutorConfig::resolve. - Callback
Group - A first-class callback group — a name-only token (rclcpp/rclrs shape).
- Completed
Goal - Completed goal with result.
- Embedded
Publisher - Typed publisher handle.
- Embedded
RawPublisher - Typeless publisher handle. Use when the wire format is not ROS CDR (e.g. PX4 uORB raw POD bytes, custom binary protocols).
- Embedded
Service Client - Typed service client handle with internal buffers.
- Embedded
Service Server - Typed service server handle with internal buffers.
- EnvRung
- The environment rung of precedence model A, as VALUES.
- Executor
- Executor
Config - Configuration for opening an embedded executor session.
- Executor
Inline Storage - The exact
#[repr(C)]byte layout the C/C++ FFI’s inline executor buffer must hold: anExecutor<'static>header immediately followed by a default-sized (ExecutorSizing::DEFAULT) storage backing. - Executor
Sizing - Per-entry executor sizing — the entity counts an
Executoris built to hold. Public + non-generic (the “C/C++ is a thin wrapper” principle): the entry / macro / FFI supplies these as plainusizes rather than as type/const generics C can’t name. Used to size + carve the backing. - Feedback
Stream - A stream of feedback messages from an action server.
- Goal
Feedback Stream - A goal-filtered feedback stream.
- Guard
Condition - Handle for triggering a guard condition from outside the executor.
- Handle
Id - Opaque handle identifier returned by registration methods.
- Handle
Set - A set of handle IDs, represented as a bitset.
- Loan
Future - Future returned by
EmbeddedRawPublisher::loan. Phase 99.H’ cancellation-safe variant: if dropped before resolving, it wakes the next pending waiter so the busy-flag-clear signal isn’t lost to the cancelled task. - Node
- A ROS 2 node — rclrs’s
Node, and the ONE node type (phase-483 W2). - Node
Handle - Backend-agnostic node — borrows the session to create typed entities.
- Promise
- A pending reply from a non-blocking service or action call.
- Publish
Loan - Writable loan into a
EmbeddedRawPublisher’s slot. - RawService
Client - Typeless service-client handle. L1 counterpart of
EmbeddedServiceClientfor the same audience asRawServiceServer. - RawService
Server - Typeless service-server handle. L1 counterpart of
EmbeddedServiceServerfor callers that own their own scheduler (RTIC, embassy, FreeRTOS-task-per-entity) and the C / C++ FFI shims. - RawSubscription
- Typeless subscription handle. Counterpart of
EmbeddedRawPublisher. - Readiness
Snapshot - Snapshot of handle readiness at the start of a spin iteration.
- Recv
View - Read-only view into a
RawSubscription’s receive buffer. - Region
Unit - The placement arithmetic and its data types live in
nros-executor-layout(issue 1197) so a HOST build script can evaluate them for a target it is not compiling. Re-exported here because this is where every consumer already looks, and becauseNATIVE— the only part that names the types — has to live in the crate that owns them. Size and alignment of one region’s element type. - Region
Units - The placement arithmetic and its data types live in
nros-executor-layout(issue 1197) so a HOST build script can evaluate them for a target it is not compiling. Re-exported here because this is where every consumer already looks, and becauseNATIVE— the only part that names the types — has to live in the crate that owns them. Every element type the backing carves a table of, in declaration order. - Service
Client Callback - Send handle for a callback-based typed service client.
- Session
Handle - Phase 228.E — an opaque,
Sendhandle to anExecutor’s RMW session. - Session
Spec - Phase 128.F.1 — per-backend session declaration for
Executor::open_multi. Each spec names an RMW backend (must match one a backend registered under vianros_rmw_cffi_register_named/ theRMW_INIT_ENTRIESlinker section) and the locator + domain id to open against it. - Shutdown
Callback Handle - Handle to a registered shutdown hook, returned by
Executor::add_pre_shutdown_callback/Executor::add_on_shutdown_callbackand consumed by the matchingremove_*. rclcpp’sPreShutdownCallbackHandle/OnShutdownCallbackHandle. - Spin
Once Result - Result of a single spin iteration
- Spin
Options - Options controlling a blocking spin loop — rclrs’s
SpinOptions. - Spin
Period Polling Result - Result from a single period of polling execution (
no_stdcompatible). - Spin
Period Result - Result from a single period with monotonic-clock measurement.
- Subscription
- Typed subscription handle with internal receive buffer.
- Tier
Backing Short - issue 1571 — the tier backing a board was handed does not cover the tiers it must spawn. Carries both counts so the refusal names them.
- Tier
Executor Backing - issue 1571 — the spawned tiers’ executor backing,
Nslots in ONE named static that the ENTRY owns. - Tier
Setup Gate - Issue 1733 — the ONE gate a tier runner holds across each tier’s
open-and-
setupso no two tiers declare entities on the shared session at once. - Tier
Setup Guard - Issue 1733 — proof of holding a
TierSetupGate; dropping it opens the gate. - Tier
Task Memory - issue 1598 — one spawned tier’s stack and control block, as ONE named static
the entry owns.
STACK_U64Sis the tier’s stack in 8-byte words;TCB_U64Sthe control-block region,TIER_TASK_TCB_U64Sby default and0for a kernel whose control block the port keeps itself (Zephyr’sstruct k_thread, issue 1232 — a Rust entry cannot size it). - Tier
Task Memory Raw - issue 1598 — one spawned tier’s task memory as a board receives it: raw,
Copy, no lifetime. The ENTRY owns the bytes (TierTaskMemory); the handout is once-only (TierTaskMemorySet::take), which is what makes the raw pointers exclusive. - Tier
Task Memory Set - issue 1598 — the spawned tiers’ task memory,
Nrows in spawn (chain) order, behind a once-only latch.
Enums§
- Bind
Error - RFC-0045 / issue #206 — boot-config resolution error. Malformed or
out-of-range identity input (env or baked) is an ERROR, never a silent
fallback: a typo’d
ROS_DOMAIN_IDmust not invisibly move a node to domain 0 (the pre-#206 C++ behavior) or be silently ignored (the pre-#206 behavior of this resolver). Why a filter or sched binding could not be recorded. - Boot
Config Error - Executor
Semantics - Data communication semantics for the executor.
- Invocation
Mode - Per-callback invocation mode.
- Loan
Error - Error type for
EmbeddedRawPublisher::try_loan. - Node
Error - Error type for generic embedded node operations.
- Server
Visibility - Issue 1686 — what a server-readiness probe answered, read the way a WAIT loop must read it.
- Shutdown
Phase - Which of the two ordered shutdown phases a hook belongs to.
- Timer
Overrun Policy - What a periodic timer does with periods it missed while its executor was blocked (issue #505).
- Trigger
- Executor-level trigger condition.
- Wake
Source Id - phase-436 — which deadline source bounded the last park.
Constants§
- BOOT_
SET_ DOMAIN - Bit 2 —
domain_idfield is set. - BOOT_
SET_ LOCATOR - Bit 1 —
locatorfield is set. - BOOT_
SET_ NAMESPACE - Bit 3 —
namespacefield is set. - BOOT_
SET_ NODE_ NAME - Bit 0 —
node_namefield is set. - BOOT_
SET_ RMW - Bit 4 —
rmwfield is set (issue 1050 defect (3); layout version 2). - DEFAULT_
LOAN_ BUF - Default size of each per-publisher arena slot, in bytes.
- DEFAULT_
SPIN_ POLL_ INTERVAL - Default per-iteration budget handed to
spin_onceby the spin loops. - DOMAIN_
ID_ EXPLICIT_ ZERO_ C_ ABI - Issue #227 — C/C++-ABI escape for an EXPLICIT domain 0.
- DOMAIN_
ID_ MAX - RFC-0045 / issue #206 — maximum valid ROS 2 domain ID. The ROS 2 / DDS convention (RTPS port arithmetic) caps usable domains at 232; values above it are a configuration error in EVERY language front-end (never a silent clamp or silent 0). Mirrored into the generated C header — keep the mirror in sync (the #160 drift class).
- EXECUTOR_
BACKING_ DEFAULT_ U64S - The reservation’s size when nothing overrides it: one default-sized executor’s worth.
- HANDLE_
SLOT_ BITS - Bits of a packed
HandleIdthat hold the slot index. - MAX_
WAKE_ SOURCES - How many platform sources one executor can carry. A plain const, not a sizing knob: the table is inline, so no allocator is required on the no_std targets this seam mainly exists for.
- NROS_
BOOT_ CONFIG_ MAGIC - 0x4E524243 = ASCII “NRBC”. A post-link tool scans for this magic to locate the struct in a firmware image.
- NROS_
BOOT_ CONFIG_ VERSION - Layout version — lets the resolver reject a mismatched baked struct.
- RMW_
SELECTOR_ CAP - Capacity of a backend selector name, matching
Executor::primary_rmw_name. - TIER_
TASK_ TCB_ U64S - issue 1598 — the control-block region every
TierTaskMemorycarries, in 8-byte words. An UPPER BOUND over the kernels that take it (a FreeRTOSStaticTask_ton Cortex-M is about a hundred bytes); the port REFUSES a region smaller than its own control block at spawn, by name, so a kernel whose block outgrows this fails loudly rather than overrunning the stack that follows. Rust cannot name a C type’s size at macro time, which is why this one number is a bound and the stack beside it is exact.
Functions§
- baked_
domain_ from_ c_ abi - Map the C/C++ ABI’s
u8domain argument onto the resolver’s baked rung. - check_
tier_ executor_ backing - issue 1571 — the ONE refusal every board’s
run_tiersmakes before it opens anything:n_tierstiers run, one on the boot executor, son_tiers - 1must each find a slot. Checked up front rather than at each spawn, so a short block never leaves a half-spawned tier chain. - default_
epoch_ us - RFC-0052 W3b.2 — the default wall-clock source: µs since the UNIX epoch.
- default_
epoch_ us_ fn - The default wall clock, or
Nonewhen this build has neither a platform port nor a host to ask. - epoch_
us_ to_ stamp - RFC-0052 W3b.3 — split epoch-µs into the
builtin_interfaces/Timefield pair(sec, nanosec)forheader.stamppopulation. Types-free (each workspace has its own generatedTime); assign the tuple to the struct’s fields. - executor_
storage_ layout - Byte
Layoutof the backing asizing-sized executor needs. Public + non-generic so the macro / FFI can size a raw backing. - executor_
storage_ layout_ with - Byte
Layoutof the backing, evaluated against a SUPPLIED unit table. - executor_
storage_ u64_ len - Number of
u64words a backing must hold for asizing-sized executor.u64backing is 8-aligned, which covers every field (allalign_of ≤ 8; asserted in tests), so the entry never hand-aligns. The macro emits[MaybeUninit<u64>; executor_storage_u64_len(sizing)].
Type Aliases§
- Next
Deadline Fn - When this source will next need the executor, in the executor’s clock, as microseconds FROM NOW.
- Park
Until Fn - Park until
deadline_usfrom now, or until something signals, whichever comes first. - RawAccepted
Callback - Raw accepted-goal hook.
- RawCancel
Callback - Raw action cancel callback.
- RawFeedback
Callback - Raw action client feedback callback.
- RawGoal
Callback - Raw action goal callback that receives CDR bytes without deserialization.
- RawGoal
Response Callback - Raw action client goal-response callback.
- RawMessage
Deserialize Fn - phase-417 W5.a — the deserialiser half of the TYPED C subscription path.
- RawResponse
Callback - Raw service-client response callback.
- RawResult
Callback - Raw action client result callback.
- RawService
Callback - Raw service callback that receives and produces CDR bytes.
- RawSubscription
Callback - Raw subscription callback that receives CDR bytes without deserialization.
- RawSubscription
Info Callback - Raw subscription callback that also receives the incoming sample’s
wire-level attachment (Phase 189.M3.4 — the C analog of the Rust
FnMut(&[u8], &RawMessageInfo)builder path).attachmentis valid forattachment_lenbytes during the call;attachment_len == 0means the sample carried no attachment. Cross-RMW bridges read thebridge_origintag from it. - Shutdown
Callback Fn - A shutdown hook:
extern "C"so the same slot serves Rust, C and C++ without a second registry, and so no allocator is involved. - Tier
Executor Backing Slot - issue 1571 — one spawned tier executor’s backing: exactly the words an
executor opened with
ExecutorSizing::DEFAULTcarves. - Typed
Subscription Callback - phase-417 W5.a — a subscription callback that receives the DESERIALISED message rather than its CDR bytes.