Skip to main content

init

Function init 

Source
pub fn init() -> Result<Context, InitError>
Expand description

Pattern 3 — raw init, launch file ignored. The C++-symmetric anchor: rclcpp::init() in the Rust spelling, and EQUAL to Context::default_from_env on a hosted build (RFC-0089 “Context and init, settled” — each language follows its own upstream; rclrs spells this one on the type, rclcpp as a free function, and both are here).

Reads env vars (ROS_DOMAIN_ID, NROS_LOCATOR, NROS_SESSION_MODE, NROS_RMW / RMW_IMPLEMENTATION) and returns a Context. The caller owns the spin loop — typically Executor::open(&ctx.config(name)) followed by spin or a hand-rolled spin_once loop.