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 level_liveness::MAX_LEVELS;pub use level_liveness::every_level_alive;pub use level_liveness::level_count;pub use level_liveness::level_last_spin_us;pub use level_liveness::level_spins;pub use level_liveness::set_level_count;pub use level_liveness::take_every_level_alive;pub use level_liveness::tier_level;pub use level_liveness::tier_level_by;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::TimerCallInfo;pub use crate::timer::TimerClockSource;pub use node_record::NodeBuilder;pub use node_record::NodeId;pub use node_record::NodeRecord;pub use launch_remap::BadLaunchRemap;pub use launch_remap::LaunchRemap;pub use launch_remap::launch_remaps;pub use launch_remap::set_launch_remaps;pub use session_props::BadSessionProperties;pub use session_props::MAX_SESSION_PROPERTIES;pub use session_props::SessionProperty;pub use session_props::lent_session_properties;pub use session_props::session_properties;pub use session_props::set_session_properties;pub use session_props::with_session_properties;
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.
- exec_
lock - phase-509 P9b – the executor’s lock (RFC-0108 “As built in P9b”). phase-509 P9b item 1 (RFC-0108 “As built in P9b”) – the executor’s lock.
- ffi
- phase-515 R9 (decision D4) – the sealed trait the C/C++ shims import for the
executor’s FFI entry points.
nrosdoes not re-export it. The executor’s FFI surface (phase-515 R9, decision D4). - launch_
remap - Launch remap rules as ONE const table in flash – issue 1971, RFC-0107 step 1.
- level_
liveness - phase-509 P7 (RFC-0108 D8.1, D8.2) – which level an executor is, and whether every level of the image is alive.
- 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. - session_
props - A bringup’s own RMW session configuration, baked into the image as ONE const table – RFC-0109 D8, phase-514 W3.
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). - Band
- A contiguous range of dispatch levels, inclusive at both ends; level 0 is the most urgent.
- Band
Waiter - phase-509 P9b item 3 (RFC-0108 D7, “As built in P9b”) – a band worker’s
wake object and the slots it answers for. The transport’s arrival path
reads it without the executor’s lock, so it is
'staticand its fields are atomics or fixed at construction; it is linked into the executor’s arrival routing byExecutor::attach_band_workerand never unlinked. - Band
Worker - phase-509 P9b item 2 (RFC-0108 “As built in P9b”) – a worker of one band
over an executor it shares with other workers: the record its own thread
owns and hands to
Executor::spin_band_once. - 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.
- 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. - RawRequest
Id - Issue 2081 — upstream
rmw_request_id_t, as a C or C++ request-id service callback receives it (RawServiceRequestIdCallback). - 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, which its self-registration calls) and the locator + domain id to open against it. - Shutdown
Callback Handle - Handle to a registered shutdown hook, returned by
ExecutorFfi::add_pre_shutdown_callback/ExecutorFfi::add_on_shutdown_callback(the FFI trait inexecutor::ffi) and 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.
- Remap
Refused - Why
Executor::declare_remaprefused a rule – never a silently dropped routing rule. - 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).
- ENTRY_
IDLE_ BUDGET - phase-521 W6 (RFC-0113 D2) — the longest park an entry asks for when every source of work can end it early: 60 s.
- ENTRY_
POLL_ BUDGET - phase-521 W6 — the budget an entry keeps while some source of work cannot
end its wait: 10 ms, the cadence every entry had before. See
Executor::entry_spin_budget. - 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. - INLINE_
BACKING_ U64S - Issue 1970 – the inline backing’s length in
u64words. - INLINE_
SIZING - Issue 1970 – the sizing an inline backing is carved at: the image’s
(
ExecutorSizing::DEFAULT), orNoneon an image whose executors are sized per tier (crate::config::TIER_SIZINGSis non-empty). There the inline backing is EMPTY – one whole-image backing per tier context is the cost this issue removes – and an executor opened over a context alone (rclc_executor_init,nros_cpp_init) is refused, naming the per-tier road, rather than carved short. - 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.
- PARK_
EXPIRED ParkUntilFn: the deadline expired (NROS_PLATFORM_PARK_EXPIRED).- PARK_
SIGNALLED ParkUntilFn: woken by an event (NROS_PLATFORM_PARK_SIGNALLED).- PARK_
YIELDED ParkUntilFn: the slot handed the wait to its framework’s scheduler and returned without waiting (NROS_PLATFORM_PARK_YIELDED);spin_oncereturns without dispatching. SeeParkUntilFn.- 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)]. - levels_
backing_ bytes - phase-509 P9b item 4 – the backing bytes
levels_executor_sizingcarves,0on an image that sizes no tier. Whatnros::sizes::LEVELS_BACKING_SIZEpublishes to the C/C++ header. - levels_
executor_ sizing - phase-509 P9b item 4 (RFC-0108 “As built in P9b”) – the sizing of the
ONE executor a level runner opens per core: every level’s callbacks, nodes,
arena and declared parameters, summed over the image’s tiers (each row of
the tier table is one level).
Nonewhen the image sizes no tier. - tier_
backing_ bytes - Issue 1970 – the backing bytes the
index-th tier’s executor carves,0past the last tier. Whatnros::sizes::TIER_BACKING_SIZE_<i>publishes to the C/C++ header. - tier_
executor_ sizing - Issue 1970 – the
ExecutorSizingone tier’s executor is carved at: its own callback slots, node slots, arena and declared parameters, and the image’s scheduling-context count. A tier that declares parameters on an image that carves no store carves none either (the store is built from the heap there, as it is for the image’s one executor). - tier_
sizing - Issue 1970 – the sizing of the tier named
name,Nonewhen the image sizes no tier of that name.
Type Aliases§
- Band
Wait Fn - phase-509 P9b item 3 – how a band worker waits on its own wake object:
at most
usmicroseconds, returning early when the object is signalled (WorkerWakeFn). The answer is ignored: either way the worker re-scans. - Defer
Notify - Issue 2146 (RFC-0112 D2, Defer) – the notifier
Executor::set_defer_notifierinstalls: called with the host’s context and theHandleIdof a deferred callback that has just been queued. - 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.
- RawCancel
Response Callback - Raw action client cancel-response callback — issue 2030.
- 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.
- RawResponse
Request IdCallback - Issue 2136 —
RawResponseCallbackthat also receives the id of the request the reply answers, as rclc’srclc_client_callback_with_request_id_tdoes. - RawResult
Callback - Raw action client result callback.
- RawService
Callback - Raw service callback that receives and produces CDR bytes.
- RawService
Request IdCallback - Issue 2081 —
RawServiceCallbackthat also receives the request’sRawRequestId— rclc’srclc_service_callback_with_request_id_targument order (request, request id, response), in 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 the bridge_origin tag 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.
- Wake
Hook Fn - Issue 2225 (RFC-0113 D9) – the wake half of a framework’s park slot: called after every signal of the executor’s wake object, from the signalling context. A framework whose tier is a scheduled item rather than a parked thread (a PX4 work item) re-schedules the tier here. Must be thread-safe, non-blocking and O(1).
- Worker
Wake Fn - How a scheduler signals a worker’s wake object (
NodeWakeon a real port; a mock kernel in the tests).