Expand description
Phase 212.L.5 — top-level init API.
Re-exported flat at the crate root: nros::init(),
nros::init_with_launch_auto(), nros::init_with_launch(path),
nros::init_with_args(args), nros::Context, nros::InitError.
Phase 212.L.5 — top-level init API.
Three patterns are supported (per the Phase 212.L canonical pkg shape):
- Node pkg — register via the
nros::node!macro (Phase 172 W.3); the generated runtime owns the spin loop. - Application pkg + launch-aware — call
init_with_launch_auto(orinit_with_launchfor an explicit path). The returnedContextcarries launch-resolved fields (domain id, locator, RMW choice). User code drives its own spin viaExecutor::open+Executor::spin_blocking. - Application pkg + custom spin — call
init()(orinit_with_argsfor argv-style overrides). Launch file is ignored; env vars +ExecutorConfig::from_env()semantics still apply.
The Context struct is a thin holder of the resolved init knobs. To
actually open a session, materialise an crate::ExecutorConfig via
Context::config and pass it to Executor::open.
§Launch overlay (current limitation)
init_with_launch_auto / init_with_launch currently consume the
launch-resolved knobs the parent nros launch process exports via env
vars (ROS_DOMAIN_ID, NROS_LOCATOR, NROS_SESSION_MODE,
RMW_IMPLEMENTATION, plus the placeholder NROS_RUNTIME_OVERLAY for
the future structured overlay path). The launch XML is NOT parsed
in-process; the runtime trusts the launcher to project the relevant
params / remaps / env into the child environment. A follow-up wave wires
the structured overlay (Option A — nros launch --emit-runtime-overlay
→ JSON sidecar consumed here). See Phase 212.L.5 notes.
Structs§
- Context
- Phase 212.L.5 — resolved init context.
Enums§
- Context
Source - Where the
Contextcame from. Diagnostics only. - Init
Error - Errors returned by the init API.
Functions§
- init
- Pattern 3 — raw init, launch file ignored.
- init_
with_ args - Pattern 3 — like
initbut accepts a[--arg=value, ...]-style argv iterator. Currently a thin wrapper overinitthat ignores the args; the structured argv parse (--ros-args -p foo:=42, etc.) lands with the runtime-overlay wave. - init_
with_ launch - Pattern 2 — explicit-path variant of
init_with_launch_auto. - init_
with_ launch_ auto - Pattern 2 — launch-aware init.