Expand description
Mecha10 Core Runtime
This crate provides the foundational runtime for the Mecha10 framework, including node lifecycle management, health monitoring, and orchestration.
§Features
- Node lifecycle management (start, stop, restart)
- Health monitoring and automatic recovery
- Process management for node execution
- Integration with config and messaging systems
- Graceful shutdown handling
- Type-safe topics system
- Comprehensive error handling
- Shared message types
§Quick Start
use mecha10_core::prelude::*;
use mecha10_core::topics::{perception, sensor};
#[derive(Debug)]
struct MyNode {
config: MyConfig,
}
#[derive(Debug, Deserialize)]
struct MyConfig {
threshold: f32,
}
#[async_trait]
impl NodeImpl for MyNode {
type Config = MyConfig;
async fn init(config: Self::Config) -> Result<Self> {
Ok(Self { config })
}
async fn run(&mut self, ctx: &Context) -> Result<()> {
let mut images = ctx.subscribe(sensor::CAMERA_RGB).await?;
while let Some(image) = images.recv().await {
// Process image into detections, then publish the result.
let result = Vec::new();
ctx.publish_to(perception::DETECTIONS, &result).await?;
}
Ok(())
}
}Re-exports§
pub use context::Context;pub use context::Receiver;pub use error::Mecha10Error;pub use error::Result;pub use messages::Message;pub use inventory;pub use types::*;
Modules§
- actuator
- Shared actuator message types
- aggregated
- Aggregated Topics - Multi-topic subscription with pattern matching
- auth
- Authorization and Access Control
- circuit_
breaker - Circuit Breaker Pattern for Fault Tolerance
- config
- config_
watcher - Configuration Hot-Reload Support
- context
- Node execution context
- dependency
- Dependency Resolution for Node Startup/Shutdown Ordering
- discovery
- Service Discovery
- error
- fs_
utils - Filesystem utility helpers shared across binaries (CLI, launcher-service, …).
- geometry
- Shared 2D axis-aligned bounding-box geometry and greedy Non-Maximum Suppression (NMS).
- kinematics
- Shared kinematics helpers for wheeled-robot odometry.
- macros
- Mecha10 Framework Macros
- messages
- metrics
- Metrics Collection
- model
- Model configuration utilities for AI nodes
- node
- node_
config_ base - The shared base config contract every node’s resolved config composes with.
- node_
registry - Link-time self-registration foundation for discovering framework node schema/catalog
metadata, without hand-enumerating every built-in node type in Rust
matcharms. - ollama
- Detects whether a project needs a local Ollama server running.
- prelude
- priority_
queue - Priority queue for message processing
- profiling
- Performance Profiling Helpers
- rate_
limit - Rate Limiting
- recovery
- Graceful Degradation and Automatic Recovery Policies
- relay_
topics - Relay topics auto-derivation for
websocket-bridge. - rwlock_
collections - Async extension trait for collecting the keys/values of a
tokio::sync::RwLock<HashMap<K, V>>. - schema
- Schema Registry
- secrets
- Secrets Management
- sensor
- Shared sensor message types
- service
- Service Pattern for Infrastructure Components
- state
- Persistent State Storage Abstraction for Nodes
- teleop
- Teleoperation message types
- topic_
registry - Topic Registry for Runtime Introspection and Validation
- topic_
utils - Topic utility functions
- topics
- Type-Safe Topics System
- types
- Core type definitions shared across the Mecha10 framework
- wire_
identifier - Parsing for a node’s “wire identifier” - the single string form a node’s
instance_id/camera_idget encoded into wherever a typedNodeRefisn’t available to carry them as separate fields (e.g.mecha10-node-runner‘s CLI args,mecha10-templates’ generated robot binary, which can’t depend onmecha10-cli-corewhereNodeRefitself lives).
Macros§
- builder_
build - builder_
setter - camera_
image_ decode_ fn - debug_
struct_ fields - default_
struct_ fields - differential_
drive_ odometry_ impl - enum_
display_ via_ str - enum_
str_ method - impl_
bounding_ box - in_
node_ context - log_
shutdown_ fn_ body - model_
preflight - new_
then_ run_ fn - new_
with_ defaults - node_
binary_ main - node_
main - odometry_
publish_ fn - register_
node - Register a
crate::node::NodeImpltype’sNodeDescriptorfor discovery by a later wave’s consumer. - topic_
group - zeroed_
count_ init_ body