API Quick Reference
One-page index of every HORUS API. Use Ctrl+F to find what you need.
Message Types — "What type do I use for...?"
Motion & Control
| Task | Type | Constructor | Topic |
|---|---|---|---|
| Move a wheeled robot | CmdVel | CmdVel::new(linear, angular) | cmd_vel |
| Move a differential drive | DifferentialDriveCommand | DifferentialDriveCommand::new(left, right) | drive_cmd |
| Control a servo | ServoCommand | ServoCommand::new(position, velocity) | servo_cmd |
| Control a joint | JointCommand | JointCommand::for_joint(id, position) | joint_cmd |
| Control a motor | MotorCommand | MotorCommand::velocity(rpm) | motor_cmd |
| Follow a trajectory | TrajectoryPoint | TrajectoryPoint::new(position, velocity) | trajectory |
| PID tuning | PidConfig | PidConfig::new(kp, ki, kd) | pid_config |
Sensors
| Task | Type | Constructor | Topic |
|---|---|---|---|
| LiDAR scan | LaserScan | LaserScan::from_ranges(&ranges) | scan |
| Camera image | Image | Image::rgb(w, h, &pixels) | image |
| Depth image | DepthImage | DepthImage::new(w, h, &depths) | depth |
| Compressed image | CompressedImage | CompressedImage::jpeg(&bytes) | image/compressed |
| IMU (accel+gyro) | Imu | Imu::new(ax, ay, az, gx, gy, gz) | imu |
| Odometry (pose+velocity) | Odometry | Odometry::new(x, y, theta) | odom |
| Joint positions | JointState | JointState::from_positions(&pos) | joint_states |
| Battery level | BatteryState | BatteryState::new(voltage, percentage) | battery |
| Temperature | Temperature | Temperature::celsius(value) | temperature |
| GPS | NavSatFix | NavSatFix::new(lat, lon, alt) | gps |
| Range sensor | RangeSensor | RangeSensor::new(distance) | range |
| Magnetic field | MagneticField | MagneticField::new(x, y, z) | mag |
| Audio | AudioFrame | AudioFrame::mono(sample_rate, &samples) | audio |
Perception
| Task | Type | Constructor |
|---|---|---|
| 2D object detection | Detection | Detection::new(label, confidence, bbox) |
| 3D object detection | Detection3D | Detection3D::new(label, confidence, bbox3d) |
| 2D bounding box | BoundingBox2D | BoundingBox2D::new(x, y, w, h) |
| 3D bounding box | BoundingBox3D | BoundingBox3D::new(center, size) |
| Object tracking | TrackedObject | TrackedObject::new(id, detection) |
| Segmentation mask | SegmentationMask | SegmentationMask::new(w, h, &classes) |
| Point cloud | PointCloud | PointCloud::from_xyz(&points) |
| Plane detection | PlaneDetection | PlaneDetection::new(normal, distance) |
| Landmark | Landmark | Landmark::new(x, y, confidence) |
Navigation
| Task | Type | Constructor |
|---|---|---|
| Send a goal | NavGoal | NavGoal::new(x, y, theta) |
| Plan a path | PathPlan | PathPlan::from_waypoints(&waypoints) |
| Occupancy grid | OccupancyGrid | OccupancyGrid::new(w, h, resolution) |
| Cost map | CostMap | CostMap::new(w, h, resolution) |
| Waypoint | Waypoint | Waypoint::new(x, y) |
Geometry
| Task | Type | Constructor |
|---|---|---|
| 3D point | Point3 | Point3::new(x, y, z) |
| 3D vector | Vector3 | Vector3::new(x, y, z) |
| Rotation | Quaternion | Quaternion::identity() |
| 2D pose | Pose2D | Pose2D::new(x, y, theta) |
| 3D pose | Pose3D | Pose3D::new(position, orientation) |
| Velocity | Twist | Twist::new(linear, angular) |
| Acceleration | Accel | Accel::new(linear, angular) |
| Transform | TransformStamped | TransformStamped::new(parent, child, translation, rotation) |
Force & Contact
| Task | Type | Constructor |
|---|---|---|
| Force command | ForceCommand | ForceCommand::force_only(force_vec) |
| Impedance control | ImpedanceParameters | ImpedanceParameters::new(stiffness, damping) |
| Wrench (force+torque) | WrenchStamped | WrenchStamped::new(force, torque) |
| Contact info | ContactInfo | ContactInfo::new(force, position) |
Diagnostics
| Task | Type | Constructor |
|---|---|---|
| Status report | DiagnosticStatus | DiagnosticStatus::ok("message") |
| Emergency stop | EmergencyStop | EmergencyStop::trigger("reason") |
| Heartbeat | Heartbeat | Heartbeat::now() |
| Resource usage | ResourceUsage | ResourceUsage::new(cpu, memory) |
Core API Cheatsheet
use horus::prelude::*;
// ── Create a scheduler ────────────────────────────
let mut scheduler = Scheduler::new()
.tick_rate(100.hz()) // 100 Hz main loop
.monitoring(true) // Enable health monitoring
.deterministic(true); // Simulation mode (optional)
// ── Add a node ────────────────────────────────────
scheduler.add(MyNode::new())
.order(0) // Execution priority
.rate(50.hz()) // Node tick rate
.budget(2.ms()) // Max tick duration
.deadline(5.ms()) // Hard deadline
.on_miss(Miss::Skip) // What to do on deadline miss
.build()?;
// ── Run ───────────────────────────────────────────
scheduler.run()?; // Blocks until Ctrl+C
// ── Topics (pub/sub) ──────────────────────────────
let pub_topic: Topic<CmdVel> = Topic::new("cmd_vel")?;
pub_topic.send(CmdVel::new(1.0, 0.0));
let sub_topic: Topic<LaserScan> = Topic::new("scan")?;
if let Some(scan) = sub_topic.try_recv() {
println!("Got {} ranges", scan.ranges.len());
}
// ── Time ──────────────────────────────────────────
let now = horus::now(); // Current ClockInstant
let dt = horus::dt(); // Time since last tick
let elapsed = horus::elapsed(); // Total runtime
// ── Parameters ────────────────────────────────────
let params = RuntimeParams::new();
params.set("speed", 1.5)?;
let speed: f64 = params.get_or("speed", 1.0);
// ── Duration/Frequency helpers ────────────────────
let rate = 100_u64.hz(); // 100 Hz
let budget = 200_u64.us(); // 200 microseconds
let deadline = 1_u64.ms(); // 1 millisecond
CLI Commands
| Command | Purpose |
|---|---|
horus new NAME -r/-p | Create Rust/Python project |
horus run | Build and run |
horus build | Build only |
horus test | Run tests |
horus add NAME --source SOURCE | Add dependency |
horus remove NAME | Remove dependency |
horus install PKG | Install package from registry |
horus topic list | List active topics |
horus node list | List running nodes |
horus param get/set KEY VALUE | Runtime parameters |
horus monitor | Web dashboard |
horus monitor --tui | Terminal dashboard |
horus log | View logs |
horus doctor | Health check |
horus check | Validate project |
horus fmt | Format code |
horus lint | Lint code |
horus deploy TARGET | Deploy to robot |
horus publish | Publish to registry |
horus auth login | Authenticate |
See Also
- Getting Started — First project in 5 minutes
- Tutorials — Step-by-step guided examples
- Rust API — Full Rust API reference
- Python API — Python bindings reference
- CLI Reference — Complete CLI documentation