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::sched_task_level;pub use level_liveness::sched_task_level_by;pub use level_liveness::set_level_count;pub use level_liveness::take_every_level_alive;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 - The arena’s HOST ORACLE, held to at compile time.
- declared_
shape - Which registration entry point a DECLARED subscription reaches, as ONE value.
- exec_
lock - The executor’s lock. The executor’s lock.
- ffi
- 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. - launch_
remap - Launch remap rules as ONE const table in flash – the first step toward one executor core per image.
- level_
liveness - Which level an executor is, and whether every level of the image is alive.
- monitor
- On-target contract monitors.
- node_
record - Multi-Node-per-Executor storage.
- port_
park - Installing a port’s park primitive, with the wake-object constraint stated once instead of per board. Installing a port’s park primitive, in one place.
- sched_
context SchedContextAPI + supporting types.- session_
props - A bringup’s own RMW session configuration, baked into the image as ONE const table.
- trace_
marker - Application trace markers: one
(marker_id, arg)event that the APPLICATION places, emitted through the same installed sink the executor’s own callback events go to.
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 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. 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 - 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 - 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. - 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 - 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-layoutso 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-layoutso 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. - Sched
Task Backing Short - The sched task backing a board was handed does not cover the sched tasks it must spawn. Carries both counts so the refusal names them.
- Sched
Task Executor Backing - The spawned sched tasks’ executor backing,
Nslots in ONE named static that the ENTRY owns. - Sched
Task Memory - One spawned sched task’s stack and control block, as ONE named static
the entry owns.
STACK_U64Sis the sched task’s stack in 8-byte words;TCB_U64Sthe control-block region,SCHED_TASK_TCB_U64Sby default and0for a kernel whose control block the port keeps itself (Zephyr’sstruct k_thread— a Rust entry cannot size it). - Sched
Task Memory Raw - One spawned sched task’s RTOS task memory as a board receives it: raw,
Copy, no lifetime. The ENTRY owns the bytes (SchedTaskMemory); the handout is once-only (SchedTaskMemorySet::take), which is what makes the raw pointers exclusive. - Sched
Task Memory Set - The spawned sched tasks’ task memory,
Nrows in spawn (chain) order, behind a once-only latch. - Sched
Task Setup Gate - The ONE gate a tier runner holds across each tier’s
open-and-
setupso no two sched tasks declare entities on the shared session at once. - Sched
Task Setup Guard - Proof of holding a
SchedTaskSetupGate; dropping it opens the gate. - Service
Client Callback - Send handle for a callback-based typed service client.
- Session
Handle - An opaque,
Sendhandle to anExecutor’s RMW session. - Session
Spec - 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.
Enums§
- Bind
Error - 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 older C++ behavior) or be silently ignored (the older 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 - 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.
- Trigger
- Executor-level trigger condition.
- Wake
Source Id - 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 (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 - C/C++-ABI escape for an EXPLICIT domain 0.
- DOMAIN_
ID_ MAX - 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 (a drifted copy is a real bug class).
- ENTRY_
IDLE_ BUDGET - The longest park an entry asks for when every source of work can end it early: 60 s.
- ENTRY_
POLL_ BUDGET - 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 - The inline backing’s length in
u64words. - INLINE_
SIZING - The sizing an inline backing is carved at: the image’s
(
ExecutorSizing::DEFAULT), orNoneon an image whose executors are sized per sched task (crate::config::SCHED_TASK_SIZINGSis non-empty). There the inline backing is EMPTY – one whole-image backing per sched task 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-sched-task 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. - SCHED_
TASK_ TCB_ U64S - The control-block region every
SchedTaskMemorycarries, 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_
sched_ task_ executor_ backing - The ONE refusal every board’s
run_sched_tasksmakes before it opens anything:n_sched_taskssched tasks run, one on the boot executor, son_sched_tasks - 1must each find a slot. Checked up front rather than at each spawn, so a short block never leaves a half-spawned sched task chain. - default_
epoch_ us - 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 - 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)]. - fit_
runtime_ qos - Fit a profile the RUNTIME chose for one of its own endpoints
(
/rosout,/parameter_events, the lifecycle services andtransition_event) to whatsupportedhonours, and say once, per endpoint, which policies that dropped. - levels_
backing_ bytes - The backing bytes
levels_executor_sizingcarves,0on an image that sizes no sched task. Whatnros::sizes::LEVELS_BACKING_SIZEpublishes to the C/C++ header. - levels_
executor_ sizing - 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 sched tasks (each row of
the sched task table is one level).
Nonewhen the image sizes no sched task. - sched_
task_ backing_ bytes - The backing bytes the
index-th sched task’s executor carves,0past the last sched task. Whatnros::sizes::SCHED_TASK_BACKING_SIZE_<i>publishes to the C/C++ header. - sched_
task_ executor_ sizing - The
ExecutorSizingone sched task’s executor is carved at: its own callback slots, node slots, arena and declared parameters, and the image’s scheduling-context count. A sched task 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). - sched_
task_ sizing - The sizing of the sched task named
name,Nonewhen the image sizes no sched task of that name.
Type Aliases§
- Band
Wait Fn - 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 - 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.
- 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 - The deserialiser half of the TYPED C subscription path.
- RawResponse
Callback - Raw service-client response callback.
- RawResponse
Request IdCallback 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 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 (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. - Sched
Task Executor Backing Slot - One spawned sched task executor’s backing: exactly the words an
executor opened with
ExecutorSizing::DEFAULTcarves. - 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. - Typed
Subscription Callback - A subscription callback that receives the DESERIALISED message rather than its CDR bytes.
- Wake
Hook Fn - 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 sched task 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).