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 withtick,init, andshutdowncallbacksTopic— 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 managementTensorPool/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
| Class | Description |
|---|---|
Node | Computation unit with tick/init/shutdown callbacks |
Topic | Unified pub/sub channel with typed messages |
Scheduler | Node execution orchestrator |
Scheduler presets | Safety-critical, high-performance, hard RT, etc. |
NodeInfo | Runtime context and logging for nodes |
NodeState | Node lifecycle states |
Priority | Execution priority constants (CRITICAL=0 to BACKGROUND=100) |
Message Types
| Class | Fields | Default Topic |
|---|---|---|
CmdVel | linear, angular | "cmd_vel" |
Pose2D | x, y, theta | "pose" |
Imu | accel_x/y/z, gyro_x/y/z | "imu" |
Odometry | x, y, theta, linear_velocity, angular_velocity | "odom" |
LaserScan | ranges, angle_min/max, range_min/max | "scan" |
Transform System
| Class | Description |
|---|---|
TransformFrame | Coordinate frame tree with transform lookups |
Transform | 3D transformation (translation + quaternion rotation) |
TransformFrameConfig | TransformFrame configuration with size presets |
Perception Types
Available in horus.perception:
| Class | Description |
|---|---|
Detection | Object detection result (bbox, class, confidence) |
DetectionList | Collection of detections with filtering |
BoundingBox2D | 2D bounding box with IoU calculation |
PointCloudBuffer | Point cloud with NumPy integration |
TrackedObject | Object tracking with velocity estimation |
Tensor System
| Class | Description |
|---|---|
TensorPool | Shared memory tensor pool allocation |
TensorHandle | Zero-copy tensor with NumPy/PyTorch interop |
Networking
| Class | Description |
|---|---|
RouterClient | Connect to HORUS network router |
RouterServer | Host 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)