Recipes
Complete, production-ready patterns you can copy, adapt, and ship. Unlike tutorials (which teach step-by-step), recipes are pure working programs with inline safety annotations.
Every recipe includes:
- A complete
horus.tomlmanifest - A full
src/main.rswith all imports, types, nodes, andfn main() - Inline
// SAFETY:and// IMPORTANT:comments for critical patterns - Expected terminal output
Available Recipes
| Recipe | What It Builds | Key Patterns |
|---|---|---|
| Differential Drive | 2-wheel robot: CmdVel to motor commands | Actuator safety, shutdown, execution order |
| IMU Reader | 100Hz IMU sensor with orientation publishing | Sensor node, #[repr(C)], zero-copy |
| PID Controller | Generic PID loop with configurable gains | Control theory, rate-based RT |
| LiDAR Obstacle Avoidance | Reactive velocity from LaserScan | Sensor fusion, safety zones |
| Servo Controller | Multi-servo bus with safe shutdown | Multi-actuator, ordered shutdown |
| Multi-Sensor Fusion | IMU + odometry state estimation | Multi-topic aggregation, caching |
| Emergency Stop | E-stop monitor with safety state | Safety-critical, Miss::SafeMode |
| Telemetry Logger | Log topics to file via async I/O | async_io(), non-blocking file writes |
| Python CV Node | Python computer vision with horus.Node | Python API, NumPy integration |
How to Use a Recipe
horus new my-robot -r
cd my-robot
Copy the horus.toml and src/main.rs from any recipe, then:
horus run
Conventions
- Execution order: Publishers run before subscribers (lower
.order()first) - Safety: Every actuator node implements
shutdown()that zeros outputs - recv() every tick: Always call
.recv()on every subscriber, every tick — even if you discard the value - No sleep(): Never use
std::thread::sleep()— use.rate()on the scheduler - No blocking I/O in tick(): Use
.async_io()for file/network operations