Python API

Complete Python API documentation for HORUS. The Python bindings are built with PyO3, exposing the core Rust framework to Python with zero-copy shared memory IPC.

Python Bindings

Full reference for the HORUS Python bindings:

  • Node — Create nodes with tick, init, and shutdown callbacks
  • Topic — Unified pub/sub with typed messages (CmdVel, Pose2D, Imu, etc.)
  • Scheduler — Node execution with priority ordering, rate control, and composable builder methods
  • TransformFrame / Transform — Coordinate frame management
  • Image / PointCloud / DepthImage — Zero-copy shared memory data with DLPack

Custom Messages

Create your own typed messages in Python:

  • Runtime messages - No build step, ~20-40μs latency
  • Compiled messages - Requires maturin, ~3-5μs latency
  • NumPy-based messages for better performance
  • YAML schema support for team projects

Async Nodes

Asynchronous Python nodes for non-blocking I/O operations.

Memory Types

Zero-copy Image, PointCloud, and DepthImage with NumPy/PyTorch/JAX interop.

Perception Types

Object detection, tracking, pose estimation — DetectionList, TrackedObject, COCOPose, PointCloudBuffer.

TransformFrame

Coordinate frame management — register frames, look up transforms, interpolate, export.


Quick Reference

Core Classes

ClassDescription
NodeComputation unit — all config via kwargs (tick, rate, order, budget, etc.)
TopicStandalone pub/sub channel for inter-process IPC
SchedulerNode execution orchestrator (composable kwargs, no presets)
ParamsDict-like runtime parameter store from horus.toml
RateDrift-compensated rate limiter for background threads
NodeStateNode lifecycle states

Message Types

ClassFieldsDefault Topic
CmdVellinear, angular"cmd_vel"
Pose2Dx, y, theta"pose"
Imuaccel_x/y/z, gyro_x/y/z"imu"
Odometryx, y, theta, linear_velocity, angular_velocity"odom"
LaserScanranges, angle_min/max, range_min/max"scan"

Transform System

ClassDescription
TransformFrameCoordinate frame tree with transform lookups
Transform3D transformation (translation + quaternion rotation)
TransformFrameConfigTransformFrame configuration with size presets

Perception Types

Available in horus.perception:

ClassDescription
DetectionObject detection result (bbox, class, confidence)
DetectionListCollection of detections with filtering
BoundingBox2D2D bounding box with IoU calculation
PointCloudBufferPoint cloud with NumPy integration
TrackedObjectObject tracking with velocity estimation

Large Data Types

ClassDescription
ImagePool-backed camera image with zero-copy framework conversions
PointCloudPool-backed 3D point cloud with zero-copy ML interop
DepthImagePool-backed depth image (F32 meters or U16 millimeters)

Networking

ClassDescription
RouterClientConnect to HORUS network router
RouterServerHost a HORUS network router

Installation

pip install horus-robotics

Minimal Example

import horus

def my_tick(node):
    node.send("greeting", "Hello from Python!")
    msg = node.recv("greeting")
    if msg:
        print(msg)

node = horus.Node(
    name="MyNode",
    pubs=["greeting"],
    subs=["greeting"],
    tick=my_tick,
    rate=10
)

horus.run(node)