Expand description
Executor-backed component runtime.
Binds Node / ExecutableNode to a live
Executor so a Node pkg can actually run (versus
MetadataRecorder which
is the planner-side metadata sink).
Gated on rmw-cffi; the underlying Executor is only present
when an RMW backend is linked. The MACRO install
path (per-class static storage, placed cells, slabbed ctxs) is alloc-free,
so the module no longer demands alloc — only the dynamic
ExecutorNodeRuntime half does, item-gated inside.
The executor-backed component runtime for nano-ros.
MetadataRecorder (the planner sink) records what a Component /
ExecutableNode declares. This module is the
missing twin: it binds the same traits to a live Executor so
a Node pkg can actually run — nodes, publishers,
subscriptions, timers materialise as real executor handles, and
every fired callback dispatches into
ExecutableNode::on_callback with the right
CallbackId.
Shape:
use nros::{Executor, ExecutorConfig};
use nros::node_runtime::ExecutorNodeRuntime;
let cfg = ExecutorConfig::from_env().node_name("talker_main");
let executor = Executor::open(&cfg).unwrap();
let mut runtime = ExecutorNodeRuntime::from_executor(executor);
let _handle = runtime.register_node::<Talker>().unwrap();
runtime.spin().unwrap();Owned-spin / board consumer: the macro-emitted <pkg>::register(runtime)
wrapper installs each Node onto the runtime’s executor
through the uniform install_node_typed seam — the same seam the C/C++
typed entries use. The codegen run_plan(runtime) body + nros::main!
owned-spin loop drive one register(runtime)? per launch-XML <node>,
then runtime.spin(). (The retired four-fn-ptr BSP-baker
ABI — / register_dispatch_slot — is gone.)nros_run_components
§Coverage today
Publishers, subscriptions, and repeating timers wire end-to-end:
the live executor delivers callbacks; the bound
ExecutableNode::on_callback body runs with a
CallbackCtx backed by the per-component publisher resolver.
Service servers / clients and action servers / clients wire
end-to-end too: create_entity registers them on
the executor with C-ABI trampolines that route inbound requests /
goals into the component’s on_callback, and the tick-time client /
action surface (TickCtx) is backed by RuntimeClientDispatch /
RuntimeActions over the live executor. Parameters are still a
follow-up (registration succeeds; param callbacks don’t fire yet).
Structs§
- Component
Slot Storage - Per-class slot storage the
nros::node!macro emits. - Executor
Node Runtime - Executor-backed component runtime.
- Registered
Node - Opaque handle returned by
ExecutorNodeRuntime::register_node.
Enums§
- Executor
Error - Errors returned by the runtime entry points.
Functions§
- install_
node_ ⚠typed - C-ABI typed component install. Recovers the shared
Executorfrom the handle a typed entry passes — a bare*mut Executor<'static>. A C/C++ entry’srclcpp::global_handle()is NOT one: it is an nros-cpp context, and the entry unwraps it withnros_cpp_executor_innerfirst. RegistersCon it viaregister_node_borrowed(private helper). The component’sComponentCellis PLACED in caller/leaked storage (W5-endgame step 2b) and dropped in place by the executor onExecutor::drop. Returns0on success,-1on a null handle or a registration error,-4on an nros-cpp context that was not unwrapped. - install_
node_ ⚠typed_ in install_node_typedover caller storage; seeinstall_node_typed_with_launch_in.- install_
node_ ⚠typed_ with_ c_ params_ in install_node_typed_incarrying the launch<param>initials a C or C++ entry passes as a flat C-string array:kvholds2 * n_pairspointers,[name0, value0, name1, value1, ...]. This backs the component’s C-ABI install symbol, so a Rust component installed by a foreign entry sees the samectx.param(name)values one installed bynros::main!does.- install_
node_ ⚠typed_ with_ launch - Same as
install_node_typed_with_node_identitybut also carries the launch<remap from= to=/>rulesnros::main!baked for this component (RuntimeCtx::remaps).ExecutorSink::create_entityapplies them (plus~/relative expansion) before any entity name reaches the wire. All slices must outlive the call ('staticpromoted in the macro emit). - install_
node_ ⚠typed_ with_ launch_ in install_node_typed_with_launchover the CALLER’s per-class slot storage: the heap-free FFI install path. Thenros::node!macro emits onestatic ComponentSlotStorage<C>per expansion and calls this twin; the C ABI trampoline above it keeps its(ptr, ptr, ptr) -> i32shape, so nothing foreign changes.- install_
node_ ⚠typed_ with_ node_ identity - Same as
install_node_typed_with_paramsbut also injects the launch<node name= namespace=>identity soExecutorSink::create_nodeuses it instead of theNodeOptionsdefault.None→ backward-compatible (NodeOptions stands).nros::node!()calls this variant to carry the identity fromRuntimeCtx::node_identityset bynros::main!per component.paramsandnode_identitystrings must outlive the call (both are'staticin the macro emit). - install_
node_ ⚠typed_ with_ params - W4a — same as
install_node_typedbut seeds the node’sNodeContextwith the launch-baked<param>initial values, so aregister/init-timectx.param(name)observes the compile-time launch value.paramsmust outlive the call. - seed_
node_ rank - Seed the contract rank of the node the
NEXT
registercall creates,(name, namespace), on the executor the runtime holds: 0 is the most urgent, as the derivation normalises it (nros_orchestration_ir::levels::node_ranks).nros::main!emits it before each ranked node’sregister, the Rust twin of the C/C++ packs’nros_cpp_bind_node_rank.