urml-ros2-runtime 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. urml_ros2_runtime-0.5.0/.gitignore +114 -0
  2. urml_ros2_runtime-0.5.0/CONFORMANCE.md +57 -0
  3. urml_ros2_runtime-0.5.0/INTEGRATION.md +249 -0
  4. urml_ros2_runtime-0.5.0/PKG-INFO +105 -0
  5. urml_ros2_runtime-0.5.0/README.md +74 -0
  6. urml_ros2_runtime-0.5.0/pyproject.toml +83 -0
  7. urml_ros2_runtime-0.5.0/src/urml_ros2_runtime/__init__.py +100 -0
  8. urml_ros2_runtime-0.5.0/src/urml_ros2_runtime/_version.py +5 -0
  9. urml_ros2_runtime-0.5.0/src/urml_ros2_runtime/action_server.py +694 -0
  10. urml_ros2_runtime-0.5.0/src/urml_ros2_runtime/bindings.py +115 -0
  11. urml_ros2_runtime-0.5.0/src/urml_ros2_runtime/conditions.py +220 -0
  12. urml_ros2_runtime-0.5.0/src/urml_ros2_runtime/errors.py +86 -0
  13. urml_ros2_runtime-0.5.0/src/urml_ros2_runtime/fleet.py +464 -0
  14. urml_ros2_runtime-0.5.0/src/urml_ros2_runtime/primitives.py +993 -0
  15. urml_ros2_runtime-0.5.0/src/urml_ros2_runtime/py.typed +0 -0
  16. urml_ros2_runtime-0.5.0/src/urml_ros2_runtime/rehearsal.py +373 -0
  17. urml_ros2_runtime-0.5.0/src/urml_ros2_runtime/runtime.py +522 -0
  18. urml_ros2_runtime-0.5.0/src/urml_ros2_runtime/scan_plan.py +402 -0
  19. urml_ros2_runtime-0.5.0/src/urml_ros2_runtime/shield.py +204 -0
  20. urml_ros2_runtime-0.5.0/src/urml_ros2_runtime/substrate/__init__.py +63 -0
  21. urml_ros2_runtime-0.5.0/src/urml_ros2_runtime/substrate/adapter_config.py +160 -0
  22. urml_ros2_runtime-0.5.0/src/urml_ros2_runtime/substrate/base.py +622 -0
  23. urml_ros2_runtime-0.5.0/src/urml_ros2_runtime/substrate/mock.py +693 -0
  24. urml_ros2_runtime-0.5.0/src/urml_ros2_runtime/substrate/rclpy_adapter.py +961 -0
  25. urml_ros2_runtime-0.5.0/tests/__init__.py +0 -0
  26. urml_ros2_runtime-0.5.0/tests/integration/__init__.py +0 -0
  27. urml_ros2_runtime-0.5.0/tests/integration/adapter_nav_patrol.yaml +36 -0
  28. urml_ros2_runtime-0.5.0/tests/integration/adapter_scan_nav2.yaml +19 -0
  29. urml_ros2_runtime-0.5.0/tests/integration/nav2-runs/2026-09-29-nav2-loopback-scan.md +127 -0
  30. urml_ros2_runtime-0.5.0/tests/integration/nav2_loopback/camera_pub.py +55 -0
  31. urml_ros2_runtime-0.5.0/tests/integration/nav2_loopback/soil_probe_pub.py +44 -0
  32. urml_ros2_runtime-0.5.0/tests/integration/test_nav_patrol_gazebo_e2e.py +112 -0
  33. urml_ros2_runtime-0.5.0/tests/integration/test_rclpy_adapter_live.py +80 -0
  34. urml_ros2_runtime-0.5.0/tests/integration/test_scan_nav2_e2e.py +207 -0
  35. urml_ros2_runtime-0.5.0/tests/test_action_server.py +373 -0
  36. urml_ros2_runtime-0.5.0/tests/test_action_server_evidence.py +165 -0
  37. urml_ros2_runtime-0.5.0/tests/test_bindings.py +146 -0
  38. urml_ros2_runtime-0.5.0/tests/test_conditions.py +136 -0
  39. urml_ros2_runtime-0.5.0/tests/test_fleet_concurrency.py +124 -0
  40. urml_ros2_runtime-0.5.0/tests/test_fleet_demo.py +40 -0
  41. urml_ros2_runtime-0.5.0/tests/test_fleet_runtime.py +149 -0
  42. urml_ros2_runtime-0.5.0/tests/test_mock_adapter.py +118 -0
  43. urml_ros2_runtime-0.5.0/tests/test_nl_partners_capstone.py +32 -0
  44. urml_ros2_runtime-0.5.0/tests/test_partners_demo.py +38 -0
  45. urml_ros2_runtime-0.5.0/tests/test_rclpy_adapter.py +1091 -0
  46. urml_ros2_runtime-0.5.0/tests/test_rehearsal.py +176 -0
  47. urml_ros2_runtime-0.5.0/tests/test_runtime.py +709 -0
  48. urml_ros2_runtime-0.5.0/tests/test_runtime_evidence.py +82 -0
  49. urml_ros2_runtime-0.5.0/tests/test_runtime_gate.py +129 -0
  50. urml_ros2_runtime-0.5.0/tests/test_runtime_rulebooks.py +177 -0
  51. urml_ros2_runtime-0.5.0/tests/test_scan_plan.py +179 -0
  52. urml_ros2_runtime-0.5.0/tests/test_shield.py +220 -0
  53. urml_ros2_runtime-0.5.0/tests/test_speed_lowering.py +207 -0
