urml-humanoid-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.
@@ -0,0 +1,117 @@
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
115
+
116
+ # Claude Code session worktrees (`claude -w <name>`); see AGENTS.md "Parallel sessions".
117
+ .claude/worktrees/
@@ -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,66 @@
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
+ # urml-humanoid-runtime
16
+
17
+ **Humanoid reference runtime for URML** — `DigitAdapter` for **Agility Robotics Digit**.
18
+
19
+ 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.
20
+
21
+ ## Design
22
+
23
+ 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.
24
+
25
+ ## v0.1 scope: the locomotion subset
26
+
27
+ 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:
28
+
29
+ | URML primitive | v0.1 |
30
+ |---|---|
31
+ | `move_to` / `hover`, `wait`, `measure`, `wait_for`, `report` | delegated to the composed ROS 2 substrate |
32
+ | `grasp` / `release`, `dock`, `detect`, `scan`, `capture`, `speak`, `listen`, drone trio | `not_supported_on_humanoid[digit]: ...` (returned, not raised) |
33
+
34
+ ## Install / use
35
+
36
+ ```bash
37
+ pip install -e reference/humanoid-runtime # needs a sourced ROS 2 env to construct
38
+ ```
39
+
40
+ ```python
41
+ from urml_conformance import ConformanceRunner
42
+ from urml_humanoid_runtime import HUMANOID_ADAPTERS
43
+
44
+ runner = ConformanceRunner(adapter_factory=lambda: HUMANOID_ADAPTERS["digit"]())
45
+ ```
46
+
47
+ ## Status
48
+
49
+ **v0.1 (this release):**
50
+ - `DigitAdapter` (composes `RclpyAdapter`, locomotion subset) + `HUMANOID_ADAPTERS` registry.
51
+ - Hermetic unit tests: delegation, every v0.1 not-supported sentinel, the conformance hook, `runtime_checkable` conformance, context-manager teardown — no ROS 2 install required.
52
+ - 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).
53
+
54
+ **Follow-ups (not yet):**
55
+ - 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.
56
+ - Whole-body / bimanual manipulation primitives (a separate future RFC); then Digit's manipulation path moves out of not-supported.
57
+
58
+ ## Core Commitment
59
+
60
+ 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.
61
+
62
+ ## Related documents
63
+
64
+ - [`/reference/ros2-runtime/`](../ros2-runtime/) — the substrate engine `DigitAdapter` composes.
65
+ - [`/reference/legged-runtime/`](../legged-runtime/) — the sibling family sharing the compose pattern.
66
+ - [`/conformance/`](../../conformance/) — the test suite that decides conformance.
@@ -0,0 +1,74 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.27"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "urml-humanoid-runtime"
7
+ version = "0.5.0"
8
+ description = "Humanoid reference runtime for URML — Agility Digit (locomotion subset, v0.1)."
9
+ readme = "README.md"
10
+ license = { text = "BUSL-1.1" }
11
+ requires-python = ">=3.11"
12
+ authors = [{ name = "URML Maintainers" }]
13
+ keywords = ["robotics", "humanoid", "biped", "agility", "digit", "urml", "runtime"]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Intended Audience :: Developers",
17
+ "License :: Other/Proprietary License",
18
+ "Operating System :: OS Independent",
19
+ "Programming Language :: Python :: 3 :: Only",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Programming Language :: Python :: 3.12",
22
+ "Topic :: Scientific/Engineering",
23
+ ]
24
+ dependencies = [
25
+ "pydantic>=2.6,<3",
26
+ "PyYAML>=6.0,<7",
27
+ "urml-validator>=0.5.0",
28
+ "urml-ros2-runtime>=0.5.0",
29
+ ]
30
+
31
+ [project.optional-dependencies]
32
+ # Agility Digit exposes ROS 2 interfaces, so DigitAdapter composes
33
+ # RclpyAdapter — rclpy ships with the ROS 2 distribution, not PyPI, so
34
+ # there is no installable extra. Module import works on every host
35
+ # (rclpy is lazy inside RclpyAdapter); constructing the adapter needs a
36
+ # sourced ROS 2 environment.
37
+ dev = [
38
+ "pytest>=8",
39
+ "pytest-cov>=5",
40
+ "ruff>=0.5",
41
+ "mypy>=1.10",
42
+ ]
43
+
44
+ [project.urls]
45
+ Homepage = "https://github.com/urml-dev/URML"
46
+ Repository = "https://github.com/urml-dev/URML"
47
+ Issues = "https://github.com/urml-dev/URML/issues"
48
+
49
+ [tool.hatch.build.targets.wheel]
50
+ packages = ["src/urml_humanoid_runtime"]
51
+
52
+ [tool.ruff]
53
+ line-length = 120
54
+ target-version = "py311"
55
+ src = ["src", "tests"]
56
+
57
+ [tool.ruff.lint]
58
+ select = ["E", "F", "W", "I", "B", "UP", "N", "ANN", "RUF"]
59
+ ignore = ["ANN401"]
60
+
61
+ [tool.ruff.lint.per-file-ignores]
62
+ "tests/*" = ["ANN"]
63
+
64
+ [tool.mypy]
65
+ strict = true
66
+ python_version = "3.11"
67
+ plugins = ["pydantic.mypy"]
68
+ mypy_path = "src"
69
+ packages = ["urml_humanoid_runtime"]
70
+
71
+ [tool.pytest.ini_options]
72
+ minversion = "8.0"
73
+ testpaths = ["tests"]
74
+ addopts = ["-q", "--strict-markers"]
@@ -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,130 @@
1
+ """Hermetic unit tests for DigitAdapter — no ROS 2 install required.
2
+
3
+ DigitAdapter composes RclpyAdapter; rclpy only imports when RclpyAdapter
4
+ is constructed. These tests inject a recording fake inner adapter via
5
+ the ``inner_factory`` hook (the same technique the industrial-arm and
6
+ ANYmal suites use), so the delegation and v0.1 not-supported paths are
7
+ exercised against a controllable double.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ from typing import Any
13
+
14
+ from urml_ros2_runtime.substrate.base import (
15
+ ManipulationResult,
16
+ NavigationResult,
17
+ ROSAdapter,
18
+ SubstrateResult,
19
+ )
20
+
21
+ from urml_humanoid_runtime import DigitAdapter, HUMANOID_ADAPTERS
22
+
23
+
24
+ class _RecordingInner:
25
+ def __init__(self) -> None:
26
+ self.calls: list[str] = []
27
+ self.manipulation_kwargs: list[dict[str, Any]] = []
28
+ self.closed = False
29
+
30
+ def send_navigation_goal(self, **kw: Any) -> NavigationResult:
31
+ self.calls.append("send_navigation_goal")
32
+ return NavigationResult(success=True, frame="map")
33
+
34
+ def send_manipulation_goal(self, **kw: Any) -> ManipulationResult:
35
+ # Record the addressed arm so the delegation test can assert the
36
+ # RFC-0010 `arm` selector reaches the composed adapter unchanged.
37
+ self.calls.append(f"send_manipulation_goal[{kw.get('arm')}]")
38
+ self.manipulation_kwargs.append(kw)
39
+ return ManipulationResult(success=True)
40
+
41
+ def take_measurement(self, **kw: Any) -> SubstrateResult:
42
+ self.calls.append("take_measurement")
43
+ return SubstrateResult(success=True)
44
+
45
+ def wait_for_condition(self, **kw: Any) -> SubstrateResult:
46
+ self.calls.append("wait_for_condition")
47
+ return SubstrateResult(success=True)
48
+
49
+ def wait_passively(self, **kw: Any) -> SubstrateResult:
50
+ self.calls.append("wait_passively")
51
+ return SubstrateResult(success=True)
52
+
53
+ def emit_report(self, **kw: Any) -> SubstrateResult:
54
+ self.calls.append("emit_report")
55
+ return SubstrateResult(success=True)
56
+
57
+ def close(self) -> None:
58
+ self.closed = True
59
+
60
+
61
+ def test_registry_exposes_digit() -> None:
62
+ assert HUMANOID_ADAPTERS == {"digit": DigitAdapter}
63
+ assert DigitAdapter.BRAND == "digit"
64
+
65
+
66
+ def test_locomotion_subset_delegates() -> None:
67
+ inner = _RecordingInner()
68
+ with DigitAdapter(inner_factory=lambda: inner) as digit:
69
+ assert isinstance(digit, ROSAdapter)
70
+ assert digit.send_navigation_goal(location="staging_a").success
71
+ assert digit.wait_passively(duration_seconds=0.1).success
72
+ assert digit.take_measurement(what="imu", target=None, sensor=None).success
73
+ assert digit.wait_for_condition(
74
+ kind="signal", name="line_ready", input_mode=None, threshold=None, timeout_seconds=1.0
75
+ ).success
76
+ assert digit.emit_report(
77
+ to="wms", facts={"tote": 7}, attachments=None, status="success", severity="info"
78
+ ).success
79
+ # RFC-0010: manipulation (with the `arm` selector) delegates too.
80
+ assert digit.send_manipulation_goal(action="grasp", arm="left").success
81
+ assert inner.calls == [
82
+ "send_navigation_goal",
83
+ "wait_passively",
84
+ "take_measurement",
85
+ "wait_for_condition",
86
+ "emit_report",
87
+ "send_manipulation_goal[left]",
88
+ ]
89
+ assert inner.closed is True
90
+
91
+
92
+ def test_grasp_type_and_target_motion_reach_the_composed_adapter() -> None:
93
+ """RFC-0586 and RFC-0671 pass through like `arm`; Digit could not take them before 2026-09-27."""
94
+ inner = _RecordingInner()
95
+ with DigitAdapter(inner_factory=lambda: inner) as digit:
96
+ assert digit.send_manipulation_goal(
97
+ action="grasp", arm="left", grasp_type="power", target_motion="static"
98
+ ).success
99
+ (kw,) = inner.manipulation_kwargs
100
+ assert (kw["arm"], kw["grasp_type"], kw["target_motion"]) == ("left", "power", "static")
101
+
102
+
103
+ def test_non_locomotion_returns_v01_sentinel() -> None:
104
+ inner = _RecordingInner()
105
+ digit = DigitAdapter(inner_factory=lambda: inner)
106
+ tag = "not_supported_on_humanoid[digit]"
107
+ results = [
108
+ digit.send_docking_goal(station="d", service="park"),
109
+ digit.query_detection(object_class="tote"),
110
+ digit.run_scan(area={}, pattern="grid", overlap=0.1, altitude=None, media="photo", sensor=None),
111
+ digit.capture_media(media="photo", target=None, duration_seconds=None, attributes=None),
112
+ digit.emit_speech(utterance="hi", locale=None, style="notice", interrupt=False),
113
+ digit.acquire_speech(prompt=None, locale=None, timeout_seconds=None, expected="free_form", choices=None),
114
+ digit.send_takeoff_goal(altitude=1.0),
115
+ digit.send_land_goal(),
116
+ digit.send_return_to_home_goal(),
117
+ ]
118
+ for r in results:
119
+ assert r.success is False
120
+ assert r.reason is not None and r.reason.startswith(tag)
121
+ assert inner.calls == [] # rejected paths never reach the composed adapter
122
+
123
+
124
+ def test_conformance_runner_accepts_digit_factory() -> None:
125
+ from urml_conformance import ConformanceRunner
126
+
127
+ runner = ConformanceRunner(
128
+ adapter_factory=lambda: DigitAdapter(inner_factory=lambda: _RecordingInner())
129
+ )
130
+ assert runner is not None