Rust API
The nano-ros Rust API is the nros crate. It re-exports every type a
user application needs: Executor, Node, Publisher<M>,
Subscription<M>, Service<S>, Client<S>, ActionServer<A>,
ActionClient<A>, Timer and GuardCondition, with nros::prelude as the
glob import. It is no_std, and its heap use is behind the alloc feature,
so the same node code builds for a host and for a board. Message types
are generated crates, one per interface package your node depends on
(Message Generation).
API reference
nrosrustdoc — start here.
The published rustdoc is built from the current main branch with the
alloc, log, env, rmw-cffi and ros-humble features on.
Where to start
- New to nano-ros? →
nros::prelude - Executor-driven app? →
nros::Executor - Polling or callbacks? → Two ways to receive, the two layers of the API and when to use each.
How to read the rustdoc
The published pages show the crate with the features listed above turned on.
A board build turns on only the features its image asks for, so an item
behind a feature your image does not enable is absent from that build even
though the published page shows it; the item’s source, linked from its page,
shows the #[cfg(feature = ...)] that gates it. Your own package documents
nros at the version and features it builds with: run cargo doc --open in
that package. That is also where your message crates are documented: they
are generated for your workspace, so the published site does not have them.
Porting only
These crates are not part of the user API. They surface only when you write a custom RMW backend or port nano-ros to a new platform; see Write a custom RMW backend and Add a platform.
nros_rmw: the RMW trait surface.nros_platform_api: the platform abstraction traits.nros-rmw-zenoh: the zenoh-pico backend, in the source tree.