Skip to main content

Parkour policy inference client and utilities for Krabby

Project description

Krabby Compute - Parkour

Parkour policy inference client and utilities for the Krabby quadruped robot.

Overview

This package provides the parkour policy inference client that:

  • Connects to HAL server via ZMQ
  • Polls hardware observations
  • Runs parkour policy inference
  • Sends joint commands back to HAL server

Components

Inference Client (compute.parkour.inference_client.ParkourInferenceClient)

  • Runs in a separate thread
  • Manages HAL client connection
  • Handles inference loop (poll → infer → command)

Policy Interface (compute.parkour.policy_interface.ParkourPolicyModel)

  • Loads parkour policy checkpoints
  • Runs inference on observations
  • Uses OnPolicyRunnerWithExtractor for model loading

Mappers (compute.parkour.mappers)

  • hardware_to_model: Maps Krabby hardware observations to parkour model format
  • model_to_hardware: Maps parkour model actions to Krabby joint positions

Types (compute.parkour.parkour_types)

  • ParkourObservation: Observation in training format
  • ParkourModelIO: Combined input for policy inference
  • InferenceResponse: Policy inference output with action tensor

Installation

From source (development)

cd compute/parkour
pip install -e .

From wheel

pip install krabby-compute-parkour-0.1.0-py3-none-any.whl

Usage

As a library

from compute.parkour.inference_client import ParkourInferenceClient
from compute.parkour.policy_interface import ModelWeights
from hal.client.config import HalClientConfig

# Configure HAL client
hal_config = HalClientConfig(
    observation_endpoint="inproc://hal_observation",
    command_endpoint="inproc://hal_commands",
)

# Configure model
model_weights = ModelWeights(
    checkpoint_path="/path/to/model.pt",
    action_dim=12,
    obs_dim=753,
)

# Create client
client = ParkourInferenceClient(
    hal_client_config=hal_config,
    model_weights=model_weights,
    control_rate=100.0,
    device="cuda",
    transport_context=transport_context,  # From HAL server
)

# Initialize and start
client.initialize()
client.start_thread(running_flag=lambda: True)

Architecture

┌──────────────────────────────────────┐
│  ParkourInferenceClient              │
│                                      │
│  ┌────────────┐    ┌──────────────┐ │
│  │ HAL Client │───▶│ Policy Model │ │
│  └────────────┘    └──────────────┘ │
│        │                  │          │
│        │ observations     │ actions  │
│        ▼                  ▼          │
│  ┌──────────────────────────────┐   │
│  │   Hardware ↔ Model Mappers   │   │
│  └──────────────────────────────┘   │
└──────────────────────────────────────┘

Dependencies

  • krabby-hal-client: For HAL communication
  • torch: For policy inference
  • numpy: For numerical operations

Development

Running Tests

pytest tests/

Building Wheel

python -m build

Notes

  • Designed to run in a separate thread from HAL server
  • Supports both inproc (same-process) and TCP (distributed) communication
  • Zero-copy operations where possible for performance

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

krabby_compute_parkour-0.1.1-py3-none-any.whl (56.2 kB view details)

Uploaded Python 3

File details

Details for the file krabby_compute_parkour-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for krabby_compute_parkour-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 985b94b188e614a1e53d95b7133d050d5561d8751d0e7ae992e3fc16272baf10
MD5 01a6d3f1df39c0407fb66a539e677a1d
BLAKE2b-256 e0d0fc6dcb2ce2f20f1ca4d8ad4d39bdacc0d03b3a4f7afa84cce04a8e18a7b4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page