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 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.
- handoff
- Phase 104.E.3 — cross-priority handoff queue.
- monitor
- RFC-0052 / phase-296 W3b.4/.5 — on-target contract monitors.
- node_
record - Phase 104.C.2 — multi-Node-per-Executor storage.
- 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.
- 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 - 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
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. - 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. - Spin
Once Result - Result of a single spin iteration
- Spin
Options - Options controlling blocking spin behavior.
- Spin
Period Polling Result - Result from a single period of polling execution (
no_stdcompatible). - Spin
Period Result - Result from a single period with wall-clock measurement (
stdonly). - Subscription
- Typed subscription handle with internal receive buffer.
Enums§
- Boot
Config 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). - 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.
- Trigger
- Executor-level trigger condition.
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. - DEFAULT_
LOAN_ BUF - Default size of each per-publisher arena slot, in bytes.
- 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).
- 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.
Functions§
- baked_
domain_ from_ c_ abi - Map the C/C++ ABI’s
u8domain argument onto the resolver’s baked rung. - 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 needed for a(cbs, sc, arena)-sized executor. Public + non-generic so the macro / FFI can size a raw backing. - executor_
storage_ u64_ len - Number of
u64words a backing must hold for a(cbs, sc, arena)-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(N, SC, A)]. - std_
epoch_ us - RFC-0052 W3b.2 — hosted wall-clock source: µs since the UNIX epoch.
Type Aliases§
- 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.
- 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.