1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
//! # clankeRS — Rust SDK for robotics
//!
//! **Train in PyTorch. Deploy in Rust. Replay-test against real robot logs.**
//!
//! This crate is the umbrella facade. Most applications depend only on
//! this package and import [`prelude`] for everyday node code.
//!
//! ## Quick start — a robot node
//!
//! ```no_run
//! use clankers::prelude::*;
//!
//! #[clankers::node]
//! async fn main(ctx: RobotContext) -> RobotResult<()> {
//! let _node = RobotNode::new(ctx.node_name().as_str()).await?;
//! Ok(())
//! }
//! ```
//!
//! ## Quick start — optimized inference
//!
//! [`Model`] is the main inference API. Bind zero-copy [`TensorView`] inputs and
//! read named outputs. See [`ml`] for the full surface.
//!
//! ```no_run
//! # #[cfg(feature = "ml")]
//! # fn example() -> clankers::RobotResult<()> {
//! use clankers::ml::OnnxRuntimeBackend;
//! use clankers::prelude::*;
//! use clankers_tensor::{DType, Layout, Shape, TensorView};
//!
//! let mut model = Model::builder()
//! .backend(OnnxRuntimeBackend::default())
//! .load("models/policy.onnx")?;
//!
//! let image_shape = Shape::from([1, 64, 64, 3]);
//! let image = TensorView::from_slice(
//! &[0u8; 64 * 64 * 3],
//! DType::U8,
//! &image_shape,
//! Layout::Contiguous,
//! )?;
//! let state_shape = Shape::from([1, 12]);
//! let state = TensorView::from_f32(&[0.0f32; 12], &state_shape)?;
//!
//! let outputs = model.run_named([("image", image), ("state", state)])?;
//! let _action = outputs.get("action");
//! # Ok(())
//! # }
//! ```
//!
//! ## Module guide
//!
//! | Module | When to use it |
//! |--------|----------------|
//! | [`prelude`] | One import for nodes, inference, pub/sub, and replay tests |
//! | [`ros2`] | Sim pub/sub — [`RobotNode`], [`ImageMsg`], [`DetectionArray`] |
//! | [`ml`] / [`Model`] | Load ONNX models, run inference (start here) |
//! | [`tensor`] | [`TensorView`], [`ImageTensor`] preprocessing |
//! | [`data`] | MCAP inspect, replay, compare |
//! | [`recording`] | [`McapRecorder`] — tape node I/O to MCAP (`record_mcap`) |
//! | [`testing`] | [`ReplayContext`] and replay assertions |
//! | [`inference`] | Power-user [`InferenceEngine`] and backends |
//! | [`runtime`] | [`RobotRuntime`] metrics and tracing helpers |
//! | [`geometry`] | [`TfBuffer`] frame lookups, [`Isometry`], [`Pose`], [`Twist`] |
//!
//! ## Workspace crates
//!
//! The facade re-exports these focused crates (each has its own [docs.rs](https://docs.rs/clankers) page):
//! `clankers-core`, `clankers-ros2`, `clankers-tensor`, `clankers-ml`, `clankers-data`,
//! `clankers-testing`, `clankers-geometry`, `clankers-runtime`, `clankers-macros`.
//!
//! Install the CLI separately: `cargo install clankers-cli`.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use onnx_engine_from_config;
pub use ;
pub use ;
// `inject_message` feeds the in-memory sim bus (used by replay). The `clankers`
// crate always uses the sim backend; the real rclrs/DDS backend is a separate
// colcon package (ros2/clankers-ros2-dds) where messages arrive over DDS.
pub use inject_message;
pub use ;
pub use ;
pub use ;
/// Lower-level inference runtime used by [`Model`].
///
/// Most applications should use [`Model`]. Construct an [`InferenceEngine`] directly when
/// implementing custom backends, allocation policies, or advanced integrations.
/// Inference backends and the tensor specs / capabilities they report.
/// Rigid-body geometry and frame lookups: [`TfBuffer`], [`Isometry`], [`Pose`],
/// [`TransformStamped`], [`Twist`].