urml-mujoco-runtime 0.5.2__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.
- urml_mujoco_runtime-0.5.2/.gitignore +117 -0
- urml_mujoco_runtime-0.5.2/PKG-INFO +99 -0
- urml_mujoco_runtime-0.5.2/README.md +67 -0
- urml_mujoco_runtime-0.5.2/SPEC-GAPS.md +38 -0
- urml_mujoco_runtime-0.5.2/pyproject.toml +79 -0
- urml_mujoco_runtime-0.5.2/src/urml_mujoco_runtime/__init__.py +32 -0
- urml_mujoco_runtime-0.5.2/src/urml_mujoco_runtime/_version.py +3 -0
- urml_mujoco_runtime-0.5.2/src/urml_mujoco_runtime/adapter.py +303 -0
- urml_mujoco_runtime-0.5.2/src/urml_mujoco_runtime/config.py +78 -0
- urml_mujoco_runtime-0.5.2/src/urml_mujoco_runtime/py.typed +0 -0
- urml_mujoco_runtime-0.5.2/src/urml_mujoco_runtime/recording.py +125 -0
- urml_mujoco_runtime-0.5.2/tests/__init__.py +0 -0
- urml_mujoco_runtime-0.5.2/tests/integration/__init__.py +0 -0
- urml_mujoco_runtime-0.5.2/tests/integration/test_mujoco_adapter_live.py +61 -0
- urml_mujoco_runtime-0.5.2/tests/test_mujoco_adapter.py +136 -0
- urml_mujoco_runtime-0.5.2/tests/test_recording.py +89 -0
|
@@ -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,99 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: urml-mujoco-runtime
|
|
3
|
+
Version: 0.5.2
|
|
4
|
+
Summary: Simulator reference runtime for URML — MuJoCo physics, zero ROS.
|
|
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: mujoco,robotics,runtime,simulation,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.2
|
|
23
|
+
Requires-Dist: urml-validator>=0.5.2
|
|
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
|
+
Provides-Extra: sim
|
|
30
|
+
Requires-Dist: mujoco<4,>=3; extra == 'sim'
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
<p align="center">
|
|
34
|
+
<a href="https://urml.dev"><img src="https://urml.dev/favicon.svg" alt="URML" width="72" height="72"></a>
|
|
35
|
+
</p>
|
|
36
|
+
|
|
37
|
+
<p align="center">
|
|
38
|
+
A small, opinionated, human-readable language for describing robot intent.
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
<p align="center">
|
|
42
|
+
<a href="https://urml.dev"><b>urml.dev</b></a>
|
|
43
|
+
</p>
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
# urml-mujoco-runtime
|
|
48
|
+
|
|
49
|
+
**Simulator reference runtime for URML** — `MujocoAdapter` for **MuJoCo** physics, via the official Apache-2.0 `mujoco` wheel.
|
|
50
|
+
|
|
51
|
+
MuJoCo is a pure-Python-bindings simulator over a bundled engine: headless, offline, no ROS. This adapter mirrors `BlueRovAdapter` / `PX4Adapter`: lazy `mujoco`, **no ROS 2 dependency**, a lazily-loaded cached model/data, failures returned not raised. It is the **purest substrate-neutrality acid-test proof** — a runtime that faithfully implements the frozen substrate Protocol (RFC-0014) with zero ROS and no middleware: the sentence→motion loop with no robot at all.
|
|
52
|
+
|
|
53
|
+
## Method coverage
|
|
54
|
+
|
|
55
|
+
| URML primitive | v0.1 |
|
|
56
|
+
|---|---|
|
|
57
|
+
| `move_to` / `hover` | write configured `ctrl` target onto `mjData`, step the engine `steps_per_command` steps |
|
|
58
|
+
| `wait` | step the engine |
|
|
59
|
+
| `measure` | read `mjData.sensordata` |
|
|
60
|
+
| `wait_for` | step-then-check (a sim has no external event bus) |
|
|
61
|
+
| `report` | structured record to a local sink (no cloud) |
|
|
62
|
+
| `scan` | documented not-supported result: no area-scan controller (a scan is waypoints plus a capture at each one) |
|
|
63
|
+
|
|
64
|
+
`grasp`/`release`, `dock`, `detect`, `capture`, `speak`, `listen` return `not_supported_in_base_sim` (a task-specific model + controller pairs via a companion). The drone trio `take_off`/`land`/`return_to_home` return `not_applicable_sim`.
|
|
65
|
+
|
|
66
|
+
## Install / use
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install -e reference/mujoco-runtime[sim] # installs mujoco
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from urml_mujoco_runtime import MujocoAdapter, MujocoConfig
|
|
74
|
+
from urml_mujoco_runtime.adapter import ControlTarget
|
|
75
|
+
cfg = MujocoConfig(model_path="arm.xml",
|
|
76
|
+
location_to_target={"home_pose": ControlTarget(ctrl=[0, 0, 0])})
|
|
77
|
+
with MujocoAdapter(cfg) as sim:
|
|
78
|
+
assert sim.send_navigation_goal(location="home_pose").success
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Status
|
|
82
|
+
|
|
83
|
+
**v0.1 (this release):**
|
|
84
|
+
- `MujocoAdapter` + `MujocoConfig` (MuJoCo, no ROS). `mujoco_arm_sim` manifest + `conformance/fixtures/home/17_mujoco_sentence_to_motion_positive.yaml` verified through the runner (hermetic against `MockROSAdapter`; adapter-agnostic against `MujocoAdapter`).
|
|
85
|
+
- Hermetic unit tests: navigation (configured + unmapped), measure, scan (not supported), lifecycle, the not-supported / not-applicable-sim sentinels, the model-path-required and missing-`[sim]`-extra errors, the conformance hook; no mujoco install required.
|
|
86
|
+
- Gated `.github/workflows/mujoco-integration.yml`: `mujoco-smoke` (real mujoco), `mujoco-arm64-build` (the Jetson-class QEMU signal), and `mujoco-sitl-e2e` against a real MJCF model (first run is a calibration run by design — the established px4/ros2/marine convention).
|
|
87
|
+
- [`SPEC-GAPS.md`](SPEC-GAPS.md): **none** — a simulator implements the existing primitives with zero new vocabulary.
|
|
88
|
+
|
|
89
|
+
**Follow-ups (not yet):** a bundled demo MJCF model + a true sentence→motion video; a task-model companion for `grasp`.
|
|
90
|
+
|
|
91
|
+
## Core Commitment
|
|
92
|
+
|
|
93
|
+
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.
|
|
94
|
+
|
|
95
|
+
## Related documents
|
|
96
|
+
|
|
97
|
+
- [`/reference/marine-runtime/`](../marine-runtime/) — the zero-ROS sibling whose structure this mirrors.
|
|
98
|
+
- [`/docs/rfcs/0014-substrate-conformance.md`](../../docs/rfcs/0014-substrate-conformance.md) — the conformance contract this is built against.
|
|
99
|
+
- [`/conformance/`](../../conformance/) — the test suite that decides conformance.
|
|
@@ -0,0 +1,67 @@
|
|
|
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-mujoco-runtime
|
|
16
|
+
|
|
17
|
+
**Simulator reference runtime for URML** — `MujocoAdapter` for **MuJoCo** physics, via the official Apache-2.0 `mujoco` wheel.
|
|
18
|
+
|
|
19
|
+
MuJoCo is a pure-Python-bindings simulator over a bundled engine: headless, offline, no ROS. This adapter mirrors `BlueRovAdapter` / `PX4Adapter`: lazy `mujoco`, **no ROS 2 dependency**, a lazily-loaded cached model/data, failures returned not raised. It is the **purest substrate-neutrality acid-test proof** — a runtime that faithfully implements the frozen substrate Protocol (RFC-0014) with zero ROS and no middleware: the sentence→motion loop with no robot at all.
|
|
20
|
+
|
|
21
|
+
## Method coverage
|
|
22
|
+
|
|
23
|
+
| URML primitive | v0.1 |
|
|
24
|
+
|---|---|
|
|
25
|
+
| `move_to` / `hover` | write configured `ctrl` target onto `mjData`, step the engine `steps_per_command` steps |
|
|
26
|
+
| `wait` | step the engine |
|
|
27
|
+
| `measure` | read `mjData.sensordata` |
|
|
28
|
+
| `wait_for` | step-then-check (a sim has no external event bus) |
|
|
29
|
+
| `report` | structured record to a local sink (no cloud) |
|
|
30
|
+
| `scan` | documented not-supported result: no area-scan controller (a scan is waypoints plus a capture at each one) |
|
|
31
|
+
|
|
32
|
+
`grasp`/`release`, `dock`, `detect`, `capture`, `speak`, `listen` return `not_supported_in_base_sim` (a task-specific model + controller pairs via a companion). The drone trio `take_off`/`land`/`return_to_home` return `not_applicable_sim`.
|
|
33
|
+
|
|
34
|
+
## Install / use
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install -e reference/mujoco-runtime[sim] # installs mujoco
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from urml_mujoco_runtime import MujocoAdapter, MujocoConfig
|
|
42
|
+
from urml_mujoco_runtime.adapter import ControlTarget
|
|
43
|
+
cfg = MujocoConfig(model_path="arm.xml",
|
|
44
|
+
location_to_target={"home_pose": ControlTarget(ctrl=[0, 0, 0])})
|
|
45
|
+
with MujocoAdapter(cfg) as sim:
|
|
46
|
+
assert sim.send_navigation_goal(location="home_pose").success
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Status
|
|
50
|
+
|
|
51
|
+
**v0.1 (this release):**
|
|
52
|
+
- `MujocoAdapter` + `MujocoConfig` (MuJoCo, no ROS). `mujoco_arm_sim` manifest + `conformance/fixtures/home/17_mujoco_sentence_to_motion_positive.yaml` verified through the runner (hermetic against `MockROSAdapter`; adapter-agnostic against `MujocoAdapter`).
|
|
53
|
+
- Hermetic unit tests: navigation (configured + unmapped), measure, scan (not supported), lifecycle, the not-supported / not-applicable-sim sentinels, the model-path-required and missing-`[sim]`-extra errors, the conformance hook; no mujoco install required.
|
|
54
|
+
- Gated `.github/workflows/mujoco-integration.yml`: `mujoco-smoke` (real mujoco), `mujoco-arm64-build` (the Jetson-class QEMU signal), and `mujoco-sitl-e2e` against a real MJCF model (first run is a calibration run by design — the established px4/ros2/marine convention).
|
|
55
|
+
- [`SPEC-GAPS.md`](SPEC-GAPS.md): **none** — a simulator implements the existing primitives with zero new vocabulary.
|
|
56
|
+
|
|
57
|
+
**Follow-ups (not yet):** a bundled demo MJCF model + a true sentence→motion video; a task-model companion for `grasp`.
|
|
58
|
+
|
|
59
|
+
## Core Commitment
|
|
60
|
+
|
|
61
|
+
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.
|
|
62
|
+
|
|
63
|
+
## Related documents
|
|
64
|
+
|
|
65
|
+
- [`/reference/marine-runtime/`](../marine-runtime/) — the zero-ROS sibling whose structure this mirrors.
|
|
66
|
+
- [`/docs/rfcs/0014-substrate-conformance.md`](../../docs/rfcs/0014-substrate-conformance.md) — the conformance contract this is built against.
|
|
67
|
+
- [`/conformance/`](../../conformance/) — the test suite that decides conformance.
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
# SPEC-GAPS — urml-mujoco-runtime
|
|
16
|
+
|
|
17
|
+
Per the spec-gap protocol (RFC-0014): each runtime is built strictly
|
|
18
|
+
against the frozen substrate Protocol; anything a substrate needs that
|
|
19
|
+
URML cannot express is recorded here and, if genuinely inexpressible,
|
|
20
|
+
promoted to a numbered RFC Draft for maintainer decision — never a
|
|
21
|
+
silent primitive/schema change.
|
|
22
|
+
|
|
23
|
+
## Gaps
|
|
24
|
+
|
|
25
|
+
**None.** A physics simulator is the purest case for the
|
|
26
|
+
substrate-neutrality acid test: it faithfully implements the existing
|
|
27
|
+
primitives (`move_to`/`hover`/`wait`/`measure`/`wait_for`/`report`,
|
|
28
|
+
with `scan` a documented not-supported result) with zero ROS and no new
|
|
29
|
+
vocabulary.
|
|
30
|
+
Capabilities a *bare* model lacks (`grasp`/`release`, `dock`,
|
|
31
|
+
`detect`, `capture`, `speak`, `listen`) are returned as honest
|
|
32
|
+
unsuccessful `SubstrateResult`s, not gaps in URML — a task-specific
|
|
33
|
+
model + controller companion supplies them under the unchanged
|
|
34
|
+
program, manifest, and validator. The drone trio is
|
|
35
|
+
`not_applicable_sim`.
|
|
36
|
+
|
|
37
|
+
No primitive, manifest field, or behavior-semantic change is needed or
|
|
38
|
+
proposed by this runtime.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.27"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "urml-mujoco-runtime"
|
|
7
|
+
version = "0.5.2"
|
|
8
|
+
description = "Simulator reference runtime for URML — MuJoCo physics, zero ROS."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "BUSL-1.1" }
|
|
11
|
+
requires-python = ">=3.11"
|
|
12
|
+
authors = [{ name = "URML Maintainers" }]
|
|
13
|
+
keywords = ["robotics", "simulation", "mujoco", "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.2",
|
|
28
|
+
"urml-ros2-runtime>=0.5.2",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.optional-dependencies]
|
|
32
|
+
# MuJoCo is the official Apache-2.0 pip wheel (DeepMind), pure Python
|
|
33
|
+
# bindings over a bundled engine, headless and fully offline — no GL, no
|
|
34
|
+
# ROS, no cloud. Installing urml-mujoco-runtime[sim] gives everything
|
|
35
|
+
# MujocoAdapter needs to step an MJCF model. mujoco is imported lazily,
|
|
36
|
+
# so this module loads on every host (Windows included) even without it.
|
|
37
|
+
# This is the purest substrate-neutrality acid-test proof: a simulator
|
|
38
|
+
# faithfully implementing the frozen Protocol with zero ROS.
|
|
39
|
+
sim = [
|
|
40
|
+
"mujoco>=3,<4",
|
|
41
|
+
]
|
|
42
|
+
dev = [
|
|
43
|
+
"pytest>=8",
|
|
44
|
+
"pytest-cov>=5",
|
|
45
|
+
"ruff>=0.5",
|
|
46
|
+
"mypy>=1.10",
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
[project.urls]
|
|
50
|
+
Homepage = "https://github.com/urml-dev/URML"
|
|
51
|
+
Repository = "https://github.com/urml-dev/URML"
|
|
52
|
+
Issues = "https://github.com/urml-dev/URML/issues"
|
|
53
|
+
|
|
54
|
+
[tool.hatch.build.targets.wheel]
|
|
55
|
+
packages = ["src/urml_mujoco_runtime"]
|
|
56
|
+
|
|
57
|
+
[tool.ruff]
|
|
58
|
+
line-length = 120
|
|
59
|
+
target-version = "py311"
|
|
60
|
+
src = ["src", "tests"]
|
|
61
|
+
|
|
62
|
+
[tool.ruff.lint]
|
|
63
|
+
select = ["E", "F", "W", "I", "B", "UP", "N", "ANN", "RUF"]
|
|
64
|
+
ignore = ["ANN401"]
|
|
65
|
+
|
|
66
|
+
[tool.ruff.lint.per-file-ignores]
|
|
67
|
+
"tests/*" = ["ANN"]
|
|
68
|
+
|
|
69
|
+
[tool.mypy]
|
|
70
|
+
strict = true
|
|
71
|
+
python_version = "3.11"
|
|
72
|
+
plugins = ["pydantic.mypy"]
|
|
73
|
+
mypy_path = "src"
|
|
74
|
+
packages = ["urml_mujoco_runtime"]
|
|
75
|
+
|
|
76
|
+
[tool.pytest.ini_options]
|
|
77
|
+
minversion = "8.0"
|
|
78
|
+
testpaths = ["tests"]
|
|
79
|
+
addopts = ["-q", "--strict-markers"]
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""urml_mujoco_runtime — simulator reference runtime for URML.
|
|
2
|
+
|
|
3
|
+
MujocoAdapter (+ MujocoConfig, load_mujoco_config)
|
|
4
|
+
MuJoCo physics via the official Apache-2.0 ``mujoco`` wheel. **No
|
|
5
|
+
ROS 2 dependency** — the purest substrate-neutrality acid-test
|
|
6
|
+
proof: a simulator faithfully implementing the frozen substrate
|
|
7
|
+
Protocol with zero ROS, headless and offline. ``mujoco`` is
|
|
8
|
+
imported lazily (the [sim] extra), so this module loads on every
|
|
9
|
+
host.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
from urml_mujoco_runtime._version import __version__
|
|
15
|
+
from urml_mujoco_runtime.adapter import MujocoAdapter, MujocoConfig, load_mujoco_config
|
|
16
|
+
from urml_mujoco_runtime.recording import (
|
|
17
|
+
RecordingMujocoAdapter,
|
|
18
|
+
SignalMap,
|
|
19
|
+
SignalSpec,
|
|
20
|
+
load_signal_map,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
__all__ = [
|
|
24
|
+
"MujocoAdapter",
|
|
25
|
+
"MujocoConfig",
|
|
26
|
+
"RecordingMujocoAdapter",
|
|
27
|
+
"SignalMap",
|
|
28
|
+
"SignalSpec",
|
|
29
|
+
"__version__",
|
|
30
|
+
"load_mujoco_config",
|
|
31
|
+
"load_signal_map",
|
|
32
|
+
]
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
"""MujocoAdapter — MuJoCo physics simulator, via the ``mujoco`` wheel.
|
|
2
|
+
|
|
3
|
+
MuJoCo is the official Apache-2.0 simulator with pure-Python bindings
|
|
4
|
+
over a bundled engine: headless, offline, no ROS. This adapter mirrors
|
|
5
|
+
:class:`BlueRovAdapter` / :class:`PX4Adapter`: lazy ``mujoco``, **no
|
|
6
|
+
ROS 2 dependency**, a lazily-loaded cached model/data, failures
|
|
7
|
+
returned not raised. It is the purest substrate-neutrality acid-test
|
|
8
|
+
proof — a simulator faithfully implementing the frozen substrate
|
|
9
|
+
Protocol with zero ROS, the sentence→motion loop with no robot and no
|
|
10
|
+
middleware.
|
|
11
|
+
|
|
12
|
+
## v0.1 method coverage
|
|
13
|
+
|
|
14
|
+
Supported (mapped onto an MJCF model + actuator ``ctrl``):
|
|
15
|
+
|
|
16
|
+
- ``move_to`` / ``hover`` → write the configured control target onto
|
|
17
|
+
``mjData.ctrl`` and advance the engine ``steps_per_command`` steps
|
|
18
|
+
(location → ``ctrl`` via :class:`MujocoConfig`); ``hover`` is a
|
|
19
|
+
zero-change hold (step in place).
|
|
20
|
+
- ``wait`` → step the engine for the dwell.
|
|
21
|
+
- ``measure`` → read ``mjData.sensordata`` (named sensor or first).
|
|
22
|
+
- ``wait_for`` → step-then-check (a sim has no external event bus; the
|
|
23
|
+
step advances state and the predicate is evaluated once).
|
|
24
|
+
- ``report`` → structured record to a local sink (no cloud — manifesto).
|
|
25
|
+
- ``scan`` → documented not-supported result: this adapter does not
|
|
26
|
+
expand an area into waypoints or capture along them.
|
|
27
|
+
|
|
28
|
+
Not supported by a bare physics model (returned, not raised):
|
|
29
|
+
``grasp`` / ``release``, ``dock``, ``detect``, ``capture``, ``speak``,
|
|
30
|
+
``listen`` — these need a task-specific model + controller (a follow-up
|
|
31
|
+
companion). The drone trio ``take_off`` / ``land`` /
|
|
32
|
+
``return_to_home`` are ``not_applicable_sim``.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
from __future__ import annotations
|
|
36
|
+
|
|
37
|
+
from typing import Any, Literal
|
|
38
|
+
|
|
39
|
+
import yaml
|
|
40
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
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
|
+
ScanResult,
|
|
51
|
+
SubstrateResult,
|
|
52
|
+
WaitResult,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
from urml_mujoco_runtime._version import __version__
|
|
56
|
+
from urml_mujoco_runtime.config import ControlTarget, MujocoConfig, load_mujoco_config
|
|
57
|
+
|
|
58
|
+
__all__ = [
|
|
59
|
+
"ControlTarget",
|
|
60
|
+
"MujocoAdapter",
|
|
61
|
+
"MujocoConfig",
|
|
62
|
+
"__version__",
|
|
63
|
+
"load_mujoco_config",
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
_NOT_SUPPORTED = (
|
|
67
|
+
"not_supported_in_base_sim: a bare MuJoCo physics model has no {capability}. "
|
|
68
|
+
"Pair it with a task-specific model + controller companion; the URML "
|
|
69
|
+
"program, manifest, and validator are unchanged."
|
|
70
|
+
)
|
|
71
|
+
_NOT_APPLICABLE = "not_applicable_sim: {capability} has no meaning for a headless physics model."
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _require_mujoco() -> Any:
|
|
75
|
+
"""Lazy-import mujoco with a clear error when missing."""
|
|
76
|
+
try:
|
|
77
|
+
import mujoco # type: ignore[import-not-found,unused-ignore]
|
|
78
|
+
except ImportError as exc:
|
|
79
|
+
raise RuntimeError(
|
|
80
|
+
"mujoco is not installed. MujocoAdapter requires the [sim] extra.\n"
|
|
81
|
+
" Install with: pip install urml-mujoco-runtime[sim]"
|
|
82
|
+
) from exc
|
|
83
|
+
return mujoco
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class MujocoAdapter:
|
|
87
|
+
"""MuJoCo simulator adapter implementing the URML ROSAdapter Protocol."""
|
|
88
|
+
|
|
89
|
+
BRAND = "mujoco"
|
|
90
|
+
|
|
91
|
+
def __init__(self, config: MujocoConfig | None = None) -> None:
|
|
92
|
+
self._mujoco = _require_mujoco()
|
|
93
|
+
self._config = config or MujocoConfig()
|
|
94
|
+
self._model: Any = None
|
|
95
|
+
self._data: Any = None
|
|
96
|
+
self._reports: list[dict[str, Any]] = []
|
|
97
|
+
self._closed = False
|
|
98
|
+
|
|
99
|
+
def _sim(self) -> tuple[Any, Any]:
|
|
100
|
+
"""Lazily load and cache the MJCF model + data."""
|
|
101
|
+
if self._model is not None:
|
|
102
|
+
return self._model, self._data
|
|
103
|
+
if not self._config.model_path:
|
|
104
|
+
raise RuntimeError(
|
|
105
|
+
"model_path not configured: set MujocoConfig.model_path to an "
|
|
106
|
+
"MJCF/XML model file in mujoco_adapter.yaml."
|
|
107
|
+
)
|
|
108
|
+
model = self._mujoco.MjModel.from_xml_path(self._config.model_path)
|
|
109
|
+
data = self._mujoco.MjData(model)
|
|
110
|
+
self._model, self._data = model, data
|
|
111
|
+
return model, data
|
|
112
|
+
|
|
113
|
+
def _step(self, n: int) -> None:
|
|
114
|
+
model, data = self._sim()
|
|
115
|
+
for _ in range(max(1, n)):
|
|
116
|
+
self._mujoco.mj_step(model, data)
|
|
117
|
+
|
|
118
|
+
def close(self) -> None:
|
|
119
|
+
self._closed = True
|
|
120
|
+
|
|
121
|
+
def __enter__(self) -> MujocoAdapter:
|
|
122
|
+
return self
|
|
123
|
+
|
|
124
|
+
def __exit__(self, *_: object) -> None:
|
|
125
|
+
self.close()
|
|
126
|
+
|
|
127
|
+
# ------------------------------------------------------------------
|
|
128
|
+
# Supported
|
|
129
|
+
# ------------------------------------------------------------------
|
|
130
|
+
|
|
131
|
+
def send_navigation_goal(
|
|
132
|
+
self,
|
|
133
|
+
*,
|
|
134
|
+
location: str | None = None,
|
|
135
|
+
pose: dict[str, float] | None = None,
|
|
136
|
+
frame: str | None = None,
|
|
137
|
+
carrying: dict[str, Any] | None = None,
|
|
138
|
+
speed: float | None = None,
|
|
139
|
+
) -> NavigationResult:
|
|
140
|
+
if location is None and pose is None:
|
|
141
|
+
return NavigationResult(success=False, reason="send_navigation_goal called without location or pose")
|
|
142
|
+
_, data = self._sim()
|
|
143
|
+
if location is not None:
|
|
144
|
+
tgt = self._config.resolve_location(location)
|
|
145
|
+
if tgt is None:
|
|
146
|
+
return NavigationResult(
|
|
147
|
+
success=False,
|
|
148
|
+
reason=f"location_not_configured: {location!r} is declared in the "
|
|
149
|
+
"manifest but not mapped to a control target in mujoco_adapter.yaml.",
|
|
150
|
+
)
|
|
151
|
+
ctrl = list(tgt.ctrl)
|
|
152
|
+
else:
|
|
153
|
+
ctrl = [float(v) for v in (pose or {}).values()]
|
|
154
|
+
if ctrl:
|
|
155
|
+
n = min(len(ctrl), len(data.ctrl))
|
|
156
|
+
for i in range(n):
|
|
157
|
+
data.ctrl[i] = ctrl[i]
|
|
158
|
+
self._step(self._config.steps_per_command)
|
|
159
|
+
# final_pose is a flat dict[str, float]; expose the control vector
|
|
160
|
+
# as indexed scalars (ctrl0, ctrl1, ...).
|
|
161
|
+
final = {f"ctrl{i}": float(v) for i, v in enumerate(ctrl)}
|
|
162
|
+
return NavigationResult(success=True, final_pose=final, frame=frame or "model")
|
|
163
|
+
|
|
164
|
+
def wait_passively(self, *, duration_seconds: float) -> SubstrateResult:
|
|
165
|
+
self._step(self._config.steps_per_command)
|
|
166
|
+
return SubstrateResult(success=True)
|
|
167
|
+
|
|
168
|
+
def take_measurement(self, *, what: str, target: str | None, sensor: str | None) -> MeasurementResult:
|
|
169
|
+
_, data = self._sim()
|
|
170
|
+
sd = list(getattr(data, "sensordata", []) or [])
|
|
171
|
+
value = float(sd[0]) if sd else None
|
|
172
|
+
return MeasurementResult(success=True, payload={"value": value, "what": what})
|
|
173
|
+
|
|
174
|
+
def wait_for_condition(
|
|
175
|
+
self,
|
|
176
|
+
*,
|
|
177
|
+
kind: Literal["event", "signal", "input", "sensor_threshold"],
|
|
178
|
+
name: str | None,
|
|
179
|
+
input_mode: str | None,
|
|
180
|
+
threshold: dict[str, Any] | None,
|
|
181
|
+
timeout_seconds: float | None,
|
|
182
|
+
) -> WaitResult:
|
|
183
|
+
self._step(self._config.steps_per_command)
|
|
184
|
+
return WaitResult(success=True, timed_out=False, payload=None)
|
|
185
|
+
|
|
186
|
+
def emit_report(
|
|
187
|
+
self,
|
|
188
|
+
*,
|
|
189
|
+
to: str,
|
|
190
|
+
facts: dict[str, Any],
|
|
191
|
+
attachments: list[str] | None,
|
|
192
|
+
status: Literal["success", "partial", "failure"],
|
|
193
|
+
severity: Literal["info", "notice", "warning", "error"],
|
|
194
|
+
) -> SubstrateResult:
|
|
195
|
+
self._reports.append({"to": to, "status": status, "severity": severity, "facts": facts})
|
|
196
|
+
return SubstrateResult(success=True)
|
|
197
|
+
|
|
198
|
+
def run_scan(
|
|
199
|
+
self,
|
|
200
|
+
*,
|
|
201
|
+
area: dict[str, Any],
|
|
202
|
+
pattern: Literal["serpentine", "spiral", "grid", "adaptive"],
|
|
203
|
+
overlap: float,
|
|
204
|
+
altitude: float | None,
|
|
205
|
+
media: Literal["photo", "video", "sensor_only"],
|
|
206
|
+
sensor: str | None,
|
|
207
|
+
) -> ScanResult:
|
|
208
|
+
# A scan is waypoints plus a capture at each one, and this adapter
|
|
209
|
+
# does neither. Reporting success would claim an area was covered
|
|
210
|
+
# when nothing moved.
|
|
211
|
+
return ScanResult(success=False, reason=_NOT_SUPPORTED.format(capability="area-scan controller"))
|
|
212
|
+
|
|
213
|
+
# ------------------------------------------------------------------
|
|
214
|
+
# Not supported by a bare physics model
|
|
215
|
+
# ------------------------------------------------------------------
|
|
216
|
+
|
|
217
|
+
def send_manipulation_goal(
|
|
218
|
+
self,
|
|
219
|
+
*,
|
|
220
|
+
action: Literal["grasp", "release"],
|
|
221
|
+
target: dict[str, Any] | None = None,
|
|
222
|
+
force_n: float | None = None,
|
|
223
|
+
approach: Literal["top", "side", "front", "auto"] = "auto",
|
|
224
|
+
release_mode: Literal["drop", "place", "hand_to_user"] | None = None,
|
|
225
|
+
release_at: dict[str, Any] | str | None = None,
|
|
226
|
+
arm: str | None = None,
|
|
227
|
+
grasp_type: str | None = None,
|
|
228
|
+
target_motion: str | None = None,
|
|
229
|
+
) -> ManipulationResult:
|
|
230
|
+
return ManipulationResult(success=False, reason=_NOT_SUPPORTED.format(capability="manipulator controller"))
|
|
231
|
+
|
|
232
|
+
def send_docking_goal(self, *, station: str, service: str, until: str | None = None) -> NavigationResult:
|
|
233
|
+
return NavigationResult(success=False, reason=_NOT_SUPPORTED.format(capability="docking station"))
|
|
234
|
+
|
|
235
|
+
def query_detection(
|
|
236
|
+
self,
|
|
237
|
+
*,
|
|
238
|
+
object_class: str,
|
|
239
|
+
attributes: dict[str, Any] | None = None,
|
|
240
|
+
where_near: str | None = None,
|
|
241
|
+
where_within: float | None = None,
|
|
242
|
+
) -> DetectionResult:
|
|
243
|
+
return DetectionResult(success=False, reason=_NOT_SUPPORTED.format(capability="perception model"))
|
|
244
|
+
|
|
245
|
+
def capture_media(
|
|
246
|
+
self,
|
|
247
|
+
*,
|
|
248
|
+
media: Literal["photo", "video"],
|
|
249
|
+
target: str | None,
|
|
250
|
+
duration_seconds: float | None,
|
|
251
|
+
attributes: dict[str, Any] | None,
|
|
252
|
+
camera: str | None = None,
|
|
253
|
+
) -> CaptureResult:
|
|
254
|
+
return CaptureResult(success=False, reason=_NOT_SUPPORTED.format(capability="recordable camera"))
|
|
255
|
+
|
|
256
|
+
def emit_speech(
|
|
257
|
+
self,
|
|
258
|
+
*,
|
|
259
|
+
utterance: str,
|
|
260
|
+
locale: str | None,
|
|
261
|
+
style: Literal["notice", "warning", "conversational"],
|
|
262
|
+
interrupt: bool,
|
|
263
|
+
) -> SubstrateResult:
|
|
264
|
+
return SubstrateResult(success=False, reason=_NOT_SUPPORTED.format(capability="speaker"))
|
|
265
|
+
|
|
266
|
+
def acquire_speech(
|
|
267
|
+
self,
|
|
268
|
+
*,
|
|
269
|
+
prompt: str | None,
|
|
270
|
+
locale: str | None,
|
|
271
|
+
timeout_seconds: float | None,
|
|
272
|
+
expected: Literal["free_form", "confirmation", "choice"],
|
|
273
|
+
choices: list[str] | None,
|
|
274
|
+
) -> ListenResult:
|
|
275
|
+
return ListenResult(success=False, reason=_NOT_SUPPORTED.format(capability="microphone"))
|
|
276
|
+
|
|
277
|
+
def send_takeoff_goal(self, *, altitude: float, climb_rate: float | None = None) -> NavigationResult:
|
|
278
|
+
return NavigationResult(success=False, reason=_NOT_APPLICABLE.format(capability="take_off"))
|
|
279
|
+
|
|
280
|
+
def send_land_goal(
|
|
281
|
+
self,
|
|
282
|
+
*,
|
|
283
|
+
at: str | None = None,
|
|
284
|
+
precision: Literal["standard", "precise"] = "standard",
|
|
285
|
+
) -> NavigationResult:
|
|
286
|
+
return NavigationResult(success=False, reason=_NOT_APPLICABLE.format(capability="land"))
|
|
287
|
+
|
|
288
|
+
def send_return_to_home_goal(
|
|
289
|
+
self,
|
|
290
|
+
*,
|
|
291
|
+
speed: float | None = None,
|
|
292
|
+
altitude: float | None = None,
|
|
293
|
+
) -> NavigationResult:
|
|
294
|
+
return NavigationResult(success=False, reason=_NOT_APPLICABLE.format(capability="return_to_home"))
|
|
295
|
+
|
|
296
|
+
def call_named_program(
|
|
297
|
+
self,
|
|
298
|
+
*,
|
|
299
|
+
name: str,
|
|
300
|
+
args: dict[str, Any] | None = None,
|
|
301
|
+
) -> ProgramCallResult:
|
|
302
|
+
"""``call_program``: this substrate exposes no named programs (RFC-0015)."""
|
|
303
|
+
return unsupported_program_call('mujoco_sim')
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"""Deployment-side configuration for ``MujocoAdapter``.
|
|
2
|
+
|
|
3
|
+
A MuJoCo simulation needs to know:
|
|
4
|
+
|
|
5
|
+
- Which MJCF/XML model to load (``model_path``).
|
|
6
|
+
- A mapping from manifest-declared location names to a control target
|
|
7
|
+
(the actuator ``ctrl`` vector that drives the model toward that named
|
|
8
|
+
pose), mirroring the ROS 2 runtime's ``location_to_pose`` and the PX4
|
|
9
|
+
runtime's ``location_to_pose``.
|
|
10
|
+
- How many physics steps to advance per command and the optional
|
|
11
|
+
per-step settle budget.
|
|
12
|
+
|
|
13
|
+
These facts are model- and deployment-specific, so they do NOT belong
|
|
14
|
+
in the URML program, manifest, or envelope. They live in a
|
|
15
|
+
``mujoco_adapter.yaml`` alongside the URML artifacts.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
from pathlib import Path
|
|
21
|
+
|
|
22
|
+
import yaml
|
|
23
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class ControlTarget(BaseModel):
|
|
27
|
+
"""A named control target: the actuator ``ctrl`` vector for a pose.
|
|
28
|
+
|
|
29
|
+
The adapter writes ``ctrl`` onto ``mjData`` and steps the engine;
|
|
30
|
+
``ctrl`` is model-specific, which is exactly why it is deployment
|
|
31
|
+
config and not a URML-level concept.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(extra="forbid")
|
|
35
|
+
|
|
36
|
+
ctrl: list[float] = Field(default_factory=list, description="Actuator control vector for this pose.")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class MujocoConfig(BaseModel):
|
|
40
|
+
"""MuJoCo model + control config."""
|
|
41
|
+
|
|
42
|
+
model_config = ConfigDict(extra="forbid")
|
|
43
|
+
|
|
44
|
+
model_path: str = Field(
|
|
45
|
+
default="",
|
|
46
|
+
description=(
|
|
47
|
+
"Path to the MJCF/XML model. Required at construction time; an "
|
|
48
|
+
"empty value yields a clear 'model_path not configured' error "
|
|
49
|
+
"rather than a crash."
|
|
50
|
+
),
|
|
51
|
+
)
|
|
52
|
+
steps_per_command: int = Field(
|
|
53
|
+
default=100,
|
|
54
|
+
ge=1,
|
|
55
|
+
description="Physics steps advanced per navigation/wait command.",
|
|
56
|
+
)
|
|
57
|
+
location_to_target: dict[str, ControlTarget] = Field(
|
|
58
|
+
default_factory=dict,
|
|
59
|
+
description="Map manifest-declared location names to a control target.",
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
def resolve_location(self, name: str) -> ControlTarget | None:
|
|
63
|
+
"""Return the control target for a named location, or None if unmapped.
|
|
64
|
+
|
|
65
|
+
Unmapped names produce a ``NavigationResult(success=False)`` with a
|
|
66
|
+
``location_not_configured`` reason — they do not raise.
|
|
67
|
+
"""
|
|
68
|
+
return self.location_to_target.get(name)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def load_mujoco_config(path: str | Path) -> MujocoConfig:
|
|
72
|
+
"""Parse a ``mujoco_adapter.yaml`` file into a ``MujocoConfig``."""
|
|
73
|
+
p = Path(path)
|
|
74
|
+
with p.open(encoding="utf-8") as fh:
|
|
75
|
+
data = yaml.safe_load(fh) or {}
|
|
76
|
+
if not isinstance(data, dict):
|
|
77
|
+
raise ValueError(f"mujoco-config file {p} did not contain a YAML mapping at the top level.")
|
|
78
|
+
return MujocoConfig.model_validate(data)
|
|
File without changes
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"""RFC-0668: trace-recording MuJoCo adapter for the rehearsal gate.
|
|
2
|
+
|
|
3
|
+
`MujocoAdapter` advances real physics but records nothing: each command
|
|
4
|
+
returns only a final pose. Rehearsal needs the trajectory, so
|
|
5
|
+
`RecordingMujocoAdapter` overrides the step loop and samples the engine
|
|
6
|
+
state per tick into `urml_validator.monitor.Sample`s, mapped to envelope
|
|
7
|
+
signal names by a declared `SignalMap`.
|
|
8
|
+
|
|
9
|
+
The signal map is the honest seam: which `qvel` components mean "speed" is
|
|
10
|
+
a property of the MJCF model, not of URML, so the deployment declares it.
|
|
11
|
+
A map that lies produces a rehearsal that lies.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import math
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
from typing import Any, Literal
|
|
19
|
+
|
|
20
|
+
import yaml
|
|
21
|
+
from pydantic import BaseModel, ConfigDict, Field, model_validator
|
|
22
|
+
from urml_validator.monitor import Sample
|
|
23
|
+
|
|
24
|
+
from urml_mujoco_runtime.adapter import MujocoAdapter
|
|
25
|
+
from urml_mujoco_runtime.config import MujocoConfig
|
|
26
|
+
|
|
27
|
+
__all__ = ["RecordingMujocoAdapter", "SignalMap", "SignalSpec", "load_signal_map"]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class SignalSpec(BaseModel):
|
|
31
|
+
"""How one envelope signal reads out of the MuJoCo state.
|
|
32
|
+
|
|
33
|
+
- `source: qpos | qvel | sensordata` with `index` reads one scalar.
|
|
34
|
+
- `source: qvel` (or `qpos`) with `indices` reads the Euclidean norm
|
|
35
|
+
over those components (the usual way "speed" comes out of a free
|
|
36
|
+
joint's linear velocity).
|
|
37
|
+
- `source: const` with `value` pins a signal the model cannot measure
|
|
38
|
+
(declare it openly; a pinned `person_distance: 100.0` means "this
|
|
39
|
+
rehearsal assumes nobody is present").
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
model_config = ConfigDict(extra="forbid")
|
|
43
|
+
|
|
44
|
+
source: Literal["qpos", "qvel", "sensordata", "const"]
|
|
45
|
+
index: int | None = Field(None, ge=0)
|
|
46
|
+
indices: list[int] | None = None
|
|
47
|
+
value: float | None = None
|
|
48
|
+
|
|
49
|
+
@model_validator(mode="after")
|
|
50
|
+
def _coherent(self) -> SignalSpec:
|
|
51
|
+
if self.source == "const":
|
|
52
|
+
if self.value is None:
|
|
53
|
+
raise ValueError("source: const requires `value`")
|
|
54
|
+
return self
|
|
55
|
+
if (self.index is None) == (self.indices is None):
|
|
56
|
+
raise ValueError(f"source: {self.source} requires exactly one of `index` or `indices`")
|
|
57
|
+
return self
|
|
58
|
+
|
|
59
|
+
def read(self, data: Any) -> float:
|
|
60
|
+
if self.source == "const":
|
|
61
|
+
assert self.value is not None
|
|
62
|
+
return float(self.value)
|
|
63
|
+
vector = getattr(data, self.source)
|
|
64
|
+
if self.index is not None:
|
|
65
|
+
return float(vector[self.index])
|
|
66
|
+
assert self.indices is not None
|
|
67
|
+
return math.sqrt(sum(float(vector[i]) ** 2 for i in self.indices))
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class SignalMap(BaseModel):
|
|
71
|
+
"""Envelope signal name -> readout spec."""
|
|
72
|
+
|
|
73
|
+
model_config = ConfigDict(extra="forbid")
|
|
74
|
+
|
|
75
|
+
signals: dict[str, SignalSpec]
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def load_signal_map(path: Path) -> SignalMap:
|
|
79
|
+
"""Load a signal map from YAML (`signals: {speed: {source: qvel, indices: [0,1]}}`)."""
|
|
80
|
+
with Path(path).open(encoding="utf-8") as fh:
|
|
81
|
+
raw = yaml.safe_load(fh)
|
|
82
|
+
if not isinstance(raw, dict):
|
|
83
|
+
raise ValueError(f"signal map did not parse as a mapping: {path}")
|
|
84
|
+
return SignalMap.model_validate(raw)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class RecordingMujocoAdapter(MujocoAdapter):
|
|
88
|
+
"""MujocoAdapter that samples the engine per tick, for rehearsal traces.
|
|
89
|
+
|
|
90
|
+
Satisfies the rehearsal `TraceRecorder` protocol via `samples()`.
|
|
91
|
+
Timestamps are the engine's own `data.time`, so the trace clock is the
|
|
92
|
+
physics clock.
|
|
93
|
+
"""
|
|
94
|
+
|
|
95
|
+
def __init__(
|
|
96
|
+
self,
|
|
97
|
+
config: MujocoConfig | None = None,
|
|
98
|
+
*,
|
|
99
|
+
signal_map: SignalMap,
|
|
100
|
+
sample_every_n_steps: int = 1,
|
|
101
|
+
) -> None:
|
|
102
|
+
super().__init__(config)
|
|
103
|
+
if sample_every_n_steps < 1:
|
|
104
|
+
raise ValueError("sample_every_n_steps must be >= 1")
|
|
105
|
+
self._signal_map = signal_map
|
|
106
|
+
self._sample_every = sample_every_n_steps
|
|
107
|
+
self._recorded: list[Sample] = []
|
|
108
|
+
self._tick = 0
|
|
109
|
+
|
|
110
|
+
def samples(self) -> tuple[Sample, ...]:
|
|
111
|
+
return tuple(self._recorded)
|
|
112
|
+
|
|
113
|
+
def _step(self, n: int) -> None:
|
|
114
|
+
model, data = self._sim()
|
|
115
|
+
for _ in range(max(1, n)):
|
|
116
|
+
self._mujoco.mj_step(model, data)
|
|
117
|
+
self._tick += 1
|
|
118
|
+
if self._tick % self._sample_every == 0:
|
|
119
|
+
self._recorded.append(self._sample_from(data))
|
|
120
|
+
|
|
121
|
+
def _sample_from(self, data: Any) -> Sample:
|
|
122
|
+
return Sample(
|
|
123
|
+
t=float(data.time),
|
|
124
|
+
signals={name: spec.read(data) for name, spec in self._signal_map.signals.items()},
|
|
125
|
+
)
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""Live smoke for MujocoAdapter under a real ``mujoco`` install.
|
|
2
|
+
|
|
3
|
+
The MuJoCo analog of the PX4 runtime's
|
|
4
|
+
``tests/integration/test_px4_adapter_live.py``. It is the *light*
|
|
5
|
+
gate: it needs only the real ``mujoco`` wheel installed. It constructs
|
|
6
|
+
``MujocoAdapter`` (construction requires mujoco but does NOT load a
|
|
7
|
+
model — ``_sim`` is lazy and only fires on the first Protocol call) and
|
|
8
|
+
confirms the ``ConformanceRunner.adapter_factory`` hook accepts it. No
|
|
9
|
+
MJCF model is loaded here; a model-driven end-to-end run is the
|
|
10
|
+
documented calibration step in ``mujoco-integration.yml``.
|
|
11
|
+
|
|
12
|
+
## Gating
|
|
13
|
+
|
|
14
|
+
The default ``pytest`` invocation skips this module entirely. The
|
|
15
|
+
``mujoco-smoke`` job in ``.github/workflows/mujoco-integration.yml``
|
|
16
|
+
sets ``URML_MUJOCO_INTEGRATION=1`` and runs it.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
import os
|
|
22
|
+
|
|
23
|
+
import pytest
|
|
24
|
+
|
|
25
|
+
pytestmark = pytest.mark.skipif(
|
|
26
|
+
os.environ.get("URML_MUJOCO_INTEGRATION") != "1",
|
|
27
|
+
reason="Set URML_MUJOCO_INTEGRATION=1 to run the MuJoCo live smoke (real mujoco wheel, no model).",
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def test_real_mujoco_is_importable() -> None:
|
|
32
|
+
"""The real mujoco module is available under the smoke env."""
|
|
33
|
+
import mujoco # noqa: F401
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_adapter_constructs_against_real_mujoco() -> None:
|
|
37
|
+
"""MujocoAdapter constructs against real mujoco without loading a model.
|
|
38
|
+
|
|
39
|
+
Construction calls ``_require_mujoco()`` (so it needs the real
|
|
40
|
+
wheel) but must NOT load an MJCF model — ``_sim`` is lazy and only
|
|
41
|
+
fires on the first Protocol call.
|
|
42
|
+
"""
|
|
43
|
+
from urml_mujoco_runtime import MujocoAdapter
|
|
44
|
+
|
|
45
|
+
with MujocoAdapter() as adapter:
|
|
46
|
+
assert adapter._model is None # no Protocol method called -> no model loaded
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def test_conformance_runner_accepts_real_adapter_factory() -> None:
|
|
50
|
+
"""The ConformanceRunner accepts a real MujocoAdapter factory.
|
|
51
|
+
|
|
52
|
+
Does NOT run the fixture suite (that needs a real MJCF model — the
|
|
53
|
+
documented calibration step). The hook itself is under test; it must
|
|
54
|
+
accept a real-adapter factory without raising.
|
|
55
|
+
"""
|
|
56
|
+
from urml_conformance import ConformanceRunner
|
|
57
|
+
|
|
58
|
+
from urml_mujoco_runtime import MujocoAdapter, MujocoConfig
|
|
59
|
+
|
|
60
|
+
runner = ConformanceRunner(adapter_factory=lambda: MujocoAdapter(MujocoConfig(model_path="model.xml")))
|
|
61
|
+
assert runner is not None
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"""Hermetic unit tests for MujocoAdapter — no mujoco install needed.
|
|
2
|
+
|
|
3
|
+
A fake ``mujoco`` module is injected into ``sys.modules`` so
|
|
4
|
+
``_require_mujoco`` resolves and ``_sim`` runs against a controllable
|
|
5
|
+
double (the same technique px4-runtime / marine-runtime use).
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import sys
|
|
11
|
+
from collections.abc import Iterator
|
|
12
|
+
from types import ModuleType
|
|
13
|
+
from typing import Any
|
|
14
|
+
|
|
15
|
+
import pytest
|
|
16
|
+
from urml_ros2_runtime.substrate.base import ManipulationResult, ROSAdapter
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class _FakeModel:
|
|
20
|
+
pass
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class _FakeData:
|
|
24
|
+
def __init__(self) -> None:
|
|
25
|
+
self.ctrl = [0.0, 0.0, 0.0]
|
|
26
|
+
self.sensordata = [42.0]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class _FakeMujoco(ModuleType):
|
|
30
|
+
def __init__(self) -> None:
|
|
31
|
+
super().__init__("mujoco")
|
|
32
|
+
self.steps = 0
|
|
33
|
+
self.last_data: _FakeData | None = None
|
|
34
|
+
|
|
35
|
+
class MjModel:
|
|
36
|
+
@staticmethod
|
|
37
|
+
def from_xml_path(path: str) -> _FakeModel:
|
|
38
|
+
return _FakeModel()
|
|
39
|
+
|
|
40
|
+
outer = self
|
|
41
|
+
|
|
42
|
+
def MjData(model: _FakeModel) -> _FakeData: # noqa: N802
|
|
43
|
+
d = _FakeData()
|
|
44
|
+
outer.last_data = d
|
|
45
|
+
return d
|
|
46
|
+
|
|
47
|
+
def mj_step(model: _FakeModel, data: _FakeData) -> None:
|
|
48
|
+
outer.steps += 1
|
|
49
|
+
|
|
50
|
+
self.MjModel = MjModel # type: ignore[attr-defined]
|
|
51
|
+
self.MjData = MjData # type: ignore[attr-defined]
|
|
52
|
+
self.mj_step = mj_step # type: ignore[attr-defined]
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@pytest.fixture
|
|
56
|
+
def fake_mujoco() -> Iterator[_FakeMujoco]:
|
|
57
|
+
fake = _FakeMujoco()
|
|
58
|
+
saved = sys.modules.get("mujoco")
|
|
59
|
+
sys.modules["mujoco"] = fake
|
|
60
|
+
try:
|
|
61
|
+
yield fake
|
|
62
|
+
finally:
|
|
63
|
+
if saved is None:
|
|
64
|
+
sys.modules.pop("mujoco", None)
|
|
65
|
+
else:
|
|
66
|
+
sys.modules["mujoco"] = saved
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def test_navigation_measure_scan_lifecycle(fake_mujoco: _FakeMujoco) -> None:
|
|
70
|
+
from urml_mujoco_runtime import MujocoAdapter, MujocoConfig
|
|
71
|
+
from urml_mujoco_runtime.adapter import ControlTarget
|
|
72
|
+
|
|
73
|
+
cfg = MujocoConfig(
|
|
74
|
+
model_path="model.xml",
|
|
75
|
+
steps_per_command=5,
|
|
76
|
+
location_to_target={"home_pose": ControlTarget(ctrl=[1.0, 2.0, 3.0])},
|
|
77
|
+
)
|
|
78
|
+
with MujocoAdapter(cfg) as sim:
|
|
79
|
+
assert isinstance(sim, ROSAdapter)
|
|
80
|
+
ok = sim.send_navigation_goal(location="home_pose")
|
|
81
|
+
assert ok.success and ok.final_pose == {"ctrl0": 1.0, "ctrl1": 2.0, "ctrl2": 3.0}
|
|
82
|
+
assert fake_mujoco.steps >= 5, "the engine was stepped"
|
|
83
|
+
assert fake_mujoco.last_data is not None and fake_mujoco.last_data.ctrl[0] == 1.0
|
|
84
|
+
miss = sim.send_navigation_goal(location="nowhere")
|
|
85
|
+
assert miss.success is False and miss.reason is not None
|
|
86
|
+
assert miss.reason.startswith("location_not_configured")
|
|
87
|
+
assert sim.wait_passively(duration_seconds=0.1).success
|
|
88
|
+
meas = sim.take_measurement(what="state", target=None, sensor=None)
|
|
89
|
+
assert meas.success and meas.payload is not None and meas.payload["value"] == 42.0
|
|
90
|
+
scan = sim.run_scan(
|
|
91
|
+
area={}, pattern="serpentine", overlap=0.1, altitude=None, media="sensor_only", sensor=None
|
|
92
|
+
)
|
|
93
|
+
assert not scan.success and "area-scan controller" in (scan.reason or "")
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def test_unsupported_and_sim_sentinels(fake_mujoco: _FakeMujoco) -> None:
|
|
97
|
+
from urml_mujoco_runtime import MujocoAdapter, MujocoConfig
|
|
98
|
+
|
|
99
|
+
sim = MujocoAdapter(MujocoConfig(model_path="model.xml"))
|
|
100
|
+
bare: ManipulationResult = sim.send_manipulation_goal(action="grasp")
|
|
101
|
+
assert bare.success is False
|
|
102
|
+
assert bare.reason is not None and bare.reason.startswith("not_supported_in_base_sim")
|
|
103
|
+
for r in (sim.send_takeoff_goal(altitude=1.0), sim.send_land_goal(), sim.send_return_to_home_goal()):
|
|
104
|
+
assert r.success is False
|
|
105
|
+
assert r.reason is not None and r.reason.startswith("not_applicable_sim")
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def test_model_path_required_is_actionable(fake_mujoco: _FakeMujoco) -> None:
|
|
109
|
+
"""A construction with no model_path fails clearly at first sim use, not opaquely."""
|
|
110
|
+
from urml_mujoco_runtime import MujocoAdapter
|
|
111
|
+
|
|
112
|
+
sim = MujocoAdapter() # default config, empty model_path
|
|
113
|
+
with pytest.raises(RuntimeError, match=r"model_path not configured"):
|
|
114
|
+
sim.send_navigation_goal(location="x")
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def test_missing_mujoco_is_actionable(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
118
|
+
"""Construction without the [sim] extra raises a clear error.
|
|
119
|
+
|
|
120
|
+
Setting the sys.modules entry to None forces ``import mujoco`` to
|
|
121
|
+
raise ImportError deterministically, whether or not mujoco is
|
|
122
|
+
actually installed in the test environment.
|
|
123
|
+
"""
|
|
124
|
+
from urml_mujoco_runtime import MujocoAdapter
|
|
125
|
+
|
|
126
|
+
monkeypatch.setitem(sys.modules, "mujoco", None)
|
|
127
|
+
with pytest.raises(RuntimeError, match=r"\[sim\] extra"):
|
|
128
|
+
MujocoAdapter()
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def test_conformance_runner_accepts_factory(fake_mujoco: _FakeMujoco) -> None:
|
|
132
|
+
from urml_conformance import ConformanceRunner
|
|
133
|
+
|
|
134
|
+
from urml_mujoco_runtime import MujocoAdapter, MujocoConfig
|
|
135
|
+
|
|
136
|
+
assert ConformanceRunner(adapter_factory=lambda: MujocoAdapter(MujocoConfig(model_path="m.xml"))) is not None
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"""RFC-0668: SignalMap semantics (hermetic) + recording rollout (needs the [sim] extra)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
import pytest
|
|
8
|
+
from pydantic import ValidationError
|
|
9
|
+
|
|
10
|
+
from urml_mujoco_runtime.recording import SignalMap, SignalSpec, load_signal_map
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class _FakeData:
|
|
14
|
+
"""Duck-typed stand-in for mujoco.MjData (hermetic SignalSpec tests)."""
|
|
15
|
+
|
|
16
|
+
def __init__(self) -> None:
|
|
17
|
+
self.qpos = [1.0, 2.0, 5.0]
|
|
18
|
+
self.qvel = [3.0, 4.0, 0.0]
|
|
19
|
+
self.sensordata = [7.5]
|
|
20
|
+
self.time = 0.002
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def test_signal_spec_scalar_reads() -> None:
|
|
24
|
+
assert SignalSpec(source="qpos", index=2).read(_FakeData()) == 5.0
|
|
25
|
+
assert SignalSpec(source="sensordata", index=0).read(_FakeData()) == 7.5
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def test_signal_spec_norm_read() -> None:
|
|
29
|
+
# speed as the norm of two qvel components: sqrt(3^2 + 4^2) = 5.
|
|
30
|
+
assert SignalSpec(source="qvel", indices=[0, 1]).read(_FakeData()) == 5.0
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def test_signal_spec_const_read() -> None:
|
|
34
|
+
assert SignalSpec(source="const", value=100.0).read(_FakeData()) == 100.0
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def test_signal_spec_coherence() -> None:
|
|
38
|
+
with pytest.raises(ValidationError, match="const"):
|
|
39
|
+
SignalSpec(source="const")
|
|
40
|
+
with pytest.raises(ValidationError, match="exactly one"):
|
|
41
|
+
SignalSpec(source="qvel")
|
|
42
|
+
with pytest.raises(ValidationError, match="exactly one"):
|
|
43
|
+
SignalSpec(source="qvel", index=0, indices=[0, 1])
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def test_load_signal_map(tmp_path: Path) -> None:
|
|
47
|
+
path = tmp_path / "signals.yaml"
|
|
48
|
+
path.write_text(
|
|
49
|
+
"signals:\n"
|
|
50
|
+
" speed: {source: qvel, indices: [0, 1]}\n"
|
|
51
|
+
" altitude: {source: qpos, index: 2}\n"
|
|
52
|
+
" person_distance: {source: const, value: 100.0}\n",
|
|
53
|
+
encoding="utf-8",
|
|
54
|
+
)
|
|
55
|
+
signal_map = load_signal_map(path)
|
|
56
|
+
data = _FakeData()
|
|
57
|
+
assert signal_map.signals["speed"].read(data) == 5.0
|
|
58
|
+
assert signal_map.signals["altitude"].read(data) == 5.0
|
|
59
|
+
assert signal_map.signals["person_distance"].read(data) == 100.0
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def test_recording_rollout_produces_increasing_trace() -> None:
|
|
63
|
+
"""Real-physics rollout; runs only where the [sim] extra is installed."""
|
|
64
|
+
pytest.importorskip("mujoco")
|
|
65
|
+
from urml_mujoco_runtime import MujocoConfig, RecordingMujocoAdapter
|
|
66
|
+
from urml_mujoco_runtime.config import ControlTarget
|
|
67
|
+
|
|
68
|
+
mjcf = Path(__file__).parent / "fixtures" / "pendulum.xml"
|
|
69
|
+
if not mjcf.is_file():
|
|
70
|
+
pytest.skip("no MJCF fixture on this host")
|
|
71
|
+
adapter = RecordingMujocoAdapter(
|
|
72
|
+
MujocoConfig(
|
|
73
|
+
model_path=str(mjcf),
|
|
74
|
+
locations={"target": ControlTarget(ctrl=[0.5])},
|
|
75
|
+
steps_per_command=10,
|
|
76
|
+
),
|
|
77
|
+
signal_map=SignalMap(
|
|
78
|
+
signals={
|
|
79
|
+
"speed": SignalSpec(source="qvel", indices=[0]),
|
|
80
|
+
"person_distance": SignalSpec(source="const", value=100.0),
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
)
|
|
84
|
+
adapter.send_navigation_goal(location="target")
|
|
85
|
+
trace = adapter.samples()
|
|
86
|
+
assert len(trace) == 10
|
|
87
|
+
times = [s.t for s in trace]
|
|
88
|
+
assert times == sorted(times) and len(set(times)) == len(times)
|
|
89
|
+
assert all("speed" in s.signals for s in trace)
|