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

CrateWhat it containsWhen you use it
horusPrelude + re-exportsAlways — this is your only dependency
horus_coreScheduler, nodes, topics, servicesInternal — accessed through horus::prelude
horus_typesUniversal IPC types (math, diagnostics, time, generic)Internal — accessed through horus::prelude
horus_roboticsStandard robotics messages (CmdVel, Imu, LaserScan, BatteryState, …)Internal — re-exported through horus::prelude

Guide Contents

  1. Topics & Communication — Pub/sub, zero-copy, custom messages, communication patterns
  2. Nodes & Lifecycle — The Node trait, init/tick/shutdown, builder API
  3. Scheduler — Tick loop, execution classes, RT configuration
  4. node! Macro — Declarative node definition
  5. Examples — Working code you can copy and modify