Metadata-Version: 2.5
Name: urml-legged-runtime
Version: 0.5.2
Summary: Legged/quadruped reference runtime for URML — Boston Dynamics Spot, ANYbotics ANYmal.
Project-URL: Homepage, https://github.com/urml-dev/URML
Project-URL: Repository, https://github.com/urml-dev/URML
Project-URL: Issues, https://github.com/urml-dev/URML/issues
Author: URML Maintainers
License: BUSL-1.1
Keywords: anybotics,anymal,boston-dynamics,legged,quadruped,robotics,runtime,spot,urml
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.11
Requires-Dist: pydantic<3,>=2.6
Requires-Dist: pyyaml<7,>=6.0
Requires-Dist: urml-ros2-runtime>=0.5.2
Requires-Dist: urml-validator>=0.5.2
Provides-Extra: dev
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-cov>=5; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Provides-Extra: spot
Requires-Dist: bosdyn-api>=4.0; extra == 'spot'
Requires-Dist: bosdyn-client>=4.0; extra == 'spot'
Requires-Dist: bosdyn-mission>=4.0; extra == 'spot'
Description-Content-Type: text/markdown

<p align="center">
  <a href="https://urml.dev"><img src="https://urml.dev/favicon.svg" alt="URML" width="72" height="72"></a>
</p>

<p align="center">
  A small, opinionated, human-readable language for describing robot intent.
</p>

<p align="center">
  <a href="https://urml.dev"><b>urml.dev</b></a>
</p>

---

# urml-legged-runtime

**Legged/quadruped reference runtime for URML** — first-class adapters for **Boston Dynamics Spot** and **ANYbotics ANYmal**.

Two vendors, two substrates, the same `ROSAdapter` Protocol:

- **`SpotAdapter`** talks the Boston Dynamics `bosdyn` gRPC SDK directly. **No ROS 2 dependency** — like `PX4Adapter` for MAVLink, it is a second proof that URML's spec carries no ROS assumptions. Spot's own companion computer is commonly a Jetson, so the offline, Jetson-class deployment story is native here.
- **`AnymalAdapter`** speaks ROS 2, so it composes the ROS 2 runtime's `RclpyAdapter` — the same single-sourced-substrate pattern the industrial-arm runtime uses. No duplicated ROS 2 plumbing.

## Method coverage

**SpotAdapter** (bosdyn):

| URML primitive | Mapping |
|---|---|
| `move_to` / `hover` | GraphNav navigate-to (location → waypoint via `SpotConfig`) |
| `dock` | `bosdyn.client.docking` blocking dock |
| `wait` | held stand command |
| `measure` | robot-state telemetry (battery / e-stop) — *partial* |
| `wait_for` | robot-state poll — *partial* |
| `report` | structured record to a local sink (no cloud) |
| `scan` | documented not-supported result: no area-scan controller (a scan is waypoints plus a capture at each one) |

Not supported on a bare Spot — `grasp`/`release` (needs the Spot Arm SDK), `detect`, `capture`, `speak`, `listen`, and the drone trio — return `not_supported_on_spot: ...` (returned, not raised).

**AnymalAdapter** (composes `RclpyAdapter`): `move_to`/`hover`, `wait`, `measure`, `wait_for`, `report` delegate to the ROS 2 substrate. `grasp`/`release` (no arm), `dock`, `detect`, `scan`, `capture`, `speak`, `listen`, and the drone trio return `not_supported_on_quadruped[anymal]: ...`. A payload-equipped ANYmal pairs with a companion adapter, exactly as the drone stack pairs flight with a ROS 2 companion.

## Install

```bash
pip install -e reference/legged-runtime          # AnymalAdapter (needs a sourced ROS 2 env to construct)
pip install -e reference/legged-runtime[spot]    # + SpotAdapter (bosdyn wheels)
```

`bosdyn` and `rclpy` are imported lazily, so the package imports on every host; constructing an adapter needs that vendor's runtime.

## Use

```python
from urml_legged_runtime import SpotAdapter, SpotConfig

cfg = SpotConfig(hostname="192.168.80.3", location_to_waypoint={"dock": "wp-12"})
with SpotAdapter(cfg) as spot:                       # credentials read from env-var NAMES in cfg
    assert spot.send_navigation_goal(location="dock").success
```

```python
from urml_conformance import ConformanceRunner
from urml_legged_runtime import LEGGED_ADAPTERS

runner = ConformanceRunner(adapter_factory=lambda: LEGGED_ADAPTERS["spot"]())
```

## Status

**v0.1 (this release):**
- `SpotAdapter` (standalone bosdyn) + `AnymalAdapter` (composes `RclpyAdapter`) + `LEGGED_ADAPTERS` registry.
- Hermetic unit tests: Spot against an injected fake `bosdyn` (navigation, dock, wait, measure, scan (not supported), every not-supported sentinel, lifecycle power-off, the missing-`[spot]`-extra error); ANYmal against an injected fake inner (delegation + not-supported + conformance hook + `runtime_checkable`).
- Gated `.github/workflows/legged-integration.yml`: `spot-smoke` (real bosdyn wheels), `spot-arm64-build` (the bosdyn stack under `linux/arm64` QEMU — the Jetson-companion signal, mirroring `px4-arm64-build`), and a gated `legged-sim-e2e` matrix that skips cleanly without a sim/credential.

**Follow-ups (not yet):**
- US-compliant capability manifests (Boston Dynamics — US/Hyundai-owned; ANYbotics — Switzerland). Blocked on the `Mobility.drive_type` schema, which has no `legged`/`quadruped` value; that is the Phase-5 RFC fast-follow. Quadruped conformance fixtures land with the RFC, not before (correct sequencing, not a shortcut).
- Spot Arm SDK wiring for `grasp`/`release`; a vision/speech companion split.
- A real Spot sim path: Boston Dynamics' public sim is weaker than PX4 SITL and Isaac-Sim Spot needs an RTX host (never the Jetson). Until that or hardware exists, the Spot integration lane is honestly the hermetic fake-bosdyn path; the gated sim job skips cleanly.

## Core Commitment

This runtime is licensed under the Business Source License 1.1: free for non-production use, commercial license for production (see [`LICENSING.md`](../../LICENSING.md)). No vendor coupling, no cloud dependency.

## Related documents

- [`/spec/layer-1-hal/`](../../spec/layer-1-hal/) — manifest schema (the `drive_type` gap is tracked by the Phase-5 RFC).
- [`/reference/ros2-runtime/`](../ros2-runtime/) — the substrate engine `AnymalAdapter` composes.
- [`/reference/px4-runtime/`](../px4-runtime/) — the no-ROS sibling whose structure `SpotAdapter` mirrors.
- [`/conformance/`](../../conformance/) — the test suite that decides conformance.
