Rust Guide
HORUS is built in Rust. This guide covers everything you need to write robotics applications in Rust.
Quick Start
use horus::prelude::*;
struct MyNode;
impl Node for MyNode {
fn name(&self) -> &str { "my_node" }
fn tick(&mut self) {
// Your robot logic here — runs every cycle
}
}
fn main() -> Result<()> {
let mut scheduler = Scheduler::new().tick_rate(100_u64.hz());
scheduler.add(MyNode).order(0).build()?;
scheduler.run()
}
Essential Import
use horus::prelude::*;
This single import gives you everything: Node, Topic, Scheduler, Image, CmdVel, LaserScan, all message types, DurationExt (.hz(), .ms()), and macros (message!, service!, action!).
Crate Overview
| Crate | What it contains | When you use it |
|---|---|---|
horus | Prelude + re-exports | Always — this is your only dependency |
horus_core | Scheduler, nodes, topics, services | Internal — accessed through horus::prelude |
horus_types | Universal IPC types (math, diagnostics, time, generic) | Internal — accessed through horus::prelude |
horus_robotics | Standard robotics messages (CmdVel, Imu, LaserScan, BatteryState, …) | Internal — re-exported through horus::prelude |
Guide Contents
- Topics & Communication — Pub/sub, zero-copy, custom messages, communication patterns
- Nodes & Lifecycle — The Node trait, init/tick/shutdown, builder API
- Scheduler — Tick loop, execution classes, RT configuration
- node! Macro — Declarative node definition
- Examples — Working code you can copy and modify