Metadata-Version: 2.5
Name: urml-ros2-runtime
Version: 0.5.4
Summary: ROS 2 reference runtime for URML — Universal Robot Language.
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
License-File: LICENSE
Keywords: robotics,ros2,runtime,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-validator>=0.5.4
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'
Requires-Dist: types-pyyaml>=6.0; extra == 'dev'
Provides-Extra: ros2
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>

---

# ROS 2 Reference Runtime

**Status:** alpha, on PyPI as `urml-ros2-runtime` (`pip install urml-ros2-runtime`). Versions are `0.x`, so a release may break compatibility; the [changelog](https://github.com/urml-dev/URML/blob/main/CHANGELOG.md) says what each one changed. It ships the runtime (`URMLRuntime`, with sequence, branch, parallel and retry composition), the substrate Protocol every adapter implements, the hermetic `MockROSAdapter`, and `RclpyAdapter` for a real ROS 2 system. `RclpyAdapter` has run end to end in simulation only, through Nav2; [Substrate](#substrate) says what it covers and what has been run.

## What this is

The **first** URML reference runtime. Translates a validated URML program into ROS 2 actions and topics. It checks the program against the declared capabilities and the active safety envelope before the first command, and an optional envelope shield (RFC-0667) gates each step while the program runs.

ROS 2 is the first reference runtime because its community is the largest, *not* because it is privileged. The substrate-neutrality acid test in [`CLAUDE.md`](https://github.com/urml-dev/URML/blob/main/CLAUDE.md) explicitly requires that every Layer-2 primitive be implementable on a runtime with **zero** ROS dependencies. This runtime is one of many possible Layer-0 targets.

## Substrate

`RclpyAdapter` is the adapter for a real ROS 2 system. `rclpy` is not a dependency of this package: it comes with a ROS 2 distribution, and the adapter imports it only when constructed, so the package installs and the mock runs on a machine without ROS 2.

- **ROS 2 Jazzy** is the distribution the adapter is developed and tested on. Other distributions are untested.
- **Nav2** for `move_to` and `hover` (`NavigateToPose`), `dock` (`DockRobot`) and the waypoints of a `scan`.
- **A gripper action server** for `grasp` and `release` (`control_msgs/GripperCommand`: close or open). The adapter plans no arm motion and does not call MoveIt 2.
- **Topics** for the rest: `vision_msgs` detections for `detect`, a camera image topic for `capture` and `scan` (photos; video is refused), sensor topics for `measure`, and string topics for `report`, `speak` and `listen`.

What it does not do: the drone primitives return a not-supported failure (use `urml-px4-runtime`), and so does `call_program` until a deployment overrides it for its driver. `drive`, `turn`, `look_at`, `gesture`, `plan_path`, `follow_trajectory`, `set_output` and winch or latch releases need adapter extensions that `RclpyAdapter` does not implement; the mock does.

What has been run: unit tests against a mocked `rclpy` on every host, and the [`ros2-integration`](https://github.com/urml-dev/URML/blob/main/.github/workflows/ros2-integration.yml) workflow (weekly and on demand), whose `gazebo-e2e` job drives a simulated TurtleBot 4 through Nav2 with one conformance fixture, `home/nav_patrol_positive`. A `scan` through Nav2's loopback simulator, with test publishers standing in for the camera and a sensor, was run by hand on 2026-09-29. The repository records no simulator run of gripper commands, object detection, docking or speech, and no run on a physical robot. [`INTEGRATION.md`](https://github.com/urml-dev/URML/blob/main/reference/ros2-runtime/INTEGRATION.md) has the per-method mapping and the adapter configuration.

## Language

**Python** only: the runtime, both adapters and the tests. The package ships no C++ node.

The code follows the conventions in [`CLAUDE.md`](https://github.com/urml-dev/URML/blob/main/CLAUDE.md) §Working conventions: type annotations on the public API and `mypy --strict`.

## Conformance contract

This runtime is **conformant** when it passes the published conformance suite at the declared URML spec versions. Conformance is per-spec-version: a runtime that passes Layer-2 v0.1 but not Layer-2 v0.2 declares conformance to v0.1 and is honest about it.

The runtime's declaration is in [`CONFORMANCE.md`](https://github.com/urml-dev/URML/blob/main/reference/ros2-runtime/CONFORMANCE.md), next to this README:

```yaml
declares:
  layer-1-hal: 0.1.0
  layer-2-primitives: 0.1.0
  layer-3-behavior: 0.1.0
  layer-4-nl-grammar: 0.1.0
  profiles:
    home: 0.1.0
    drone: 0.1.0
```

The run behind it uses `MockROSAdapter`. A report produced with the mock describes the mock, so this runtime has no entry in the [URML registry](https://github.com/urml-dev/URML/blob/main/registry/README.md).

## Architecture

The runtime is a thin Layer-0 translator with three responsibilities:

1. **Validate.** Before executing anything, run the URML program through [`/reference/validator/`](https://github.com/urml-dev/URML/tree/main/reference/validator) against the connected robot's capability manifest. If validation fails, the runtime refuses to execute and raises `ValidationRejectedError`, which carries the structured errors for whatever produced the program (often the LLM bridge).
2. **Translate.** Dispatch each primitive through one adapter method, which `RclpyAdapter` maps to ROS 2: `move_to(kitchen)` becomes a Nav2 `NavigateToPose` goal; `grasp(target, force: gentle)` becomes a `GripperCommand` goal with that force as its maximum effort; `detect(object: mug)` waits for a matching detection on the perception topic.
3. **Honor composition.** Run Layer-3 `sequence`, `branch`, `parallel` and `retry` with the `on_error` policies (`abort_and_report`, `continue`, `retry`). Fleet programs (`on`, `barrier`) run through `FleetRuntime`.

The validator runs in the same process as the runtime. `URMLRuntime.execute` re-validates every program against the manifest, envelope and policy it is given before its first adapter call, so a rejected program raises `ValidationRejectedError` and the adapter receives nothing. The conformance goal-line lane (`python -m urml_conformance --goal-line`) checks this for every rejected fixture. Skipping the check takes an explicit `revalidate=False` in code.

## License

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

## Related documents

- [`/spec/layer-1-hal/`](https://github.com/urml-dev/URML/tree/main/spec/layer-1-hal): what manifests this runtime reads.
- [`/spec/layer-2-primitives/`](https://github.com/urml-dev/URML/tree/main/spec/layer-2-primitives): what primitives it compiles.
- [`/spec/layer-3-behavior/`](https://github.com/urml-dev/URML/tree/main/spec/layer-3-behavior): composition semantics it implements.
- [`/conformance/`](https://github.com/urml-dev/URML/tree/main/conformance): the test suite that decides conformance.
