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 and rate control
  • Scheduler presets — Safety-critical, high-performance, hard RT, etc.
  • TransformFrame / Transform — Coordinate frame management
  • TensorPool / TensorHandle — Zero-copy shared memory tensors 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, DepthImage, and TensorHandle 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 with tick/init/shutdown callbacks
TopicUnified pub/sub channel with typed messages
SchedulerNode execution orchestrator
Scheduler presetsSafety-critical, high-performance, hard RT, etc.
NodeInfoRuntime context and logging for nodes
NodeStateNode lifecycle states
PriorityExecution priority constants (CRITICAL=0 to BACKGROUND=100)

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

Tensor System

ClassDescription
TensorPoolShared memory tensor pool allocation
TensorHandleZero-copy tensor with NumPy/PyTorch interop

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.get("greeting")
    if msg:
        print(msg)

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

horus.run(node)