urml-humanoid-runtime 0.5.0__py3-none-any.whl

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.
@@ -0,0 +1,36 @@
1
+ """urml_humanoid_runtime — humanoid reference runtime for URML.
2
+
3
+ DigitAdapter
4
+ Agility Robotics Digit, a ROS 2 bipedal humanoid. Composes the ROS 2
5
+ runtime's RclpyAdapter (the single-sourced-substrate pattern). v0.1
6
+ covers the locomotion subset; whole-body/bimanual manipulation is a
7
+ future RFC. rclpy is lazy inside RclpyAdapter, so this module loads
8
+ on every host.
9
+
10
+ HUMANOID_ADAPTERS
11
+ Name → class registry ({"digit": DigitAdapter}) for config-driven
12
+ selection (CI matrices, the conformance adapter_factory).
13
+
14
+ Agility Digit is the one humanoid on the multi-brand list with a usable
15
+ public SDK + sim, so it is the only one with an adapter. Tesla Optimus,
16
+ Figure, Apptronik Apollo and 1X NEO have no public SDK; per the plan
17
+ they are covered manifest + spec only, landing with the Phase-5
18
+ Mobility.drive_type RFC (a humanoid manifest cannot validate until that
19
+ schema gap is closed). No adapter is written for them — that would be
20
+ code with nothing to run against.
21
+ """
22
+
23
+ from __future__ import annotations
24
+
25
+ from urml_humanoid_runtime._version import __version__
26
+ from urml_humanoid_runtime.digit import DigitAdapter
27
+
28
+ HUMANOID_ADAPTERS: dict[str, type] = {
29
+ "digit": DigitAdapter,
30
+ }
31
+
32
+ __all__ = [
33
+ "HUMANOID_ADAPTERS",
34
+ "DigitAdapter",
35
+ "__version__",
36
+ ]
@@ -0,0 +1,3 @@
1
+ """Package version. Bumped per release."""
2
+
3
+ __version__ = "0.5.0"
@@ -0,0 +1,273 @@
1
+ """DigitAdapter — Agility Robotics Digit, a ROS 2 bipedal humanoid.
2
+
3
+ Digit exposes ROS 2 interfaces (plus a JSON/WebSocket low-level API and
4
+ a MuJoCo/Gazebo sim), so this adapter composes the ROS 2 runtime's
5
+ :class:`RclpyAdapter` — the same single-sourced-substrate pattern the
6
+ industrial-arm and ANYmal adapters use. The per-brand surface is real
7
+ (distinct class, brand-scoped not-supported tag); ROS 2 plumbing is not
8
+ duplicated.
9
+
10
+ ## v0.1 scope: locomotion + whole-body manipulation
11
+
12
+ Digit is a logistics humanoid: a biped (locomotion) with two arms.
13
+ Both classes are in scope as of RFC-0010 (whole-body / bimanual
14
+ manipulation). This adapter supports the locomotion path —
15
+ `move_to`/`hover`, `wait`, `measure`, `wait_for`, `report` — and
16
+ manipulation — `grasp`/`release` (with the optional `arm` selector)
17
+ and `bimanual` (decomposed by the runtime into two arm-addressed
18
+ manipulation goals, per RFC-0010). All of these delegate to the
19
+ composed ROS 2 adapter.
20
+
21
+ It still returns ``not_supported_on_humanoid[digit]`` for `dock`,
22
+ `detect`, `scan`, `capture`, `speak`, `listen`, and the drone trio:
23
+ onboard perception and speech pair via a companion adapter (a
24
+ manipulation `$target` is supplied by that companion's `detect`). This
25
+ is the same returned-not-raised pattern PX4Adapter and the other
26
+ families use.
27
+
28
+ ``rclpy`` is imported lazily inside :class:`RclpyAdapter`, so importing
29
+ this module works on every host; constructing the adapter needs a
30
+ sourced ROS 2 environment. Hermetic tests inject a fake inner adapter
31
+ via ``inner_factory`` and never touch rclpy.
32
+ """
33
+
34
+ from __future__ import annotations
35
+
36
+ from collections.abc import Callable
37
+ from contextlib import suppress
38
+ from typing import Any, Literal
39
+
40
+ from urml_ros2_runtime.substrate.adapter_config import AdapterConfig
41
+ from urml_ros2_runtime.substrate.base import (
42
+ ProgramCallResult,
43
+ unsupported_program_call,
44
+ CaptureResult,
45
+ DetectionResult,
46
+ ListenResult,
47
+ ManipulationResult,
48
+ MeasurementResult,
49
+ NavigationResult,
50
+ ROSAdapter,
51
+ ScanResult,
52
+ SubstrateResult,
53
+ WaitResult,
54
+ )
55
+ from urml_ros2_runtime.substrate.rclpy_adapter import RclpyAdapter
56
+
57
+ from urml_humanoid_runtime._version import __version__
58
+
59
+ __all__ = ["DigitAdapter", "__version__"]
60
+
61
+ _NOT_SUPPORTED = (
62
+ "not_supported_on_humanoid[digit]: v0.1 covers locomotion and whole-body "
63
+ "manipulation (RFC-0010). {capability} is not on Digit's own surface. "
64
+ "Pair Digit with a companion adapter for full coverage; the URML program, "
65
+ "manifest, and validator are unchanged."
66
+ )
67
+
68
+ InnerFactory = Callable[[], ROSAdapter]
69
+
70
+
71
+ class DigitAdapter:
72
+ """Agility Digit adapter (ROS 2), composing RclpyAdapter. v0.1: locomotion."""
73
+
74
+ BRAND = "digit"
75
+
76
+ def __init__(
77
+ self,
78
+ config: AdapterConfig | None = None,
79
+ *,
80
+ node_name: str = "urml_digit_humanoid",
81
+ inner_factory: InnerFactory | None = None,
82
+ ) -> None:
83
+ self._config = config or AdapterConfig()
84
+ factory: InnerFactory = inner_factory or (lambda: RclpyAdapter(self._config, node_name=node_name))
85
+ self._inner: ROSAdapter = factory()
86
+ self._closed = False
87
+
88
+ def close(self) -> None:
89
+ if self._closed:
90
+ return
91
+ inner_close = getattr(self._inner, "close", None)
92
+ if callable(inner_close):
93
+ with suppress(Exception):
94
+ inner_close()
95
+ self._closed = True
96
+
97
+ def __enter__(self) -> DigitAdapter:
98
+ return self
99
+
100
+ def __exit__(self, *_: object) -> None:
101
+ self.close()
102
+
103
+ def _reason(self, capability: str) -> str:
104
+ return _NOT_SUPPORTED.format(capability=capability)
105
+
106
+ # ------------------------------------------------------------------
107
+ # Supported (locomotion subset) — delegate to the composed adapter
108
+ # ------------------------------------------------------------------
109
+
110
+ def send_navigation_goal(
111
+ self,
112
+ *,
113
+ location: str | None = None,
114
+ pose: dict[str, float] | None = None,
115
+ frame: str | None = None,
116
+ carrying: dict[str, Any] | None = None,
117
+ speed: float | None = None,
118
+ ) -> NavigationResult:
119
+ return self._inner.send_navigation_goal(
120
+ location=location, pose=pose, frame=frame, carrying=carrying, speed=speed
121
+ )
122
+
123
+ def take_measurement(self, *, what: str, target: str | None, sensor: str | None) -> MeasurementResult:
124
+ return self._inner.take_measurement(what=what, target=target, sensor=sensor)
125
+
126
+ def wait_for_condition(
127
+ self,
128
+ *,
129
+ kind: Literal["event", "signal", "input", "sensor_threshold"],
130
+ name: str | None,
131
+ input_mode: str | None,
132
+ threshold: dict[str, Any] | None,
133
+ timeout_seconds: float | None,
134
+ ) -> WaitResult:
135
+ return self._inner.wait_for_condition(
136
+ kind=kind, name=name, input_mode=input_mode, threshold=threshold, timeout_seconds=timeout_seconds
137
+ )
138
+
139
+ def wait_passively(self, *, duration_seconds: float) -> SubstrateResult:
140
+ return self._inner.wait_passively(duration_seconds=duration_seconds)
141
+
142
+ def emit_report(
143
+ self,
144
+ *,
145
+ to: str,
146
+ facts: dict[str, Any],
147
+ attachments: list[str] | None,
148
+ status: Literal["success", "partial", "failure"],
149
+ severity: Literal["info", "notice", "warning", "error"],
150
+ ) -> SubstrateResult:
151
+ return self._inner.emit_report(
152
+ to=to, facts=facts, attachments=attachments, status=status, severity=severity
153
+ )
154
+
155
+ def send_manipulation_goal(
156
+ self,
157
+ *,
158
+ action: Literal["grasp", "release"],
159
+ target: dict[str, Any] | None = None,
160
+ force_n: float | None = None,
161
+ approach: Literal["top", "side", "front", "auto"] = "auto",
162
+ release_mode: Literal["drop", "place", "hand_to_user"] | None = None,
163
+ release_at: dict[str, Any] | str | None = None,
164
+ arm: str | None = None,
165
+ grasp_type: str | None = None,
166
+ target_motion: str | None = None,
167
+ ) -> ManipulationResult:
168
+ """Manipulation, including the `arm` selector (RFC-0010).
169
+
170
+ `bimanual` reaches the adapter as two arm-addressed calls (the
171
+ runtime decomposes it), so a single delegating method covers both
172
+ the single-arm and whole-body paths.
173
+ """
174
+ return self._inner.send_manipulation_goal(
175
+ action=action,
176
+ target=target,
177
+ force_n=force_n,
178
+ approach=approach,
179
+ release_mode=release_mode,
180
+ release_at=release_at,
181
+ arm=arm,
182
+ grasp_type=grasp_type,
183
+ target_motion=target_motion,
184
+ )
185
+
186
+ # ------------------------------------------------------------------
187
+ # Not supported in v0.1 (companion-paired: perception, speech)
188
+ # ------------------------------------------------------------------
189
+
190
+ def send_docking_goal(self, *, station: str, service: str, until: str | None = None) -> NavigationResult:
191
+ return NavigationResult(success=False, reason=self._reason("docking"))
192
+
193
+ def query_detection(
194
+ self,
195
+ *,
196
+ object_class: str,
197
+ attributes: dict[str, Any] | None = None,
198
+ where_near: str | None = None,
199
+ where_within: float | None = None,
200
+ ) -> DetectionResult:
201
+ return DetectionResult(success=False, reason=self._reason("onboard detection"))
202
+
203
+ def run_scan(
204
+ self,
205
+ *,
206
+ area: dict[str, Any],
207
+ pattern: Literal["serpentine", "spiral", "grid", "adaptive"],
208
+ overlap: float,
209
+ altitude: float | None,
210
+ media: Literal["photo", "video", "sensor_only"],
211
+ sensor: str | None,
212
+ ) -> ScanResult:
213
+ return ScanResult(success=False, reason=self._reason("area scan"))
214
+
215
+ def capture_media(
216
+ self,
217
+ *,
218
+ media: Literal["photo", "video"],
219
+ target: str | None,
220
+ duration_seconds: float | None,
221
+ attributes: dict[str, Any] | None,
222
+ camera: str | None = None,
223
+ ) -> CaptureResult:
224
+ return CaptureResult(success=False, reason=self._reason("capture"))
225
+
226
+ def emit_speech(
227
+ self,
228
+ *,
229
+ utterance: str,
230
+ locale: str | None,
231
+ style: Literal["notice", "warning", "conversational"],
232
+ interrupt: bool,
233
+ ) -> SubstrateResult:
234
+ return SubstrateResult(success=False, reason=self._reason("speech"))
235
+
236
+ def acquire_speech(
237
+ self,
238
+ *,
239
+ prompt: str | None,
240
+ locale: str | None,
241
+ timeout_seconds: float | None,
242
+ expected: Literal["free_form", "confirmation", "choice"],
243
+ choices: list[str] | None,
244
+ ) -> ListenResult:
245
+ return ListenResult(success=False, reason=self._reason("listening"))
246
+
247
+ def send_takeoff_goal(self, *, altitude: float, climb_rate: float | None = None) -> NavigationResult:
248
+ return NavigationResult(success=False, reason=self._reason("flight capability"))
249
+
250
+ def send_land_goal(
251
+ self,
252
+ *,
253
+ at: str | None = None,
254
+ precision: Literal["standard", "precise"] = "standard",
255
+ ) -> NavigationResult:
256
+ return NavigationResult(success=False, reason=self._reason("flight capability"))
257
+
258
+ def send_return_to_home_goal(
259
+ self,
260
+ *,
261
+ speed: float | None = None,
262
+ altitude: float | None = None,
263
+ ) -> NavigationResult:
264
+ return NavigationResult(success=False, reason=self._reason("flight capability"))
265
+
266
+ def call_named_program(
267
+ self,
268
+ *,
269
+ name: str,
270
+ args: dict[str, Any] | None = None,
271
+ ) -> ProgramCallResult:
272
+ """``call_program``: this substrate exposes no named programs (RFC-0015)."""
273
+ return unsupported_program_call('humanoid')
File without changes
@@ -0,0 +1,96 @@
1
+ Metadata-Version: 2.5
2
+ Name: urml-humanoid-runtime
3
+ Version: 0.5.0
4
+ Summary: Humanoid reference runtime for URML — Agility Digit (locomotion subset, v0.1).
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: agility,biped,digit,humanoid,robotics,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-ros2-runtime>=0.5.0
23
+ Requires-Dist: urml-validator>=0.5.0
24
+ Provides-Extra: dev
25
+ Requires-Dist: mypy>=1.10; extra == 'dev'
26
+ Requires-Dist: pytest-cov>=5; extra == 'dev'
27
+ Requires-Dist: pytest>=8; extra == 'dev'
28
+ Requires-Dist: ruff>=0.5; extra == 'dev'
29
+ Description-Content-Type: text/markdown
30
+
31
+ <p align="center">
32
+ <a href="https://urml.dev"><img src="https://urml.dev/favicon.svg" alt="URML" width="72" height="72"></a>
33
+ </p>
34
+
35
+ <p align="center">
36
+ A small, opinionated, human-readable language for describing robot intent.
37
+ </p>
38
+
39
+ <p align="center">
40
+ <a href="https://urml.dev"><b>urml.dev</b></a>
41
+ </p>
42
+
43
+ ---
44
+
45
+ # urml-humanoid-runtime
46
+
47
+ **Humanoid reference runtime for URML** — `DigitAdapter` for **Agility Robotics Digit**.
48
+
49
+ Of the humanoids on the multi-brand target list, Digit is the only one with a usable public SDK + simulator. Tesla Optimus, Figure, Apptronik Apollo and 1X NEO have no public developer access, so per the plan they are covered **manifest + spec only** (no adapter — code with nothing to run against would be dishonest). Those manifests land with the Phase-5 `Mobility.drive_type` RFC, since a humanoid manifest cannot validate until that schema gap is closed.
50
+
51
+ ## Design
52
+
53
+ Digit exposes ROS 2 interfaces, so `DigitAdapter` composes the ROS 2 runtime's `RclpyAdapter` — the same single-sourced-substrate pattern the industrial-arm and ANYmal adapters use. Distinct first-class class, brand-scoped not-supported tag, no duplicated ROS 2 plumbing.
54
+
55
+ ## v0.1 scope: the locomotion subset
56
+
57
+ Digit does whole-body manipulation, but URML `grasp` requires a detected `$target` and whole-body/bimanual semantics are a deliberate **future RFC** (per the multi-brand plan: "v0.1 humanoid coverage is the locomotion + single-arm subset"). v0.1 supports the locomotion path and reports the rest honestly:
58
+
59
+ | URML primitive | v0.1 |
60
+ |---|---|
61
+ | `move_to` / `hover`, `wait`, `measure`, `wait_for`, `report` | delegated to the composed ROS 2 substrate |
62
+ | `grasp` / `release`, `dock`, `detect`, `scan`, `capture`, `speak`, `listen`, drone trio | `not_supported_on_humanoid[digit]: ...` (returned, not raised) |
63
+
64
+ ## Install / use
65
+
66
+ ```bash
67
+ pip install -e reference/humanoid-runtime # needs a sourced ROS 2 env to construct
68
+ ```
69
+
70
+ ```python
71
+ from urml_conformance import ConformanceRunner
72
+ from urml_humanoid_runtime import HUMANOID_ADAPTERS
73
+
74
+ runner = ConformanceRunner(adapter_factory=lambda: HUMANOID_ADAPTERS["digit"]())
75
+ ```
76
+
77
+ ## Status
78
+
79
+ **v0.1 (this release):**
80
+ - `DigitAdapter` (composes `RclpyAdapter`, locomotion subset) + `HUMANOID_ADAPTERS` registry.
81
+ - Hermetic unit tests: delegation, every v0.1 not-supported sentinel, the conformance hook, `runtime_checkable` conformance, context-manager teardown — no ROS 2 install required.
82
+ - Gated `.github/workflows/humanoid-integration.yml`: `digit-smoke`, `digit-arm64-build` (hermetic suite under `linux/arm64` QEMU), and a `digit-sim-e2e` that skips cleanly without a sim host (the established px4/ros2 convention).
83
+
84
+ **Follow-ups (not yet):**
85
+ - US-compliant Digit manifest (Agility — US), plus the manifest+spec-only entries for Tesla Optimus / Figure / Apptronik Apollo / 1X NEO. All blocked on the Phase-5 `Mobility.drive_type` RFC (no `biped`/`humanoid` value); they land with it. Correct sequencing, not a shortcut.
86
+ - Whole-body / bimanual manipulation primitives (a separate future RFC); then Digit's manipulation path moves out of not-supported.
87
+
88
+ ## Core Commitment
89
+
90
+ 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.
91
+
92
+ ## Related documents
93
+
94
+ - [`/reference/ros2-runtime/`](../ros2-runtime/) — the substrate engine `DigitAdapter` composes.
95
+ - [`/reference/legged-runtime/`](../legged-runtime/) — the sibling family sharing the compose pattern.
96
+ - [`/conformance/`](../../conformance/) — the test suite that decides conformance.
@@ -0,0 +1,7 @@
1
+ urml_humanoid_runtime/__init__.py,sha256=zoPtWJB9FlJ0ESOVr70RpXG6Yw29LUbspZwYz2Q80Oo,1298
2
+ urml_humanoid_runtime/_version.py,sha256=GhEpeFCtTCp-bVev1I9B_MSg50q8bPayhz1y1kQbgBU,66
3
+ urml_humanoid_runtime/digit.py,sha256=kIKiJuqVYmqbweAb377ZZyO-Fx3aP6Oy5THRvLL0EMs,9738
4
+ urml_humanoid_runtime/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ urml_humanoid_runtime-0.5.0.dist-info/METADATA,sha256=EJU5daXLA23M0ArZwu44btuBpOHgHNLHVo1g6e6iLK8,4877
6
+ urml_humanoid_runtime-0.5.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
7
+ urml_humanoid_runtime-0.5.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any