Skip to main content

Module node_runtime

Module node_runtime 

Source
Expand description

Phase 212.M.5.a.2 — 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. Phase 212.M.5.a.2 — Executor-backed NodeRuntime / DeclaredNodeRuntime for nano-ros.

MetadataRecorder (the planner sink) binds the Node / ExecutableNode traits to a pure metadata target. 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 (Phase 258, Track 2) 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 Phase 212.M.5.a four-fn-ptr BSP-baker ABI — register_dispatch_slot / nros_run_components — is gone.)

§Coverage today (Phase 212.M.5.a.2)

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 (Phase 212.M-F.23): 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§

ExecutorNodeRuntime
Executor-backed component runtime.
RegisteredNode
Opaque handle returned by ExecutorNodeRuntime::register_node.

Enums§

ExecutorError
Errors returned by the runtime entry points.

Functions§

install_node_typed
Phase 257 (W0-B) — C-ABI typed component install. Recovers the shared Executor from the foreign typed entry’s handle (global_handle() / Node::executor_handle() = the _opaque *mut Executor; cf. nros-c get_executor_from_ptr) and registers C on it via [register_node_borrowed]. The component’s ComponentCell is kept alive by the executor’s own callback Arc clones (phase-257 D1), so this drops the returned cell. Returns 0 on success, -1 on a null handle or a registration error.