@@ -0,0 +1,114 @@
1
+ # --- Python ---
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ dist/
9
+ develop-eggs/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+ MANIFEST
23
+
24
+ # Virtual envs
25
+ .venv/
26
+ venv/
27
+ env/
28
+ ENV/
29
+ .python-version
30
+
31
+ # Test / coverage / mypy / pyright
32
+ .coverage
33
+ .coverage.*
34
+ .cache
35
+ .pytest_cache/
36
+ .mypy_cache/
37
+ .dmypy.json
38
+ .pyre/
39
+ .pyright/
40
+ htmlcov/
41
+ nosetests.xml
42
+ coverage.xml
43
+ *.cover
44
+ .hypothesis/
45
+ .tox/
46
+
47
+ # --- Node / web tooling (kept out of core repo; here for safety) ---
48
+ node_modules/
49
+ .pnp.*
50
+ .yarn/cache/
51
+ .yarn/unplugged/
52
+ .yarn/build-state.yml
53
+ .yarn/install-state.gz
54
+ npm-debug.log*
55
+ yarn-debug.log*
56
+ yarn-error.log*
57
+
58
+ # --- C++ / Rust build artifacts (in case reference runtimes land here in early Phase 1) ---
59
+ target/
60
+ *.o
61
+ *.obj
62
+ *.a
63
+ *.lib
64
+ *.dll
65
+ *.dylib
66
+ *.exe
67
+ *.pdb
68
+ cmake-build-*/
69
+ CMakeCache.txt
70
+ CMakeFiles/
71
+ CMakeScripts/
72
+ Testing/
73
+ cmake_install.cmake
74
+ install_manifest.txt
75
+ compile_commands.json
76
+
77
+ # --- ROS 2 build dirs ---
78
+ build/
79
+ install/
80
+ log/
81
+
82
+ # --- Editor and OS junk ---
83
+ .vscode/
84
+ .idea/
85
+ *.swp
86
+ *.swo
87
+ *~
88
+ .DS_Store
89
+ Thumbs.db
90
+ desktop.ini
91
+
92
+ # --- Local-only artifacts ---
93
+ .env
94
+ .env.*
95
+ *.log
96
+ *.tmp
97
+ .local/
98
+ .scratch/
99
+
100
+ # --- Outreach campaign artifacts (operational, not part of the open standard) ---
101
+ # Target lists, message drafts, tracking data, and the launch-approval record
102
+ # stay local. They are private to the maintainer; committing them would
103
+ # telegraph the campaign before launch and could embarrass listed projects.
104
+ outreach/
105
+
106
+ # Outreach dashboard SQLite mirror (RFC-0275). Derived from
107
+ # examples/lighthouses/outreach*.yaml via tools/scripts/refresh_outreach_db.py.
108
+ # Regenerated on demand by `make outreach-refresh`.
109
+ tools/outreach.db
110
+ tools/.outreach.db
111
+
112
+ # Local Claude Code settings (per-machine; permission rules, etc.). Not committed.
113
+ .claude/settings.json
114
+ .claude/settings.local.json
@@ -0,0 +1,57 @@
1
+ <p align="center">
2
+ <a href="https://urml.dev"><img src="https://urml.dev/favicon.svg" alt="URML" width="72" height="72"></a>
3
+ </p>
4
+
5
+ <p align="center">
6
+ A small, opinionated, human-readable language for describing robot intent.
7
+ </p>
8
+
9
+ <p align="center">
10
+ <a href="https://urml.dev"><b>urml.dev</b></a>
11
+ </p>
12
+
13
+ ---
14
+
15
+ # Conformance Declaration
16
+
17
+ The `urml-ros2-runtime` package declares the following URML spec versions covered by the public conformance suite. This file is the format every URML-compatible runtime ships at the root of its repository; see [`docs/registry/SUBMISSION.md`](../../docs/registry/SUBMISSION.md) in the main URML repo for how a runtime's result reaches the [URML registry](../../registry/README.md).
18
+
19
+ ```yaml
20
+ declares:
21
+ layer-1-hal: 0.1.0
22
+ layer-2-primitives: 0.1.0
23
+ layer-3-behavior: 0.1.0
24
+ layer-4-nl-grammar: 0.1.0
25
+ profiles:
26
+ home: 0.1.0
27
+ drone: 0.1.0
28
+ ```
29
+
30
+ ## How to verify
31
+
32
+ From the repository root:
33
+
34
+ ```bash
35
+ pip install -e reference/validator
36
+ pip install -e reference/ros2-runtime
37
+ pip install -e conformance
38
+ urml conformance run --output conformance-report.json
39
+ ```
40
+
41
+ A passing run writes a `urml.conformance-report/1` JSON report with `all_passed: true`, the `passed` and `failed` counts, the adapter it ran against (`urml_ros2_runtime:MockROSAdapter` unless `--adapter` names another), the urml-conformance and urml-validator versions, the fixture count and a sha256 over the fixture files, and one result per fixture. The bundled fixture set covers every profile; `--filter` selects a subset, and the report records it.
42
+
43
+ ## Substrate
44
+
45
+ This is the ROS 2 reference runtime. It uses the hermetic `MockROSAdapter` by default. A real `RclpyAdapter` is in flight (see [`reference/ros2-runtime/INTEGRATION.md`](INTEGRATION.md)) and will share the same fixture set when it lands.
46
+
47
+ ## Status
48
+
49
+ Phase 1 in flight. This declaration tracks the runtime's actual coverage; if a fixture starts failing for any of the declared layers or profiles, this file is updated in the same PR that fixes (or accepts) the change.
50
+
51
+ ## Why this file lives here
52
+
53
+ `CONFORMANCE.md` is the public record a third-party reviewer reads when deciding whether a runtime's conformance claim is honest. It must match the JSON report from the most recent suite run and the runtime's commit at which the report was produced. Mismatches between this file, the JSON report, and the runtime's actual behavior are bugs.
54
+
55
+ ## Registry status
56
+
57
+ This runtime is listed with the first-party reference runtimes in [`docs/compatible-runtimes.md`](../../docs/compatible-runtimes.md). It has no entry in the [URML registry](../../registry/README.md): the hermetic run above uses `MockROSAdapter`, which describes the mock, and a registry compatibility claim needs a report produced with a runtime's own adapter.
@@ -0,0 +1,249 @@
1
+ <p align="center">
2
+ <a href="https://urml.dev"><img src="https://urml.dev/favicon.svg" alt="URML" width="72" height="72"></a>
3
+ </p>
4
+
5
+ <p align="center">
6
+ A small, opinionated, human-readable language for describing robot intent.
7
+ </p>
8
+
9
+ <p align="center">
10
+ <a href="https://urml.dev"><b>urml.dev</b></a>
11
+ </p>
12
+
13
+ ---
14
+
15
+ # ROS 2 Integration — `RclpyAdapter`
16
+
17
+ **Status (v0.1):** Reference `RclpyAdapter` ships in `substrate/rclpy_adapter.py`. Unit tests with mocked rclpy run on every host (including Windows) as part of the default suite. Integration tests against a live ROS 2 + Gazebo stack are gated to a separate Linux-only CI workflow — see `.github/workflows/ros2-integration.yml`.
18
+
19
+ This document is the blueprint for the adapter. It records the surface area, the per-method ROS 2 mapping, the testing strategy, the configuration surface, and the open design questions.
20
+
21
+ ---
22
+
23
+ ## Development environment
24
+
25
+ The reference adapter is developed and integration-tested on **WSL2 + ROS 2 Jazzy** (current LTS as of 2026). Specifically:
26
+
27
+ - Windows 10/11 host with WSL2 enabled.
28
+ - Ubuntu 24.04 LTS image.
29
+ - ROS 2 Jazzy desktop install (`ros-jazzy-desktop`).
30
+ - Nav2 (`ros-jazzy-nav2-bringup`), MoveIt 2 (`ros-jazzy-moveit`), and Gazebo Harmonic for integration tests.
31
+ - Python `>=3.11` from the system Python (matches the URML packages' minimum).
32
+
33
+ This is the recommended path because (a) it works on the author's primary development host without a dual-boot or a separate machine, (b) ROS 2 Linux support is first-class and Windows support is not, (c) WSL2's networking is fast enough for the action client patterns the adapter uses.
34
+
35
+ Alternatives that also work: a Linux-native dev box, a devcontainer pinned to `osrf/ros:jazzy-desktop`, or a cloud Linux VM with X forwarding for the Gazebo GUI. The adapter code itself is OS-agnostic — only the ROS 2 install isn't.
36
+
37
+ ---
38
+
39
+ ## What the adapter must implement
40
+
41
+ The `ROSAdapter` Protocol is in [`src/urml_ros2_runtime/substrate/base.py`](src/urml_ros2_runtime/substrate/base.py). Every method maps to one URML primitive's dispatch step. Implementations:
42
+
43
+ - Must return a typed result (`NavigationResult`, `DetectionResult`, etc.) with a `success: bool` and an optional `reason: str`.
44
+ - Must NOT raise on robot-side failures — failures are *returned* in `success=False`, not thrown. The runtime maps them to its on-error policy.
45
+ - May raise on unrecoverable errors (the substrate process died, the network broke). The runtime wraps those into `PrimitiveExecutionError`.
46
+
47
+ The methods:
48
+
49
+ | Adapter method | URML primitives | ROS 2 mapping |
50
+ |---|---|---|
51
+ | `send_navigation_goal` | `move_to`, `hover` (location-mode) | Nav2 `NavigateToPose` action; for arm motion, MoveIt 2 `MoveGroup` action |
52
+ | `send_docking_goal` | `dock` | Nav2 `DockRobot` action (Iron+); for older distros, a custom action wrapping Nav2's docking server |
53
+ | `send_manipulation_goal` | `grasp`, `release` | MoveIt 2 + gripper action server (per-gripper, e.g., `parallel_gripper_action_controller`) |
54
+ | `query_detection` | `detect` | Subscribe to a configured perception topic (e.g., `vision_msgs/Detection2DArray`) and resolve a single match. Default suggestion: `vision_msgs` with the URML-validator's `Identifier`-typed object classes as filter |
55
+ | `run_scan` | `scan` | [`scan_plan`](src/urml_ros2_runtime/scan_plan.py) expands the area into waypoints (`serpentine`, `grid`, `spiral`); one Nav2 `NavigateToPose` per waypoint, facing the next; once Nav2 reports SUCCEEDED, one image from `perception.image_topic` (`media: photo`) or one reading from `/sensor/<sensor>` (`media: sensor_only`). `adaptive` and `media: video` are refused. See [How `run_scan` works](#how-run_scan-works) |
56
+ | `take_measurement` | `measure` | Subscribe to a configured sensor topic; take one message; return |
57
+ | `capture_media` | `capture` | One `sensor_msgs/Image` from `perception.image_topic` for photos. Video returns `video_capture_not_supported`: no recorder (`rosbag2`) is started yet |
58
+ | `wait_for_condition` | `wait_for` | Subscribe to the relevant topic / service with a predicate matcher. For `condition.input: speech`, route through the LLM-bridge speech path |
59
+ | `wait_passively` | `wait` | A `rclpy.sleep_for` equivalent or a no-op timer node, depending on whether the robot needs to remain active |
60
+ | `emit_report` | `report` | Publish to a configured topic with a structured message. For `to: user`, route through the LLM-bridge response path |
61
+ | `emit_speech` (home profile) | `speak` | Publish to a TTS node (e.g., `audio_common` + Festival/Mimic, or a vendor TTS service) |
62
+ | `acquire_speech` (home profile) | `listen` | Subscribe to an STT node's transcription topic with `expected: choice|confirmation|free_form` mapping the result |
63
+
64
+ Drone-profile methods (PR #30 added validator support; runtime executor work is the parallel follow-up):
65
+
66
+ | Adapter method (future) | URML primitives | PX4 / MAVLink mapping |
67
+ |---|---|---|
68
+ | `send_takeoff_goal` | `take_off` | `MAV_CMD_NAV_TAKEOFF` via `mavros/cmd/takeoff` service |
69
+ | `send_land_goal` | `land` | `MAV_CMD_NAV_LAND` (or `_LAND_LOCAL`) via `mavros/cmd/land` |
70
+ | `send_return_to_home_goal` | `return_to_home` | `MAV_CMD_NAV_RETURN_TO_LAUNCH` via `mavros/cmd/return_to_launch` |
71
+
72
+ The PX4-side belongs in `reference/px4-runtime/` (which doesn't exist yet; Phase 2 target per the manifesto). The ROS 2 adapter could wrap these too if rclpy is paired with mavros, but the cleaner split is two separate reference runtimes.
73
+
74
+ ---
75
+
76
+ ## Where the code lives
77
+
78
+ - **Adapter:** [`src/urml_ros2_runtime/substrate/rclpy_adapter.py`](src/urml_ros2_runtime/substrate/rclpy_adapter.py) — `RclpyAdapter` class, all 12 ROSAdapter Protocol methods.
79
+ - **Config:** [`src/urml_ros2_runtime/substrate/adapter_config.py`](src/urml_ros2_runtime/substrate/adapter_config.py) — `AdapterConfig` pydantic model + `load_adapter_config` YAML loader.
80
+ - **Unit tests (hermetic, mocked rclpy):** [`tests/test_rclpy_adapter.py`](tests/test_rclpy_adapter.py) — runs on every host without ROS 2 installed.
81
+ - **Integration tests (gated, real ROS 2):** [`tests/integration/test_rclpy_adapter_live.py`](tests/integration/test_rclpy_adapter_live.py) — runs only under `ROS2_INTEGRATION=1` in CI on the Linux ROS 2 runner.
82
+
83
+ rclpy itself is *not* in `dependencies`; it's an optional extra (`pip install urml-ros2-runtime[ros2]`) because the rclpy wheel is unusual (ships with the ROS 2 distribution rather than PyPI in practice). The adapter imports rclpy lazily at construction time and raises a clear error if it's missing.
84
+
85
+ ---
86
+
87
+ ## Configuration surface (deployment-provided)
88
+
89
+ The adapter needs a deployment-provided config to know:
90
+
91
+ - Which ROS 2 namespace to use (default: empty / root).
92
+ - Which Nav2 action server to call (default: `/navigate_to_pose`).
93
+ - Which MoveIt 2 group to use for arm motion (default: `panda_arm` or `manipulator`).
94
+ - Which perception topic to subscribe to (default: `/vision_msgs/detections`).
95
+ - Which TTS / STT topic to use (no default; home-profile only).
96
+ - Per-station location → pose mapping (the validator resolves names; the adapter resolves the named pose against the actual world).
97
+ - Per-area region → polygon mapping, for `scan` over a manifest-declared area (RFC-0615).
98
+ - How wide one scan sample is (`scan.swath_m`), the most waypoints a scan may plan, and the frame for a literal scan polygon or bounding box.
99
+ - Per-gripper action client mapping.
100
+
101
+ Suggested format: a single `adapter.yaml` next to the manifest, loaded at adapter construction.
102
+
103
+ ```yaml
104
+ # adapter.yaml — example
105
+ ros2_namespace: ""
106
+ action_servers:
107
+ navigate_to_pose: /navigate_to_pose
108
+ move_group: /move_action
109
+ gripper:
110
+ claw_demo: /gripper_controller/follow_joint_trajectory
111
+ location_to_pose:
112
+ kitchen: { x: 3.2, y: 1.0, frame: map }
113
+ user: { x: 0.5, y: 0.5, frame: map }
114
+ region_to_polygon:
115
+ garden_bed: { frame: map, polygon: [[0, 0], [4, 0], [4, 2], [0, 2]] }
116
+ scan:
117
+ swath_m: 1.0 # width one sample covers; set it to the sensor's real footprint
118
+ max_waypoints: 200 # a plan with more is refused rather than driven
119
+ frame: map # frame for a literal polygon or bounding box
120
+ perception:
121
+ detection_topic: /vision_msgs/detections
122
+ image_topic: /camera/image_raw
123
+ speech:
124
+ output_topic: /tts/utter
125
+ input_topic: /stt/transcription
126
+ ```
127
+
128
+ This format is NOT normative URML — the adapter is free to use a different shape. But the v0.1 reference adapter ships with this format documented.
129
+
130
+ ### How `run_scan` works
131
+
132
+ The spec (Layer 2 §2.9) names the patterns but not their geometry. This adapter's reading, from [`scan_plan.py`](src/urml_ros2_runtime/scan_plan.py), which imports nothing from ROS so any runtime can reuse it:
133
+
134
+ - **Area.** A literal `polygon` or `bounding_box` is read in `scan.frame`; a `named_region` is looked up in `region_to_polygon` and carries its own frame. An unmapped name is refused (`scan_region_not_configured`).
135
+ - **Spacing.** A sample covers a square `swath_m` wide. Samples and lanes sit at most `swath_m * (1 - overlap)` apart, spread evenly so the outermost footprints reach the edges of the area's bounding box. Every waypoint is inside the area polygon.
136
+ - **Patterns.** `serpentine`: parallel lanes along the longer side, alternating direction. `grid`: the serpentine, then the area again in lanes at right angles, so each point is seen from two directions. `spiral`: the serpentine's points, visited outward from the middle in square rings. `adaptive` is refused: it refines around what the scan finds, and no anomaly detector is wired.
137
+ - **At each waypoint.** A `NavigateToPose` goal facing the next waypoint (with `altitude` as z, when given). Once Nav2 reports SUCCEEDED, one image or one sensor reading becomes a sample with its pose, frame and timestamp.
138
+ - **Failures.** A waypoint Nav2 aborts, or where no image or reading arrives, is skipped and listed under `skipped` with the reason. Nav2 being unavailable ends the scan at once. The scan succeeds when at least one sample was taken.
139
+ - **Result.** `samples`, `coverage` (the share of the area the taken samples' footprints cover, on a raster of a quarter swath), and `anomalies` (empty: no detector), plus `sample_count`, `waypoints`, `skipped`, `pattern`, `frame`, `area_m2`, `spacing_m` and `swath_m`.
140
+ - **Limits.** Only the waypoints are checked against the area. Nav2 plans the path between them, and in a concave area that path can cross outside the polygon, so the geofence belongs in Nav2's keep-out map too. A plan with more than `max_waypoints` waypoints is refused (`scan_too_many_waypoints`), including an overlap near 1, which is refused before the lattice is built.
141
+
142
+ ---
143
+
144
+ ## Testing strategy
145
+
146
+ Two layers:
147
+
148
+ ### 1. Unit tests with rclpy mocks
149
+
150
+ Replace the action clients with mocks; assert that `send_navigation_goal` sends the right Nav2 message, parses the right Nav2 response. ~30 tests for the full surface. No ROS 2 environment required for these.
151
+
152
+ ### 2. Integration tests with Gazebo simulator
153
+
154
+ A pinned Gazebo + TurtleBot 4 simulator stack. Eventually every navigation-compatible conformance fixture runs through `RclpyAdapter` against the simulated robot instead of `MockROSAdapter`. Fixtures that pass against the mock should pass against the simulator (modulo nondeterminism for things like timing — see *Open questions* §3).
155
+
156
+ CI gating: the `gazebo-e2e` job in [`.github/workflows/ros2-integration.yml`](../../.github/workflows/ros2-integration.yml). Manual-dispatch + weekly cron only — never per-push. It uploads sim/Nav2/pytest logs as artifacts on `always()`, so a failed run is diagnosable rather than opaque.
157
+
158
+ **What runs end-to-end today:** [`tests/integration/test_nav_patrol_gazebo_e2e.py`](tests/integration/test_nav_patrol_gazebo_e2e.py) takes the `home/nav_patrol_positive` fixture (three plain `move_to` goals) and runs it through the *same* `ConformanceRunner` the hermetic suite uses, with `adapter_factory` wired to a live `RclpyAdapter`. This closes the full loop: URML program → validator → ConformanceRunner → RclpyAdapter → Nav2 → a simulated TurtleBot 4 that actually drives. A stock TB4 sim only exposes Nav2 navigation (its dock is iRobot Create 3's `/dock`, not Nav2 `DockRobot`; no gripper/camera), so the navigation slice is what's covered; perception/manipulation/docking e2e need a richer sim and are tracked as follow-ups below.
159
+
160
+ **Scan end to end:** [`tests/integration/test_scan_nav2_e2e.py`](tests/integration/test_scan_nav2_e2e.py) (`URML_NAV2_SCAN_E2E=1`) runs a validated program with one `scan` step through `URMLRuntime` and a live `RclpyAdapter` against Nav2's loopback simulator (`nav2_bringup`'s `tb3_loopback_simulation.launch.py`: the real planner, controller and behavior tree over a kinematic robot, no Gazebo), with the test publishers in [`tests/integration/nav2_loopback/`](tests/integration/nav2_loopback/) standing in for a camera and a soil probe. A listen-only witness on `map` -> `base_link` checks that the robot came within 0.35 m of every waypoint it reported a sample at. It also checks that a goal Nav2 aborts comes back as a failure. It passed three times on 2026-09-29 in WSL2 (Ubuntu 24.04, ROS 2 Jazzy, Nav2 1.3.13); the record, with the commands, is [`tests/integration/nav2-runs/2026-09-29-nav2-loopback-scan.md`](tests/integration/nav2-runs/2026-09-29-nav2-loopback-scan.md). It is not in CI.
161
+
162
+ #### Local repro (WSL2 + ROS 2 Jazzy)
163
+
164
+ ```bash
165
+ # In WSL2 Ubuntu 24.04 with ROS 2 Jazzy installed:
166
+ sudo apt-get install -y ros-jazzy-turtlebot4-simulator \
167
+ ros-jazzy-turtlebot4-navigation ros-jazzy-nav2-bringup
168
+
169
+ # Terminal 1 — bring up the sim + Nav2 (headless; drop headless:=true for the GUI):
170
+ source /opt/ros/jazzy/setup.bash
171
+ export LIBGL_ALWAYS_SOFTWARE=1 # only needed on a GPU-less box
172
+ ros2 launch turtlebot4_ignition_bringup turtlebot4_ignition.launch.py \
173
+ nav2:=true slam:=true rviz:=false headless:=true
174
+
175
+ # Terminal 2 — once /navigate_to_pose is up, run the e2e:
176
+ source /opt/ros/jazzy/setup.bash
177
+ cd reference/ros2-runtime
178
+ URML_GAZEBO_E2E=1 python3 -m pytest tests/integration/test_nav_patrol_gazebo_e2e.py -v
179
+ ```
180
+
181
+ The adapter↔world pose mapping lives in [`tests/integration/adapter_nav_patrol.yaml`](tests/integration/adapter_nav_patrol.yaml). If you run a non-default world, edit `location_to_pose` to match — that file *is* the deployment boundary the design intends.
182
+
183
+ > The CI launch invocations were authored without a Gazebo-capable host. Package and launch-file names follow current TurtleBot 4 / Jazzy docs, but the first real `gazebo-e2e` run is a **calibration run**: if a launch arg or package name differs on the installed TB4 version, the uploaded artifacts show exactly what to pin. Treat the first run's result as setup feedback, not a regression.
184
+
185
+ ---
186
+
187
+ ## Open questions
188
+
189
+ 1. **Which ROS 2 distros?** Jazzy LTS is the most likely first target (current LTS as of 2026). Humble may also be supported. Older distros (Foxy, Galactic) are EOL; not supported.
190
+
191
+ 2. **rclpy vs. rcl/raw bindings.** rclpy is the obvious choice for the reference adapter. A future high-performance adapter might use `rcl` C bindings directly; out of scope here.
192
+
193
+ 3. **Action timing and the validator's static checks.** The validator says "this program can be executed against this manifest." It does NOT say "this program will complete in N seconds." A real robot's action might time out or stall. The adapter's contract is: return `success: True` only when the action completes, meaning its final status is SUCCEEDED; an aborted or canceled goal returns `success: False` with `reason: "goal_aborted"` or `"goal_canceled"` (plus Nav2's `error_code` and `error_msg` when it sends them). Until 2026-09-28 the adapter counted any returned result as success. The runtime's `on_error` policy decides what happens next. This is the same contract `MockROSAdapter` follows.
194
+
195
+ 4. **Live-state queries.** Some primitives might want to read live robot state (current battery level for `wait_for(condition.sensor_threshold)`, etc.). The Protocol covers this through `take_measurement` and `wait_for_condition`. A future RFC may extend.
196
+
197
+ 5. **Multi-robot deployments.** v0.1 assumes one adapter ↔ one robot. Fleet management (one URML program orchestrating multiple robots) is a separate concern, likely a future profile or a fleet-manager layer above the runtime.
198
+
199
+ 6. **PX4 / mavros integration in the same adapter.** The cleaner split is two separate reference runtimes (`reference/ros2-runtime` for ROS 2 / Nav2; `reference/px4-runtime` for PX4 / MAVLink). But many drone projects pair them — Nav2 + mavros at the same time. A flexible adapter might support both, configured via the adapter.yaml. Open question; doesn't block the v0.1 home-profile ROS 2 adapter.
200
+
201
+ ---
202
+
203
+ ## Implementation phases
204
+
205
+ When this work starts (Phase 1+):
206
+
207
+ **Phase 1**: Skeleton + navigation only.
208
+ - `RclpyAdapter` class with construction; rclpy lazy import.
209
+ - `send_navigation_goal` against Nav2.
210
+ - Adapter.yaml schema (proposed above) + a config loader.
211
+ - Unit tests with mocked rclpy.
212
+ - Integration test on a Gazebo TurtleBot navigating to a fixed pose.
213
+
214
+ **Phase 2**: Manipulation.
215
+ - `send_manipulation_goal` against MoveIt 2 + a gripper action.
216
+ - Gripper config in adapter.yaml.
217
+ - Unit + integration tests.
218
+
219
+ **Phase 3**: Perception.
220
+ - `query_detection`, `run_scan`, `take_measurement`, `capture_media`.
221
+ - Subscriptions to configurable topics.
222
+ - Test fixtures with mocked perception output.
223
+
224
+ **Phase 4**: Home-profile speech.
225
+ - `emit_speech` + `acquire_speech`.
226
+ - Adapter.yaml gains speech topics.
227
+ - An end-to-end Gazebo + TTS/STT integration test, if a deployable TTS/STT stack is reasonably available.
228
+
229
+ **Phase 5**: Drone primitives (only if the same adapter handles PX4-via-mavros).
230
+ - `send_takeoff_goal` / `send_land_goal` / `send_return_to_home_goal` via `mavros/cmd/*`.
231
+ - More likely: a separate `reference/px4-runtime` package owning these. Decision deferred.
232
+
233
+ ---
234
+
235
+ ## What this doc is NOT
236
+
237
+ - **Not a tutorial.** Once the implementation exists, a tutorial walks through running it locally. This doc is for the implementer, not the user.
238
+ - **Not a commitment to ROS 2 only.** URML's Protocol is substrate-neutral by design. Other adapters (PX4, OPC UA, vendor SDKs) implement the same surface and have their own integration docs.
239
+ - **Not normative.** The adapter is reference code, not part of the URML specification. Conformance is judged against the fixture suite, not against this implementation.
240
+
241
+ ---
242
+
243
+ ## Related documents
244
+
245
+ - [`src/urml_ros2_runtime/substrate/base.py`](src/urml_ros2_runtime/substrate/base.py) — the Protocol the adapter implements.
246
+ - [`src/urml_ros2_runtime/substrate/mock.py`](src/urml_ros2_runtime/substrate/mock.py) — the hermetic mock that ships in v0.1.
247
+ - [`/conformance/`](../../conformance/) — the declarative fixtures that any adapter must satisfy.
248
+ - [`/docs/rfcs/0002-initial-primitive-vocabulary.md`](../../docs/rfcs/0002-initial-primitive-vocabulary.md) §Appendix A — per-primitive ROS 2 implementation sketches (and non-ROS sketches for PX4 / OPC UA / KUKA / ABB / IEC 61131-3).
249
+ - [`/MANIFESTO.md`](../../MANIFESTO.md) §Roadmap Snapshot — when ROS 2 + PX4 reference runtimes are scheduled.
@@ -0,0 +1,105 @@
1
+ Metadata-Version: 2.5
2
+ Name: urml-ros2-runtime
3
+ Version: 0.5.0
4
+ Summary: ROS 2 reference runtime for URML — Universal Robot Language.
5
+ Project-URL: Homepage, https://github.com/urml-dev/URML
6
+ Project-URL: Repository, https://github.com/urml-dev/URML
7
+ Project-URL: Issues, https://github.com/urml-dev/URML/issues
8
+ Author: URML Maintainers
9
+ License: BUSL-1.1
10
+ Keywords: robotics,ros2,runtime,urml
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: Other/Proprietary License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Scientific/Engineering
19
+ Requires-Python: >=3.11
20
+ Requires-Dist: pydantic<3,>=2.6
21
+ Requires-Dist: pyyaml<7,>=6.0
22
+ Requires-Dist: urml-validator>=0.5.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: mypy>=1.10; extra == 'dev'
25
+ Requires-Dist: pytest-cov>=5; extra == 'dev'
26
+ Requires-Dist: pytest>=8; extra == 'dev'
27
+ Requires-Dist: ruff>=0.5; extra == 'dev'
28
+ Requires-Dist: types-pyyaml>=6.0; extra == 'dev'
29
+ Provides-Extra: ros2
30
+ Description-Content-Type: text/markdown
31
+
32
+ <p align="center">
33
+ <a href="https://urml.dev"><img src="https://urml.dev/favicon.svg" alt="URML" width="72" height="72"></a>
34
+ </p>
35
+
36
+ <p align="center">
37
+ A small, opinionated, human-readable language for describing robot intent.
38
+ </p>
39
+
40
+ <p align="center">
41
+ <a href="https://urml.dev"><b>urml.dev</b></a>
42
+ </p>
43
+
44
+ ---
45
+
46
+ # ROS 2 Reference Runtime
47
+
48
+ **Status:** Phase 1 in flight. **Skeleton + substrate Protocol + hermetic MockROSAdapter + end-to-end red-mug execution + full composition (Sequence + Branch + Parallel + Retry) landed** at `0.1.0a0` (pre-alpha). The real `rclpy`-backed adapter is the next milestone.
49
+
50
+ ## What this is
51
+
52
+ The **first** URML reference runtime. Translates a validated URML program into ROS 2 actions, services, and topics; honors declared capabilities and the active safety envelope at every step.
53
+
54
+ 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`](../../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.
55
+
56
+ ## Substrate
57
+
58
+ - **ROS 2** (Humble, Iron, Jazzy, and later LTS releases). The runtime tracks LTS releases.
59
+ - **Nav2** for navigation primitives (`move_to`).
60
+ - **MoveIt 2** for manipulation primitives (`grasp`, arm control).
61
+ - Perception pipelines per profile (object detection for `detect`).
62
+
63
+ ## Language
64
+
65
+ - **C++17** for nodes on the critical path (anything per-tick or per-message).
66
+ - **Python** for orchestration, the URML-to-ROS-2 compiler, tests, and the bridge to the validator.
67
+
68
+ Both follow the conventions in [`CLAUDE.md`](../../CLAUDE.md) §Working Conventions — type annotations, `mypy --strict` for Python, concepts where reasonable for C++.
69
+
70
+ ## Conformance contract
71
+
72
+ 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.
73
+
74
+ The runtime ships its declared conformance in a `CONFORMANCE.md` file alongside this README when the first version cuts. Example:
75
+
76
+ ```yaml
77
+ declares:
78
+ layer-1-hal: 0.1.0
79
+ layer-2-primitives: 0.1.0
80
+ layer-3-behavior: 0.1.0
81
+ layer-4-nl-grammar: 0.1.0
82
+ profiles:
83
+ home: 0.1.0
84
+ ```
85
+
86
+ ## Architecture (planned)
87
+
88
+ The runtime is a thin Layer-0 translator with three responsibilities:
89
+
90
+ 1. **Validate.** Before executing anything, run the URML program through [`/reference/validator/`](../validator/) against the connected robot's capability manifest. If validation fails, the runtime refuses to execute and returns the structured error to whatever produced the program (often the LLM bridge).
91
+ 2. **Translate.** Compile each primitive into its ROS-2 equivalent: `move_to(kitchen)` becomes a Nav2 `NavigateToPose` goal; `grasp(target, force: gentle)` becomes a MoveIt 2 plan with a configured gripper command; `detect(object: mug)` becomes a perception-pipeline query.
92
+ 3. **Honor composition.** Implement Layer-3 sequence / branch / parallel / retry / on-error against ROS-2 lifecycle and action semantics.
93
+
94
+ 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.
95
+
96
+ ## Core Commitment
97
+
98
+ 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.
99
+
100
+ ## Related documents
101
+
102
+ - [`/spec/layer-1-hal/`](../../spec/layer-1-hal/) — what manifests this runtime reads.
103
+ - [`/spec/layer-2-primitives/`](../../spec/layer-2-primitives/) — what primitives it compiles.
104
+ - [`/spec/layer-3-behavior/`](../../spec/layer-3-behavior/) — composition semantics it implements.
105
+ - [`/conformance/`](../../conformance/) — the test suite that decides conformance.
@@ -0,0 +1,74 @@
1
+ <p align="center">
2
+ <a href="https://urml.dev"><img src="https://urml.dev/favicon.svg" alt="URML" width="72" height="72"></a>
3
+ </p>
4
+
5
+ <p align="center">
6
+ A small, opinionated, human-readable language for describing robot intent.
7
+ </p>
8
+
9
+ <p align="center">
10
+ <a href="https://urml.dev"><b>urml.dev</b></a>
11
+ </p>
12
+
13
+ ---
14
+
15
+ # ROS 2 Reference Runtime
16
+
17
+ **Status:** Phase 1 in flight. **Skeleton + substrate Protocol + hermetic MockROSAdapter + end-to-end red-mug execution + full composition (Sequence + Branch + Parallel + Retry) landed** at `0.1.0a0` (pre-alpha). The real `rclpy`-backed adapter is the next milestone.
18
+
19
+ ## What this is
20
+
21
+ The **first** URML reference runtime. Translates a validated URML program into ROS 2 actions, services, and topics; honors declared capabilities and the active safety envelope at every step.
22
+
23
+ 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`](../../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.
24
+
25
+ ## Substrate
26
+
27
+ - **ROS 2** (Humble, Iron, Jazzy, and later LTS releases). The runtime tracks LTS releases.
28
+ - **Nav2** for navigation primitives (`move_to`).
29
+ - **MoveIt 2** for manipulation primitives (`grasp`, arm control).
30
+ - Perception pipelines per profile (object detection for `detect`).
31
+
32
+ ## Language
33
+
34
+ - **C++17** for nodes on the critical path (anything per-tick or per-message).
35
+ - **Python** for orchestration, the URML-to-ROS-2 compiler, tests, and the bridge to the validator.
36
+
37
+ Both follow the conventions in [`CLAUDE.md`](../../CLAUDE.md) §Working Conventions — type annotations, `mypy --strict` for Python, concepts where reasonable for C++.
38
+
39
+ ## Conformance contract
40
+
41
+ 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.
42
+
43
+ The runtime ships its declared conformance in a `CONFORMANCE.md` file alongside this README when the first version cuts. Example:
44
+
45
+ ```yaml
46
+ declares:
47
+ layer-1-hal: 0.1.0
48
+ layer-2-primitives: 0.1.0
49
+ layer-3-behavior: 0.1.0
50
+ layer-4-nl-grammar: 0.1.0
51
+ profiles:
52
+ home: 0.1.0
53
+ ```
54
+
55
+ ## Architecture (planned)
56
+
57
+ The runtime is a thin Layer-0 translator with three responsibilities:
58
+
59
+ 1. **Validate.** Before executing anything, run the URML program through [`/reference/validator/`](../validator/) against the connected robot's capability manifest. If validation fails, the runtime refuses to execute and returns the structured error to whatever produced the program (often the LLM bridge).
60
+ 2. **Translate.** Compile each primitive into its ROS-2 equivalent: `move_to(kitchen)` becomes a Nav2 `NavigateToPose` goal; `grasp(target, force: gentle)` becomes a MoveIt 2 plan with a configured gripper command; `detect(object: mug)` becomes a perception-pipeline query.
61
+ 3. **Honor composition.** Implement Layer-3 sequence / branch / parallel / retry / on-error against ROS-2 lifecycle and action semantics.
62
+
63
+ 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.
64
+
65
+ ## Core Commitment
66
+
67
+ 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.
68
+
69
+ ## Related documents
70
+
71
+ - [`/spec/layer-1-hal/`](../../spec/layer-1-hal/) — what manifests this runtime reads.
72
+ - [`/spec/layer-2-primitives/`](../../spec/layer-2-primitives/) — what primitives it compiles.
73
+ - [`/spec/layer-3-behavior/`](../../spec/layer-3-behavior/) — composition semantics it implements.
74
+ - [`/conformance/`](../../conformance/) — the test suite that decides conformance.