urml-autosar-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.
- urml_autosar_runtime-0.5.0/.gitignore +114 -0
- urml_autosar_runtime-0.5.0/PKG-INFO +101 -0
- urml_autosar_runtime-0.5.0/README.md +70 -0
- urml_autosar_runtime-0.5.0/SPEC-GAPS.md +62 -0
- urml_autosar_runtime-0.5.0/pyproject.toml +86 -0
- urml_autosar_runtime-0.5.0/src/urml_autosar_runtime/__init__.py +23 -0
- urml_autosar_runtime-0.5.0/src/urml_autosar_runtime/_version.py +3 -0
- urml_autosar_runtime-0.5.0/src/urml_autosar_runtime/adapter.py +318 -0
- urml_autosar_runtime-0.5.0/src/urml_autosar_runtime/config.py +70 -0
- urml_autosar_runtime-0.5.0/src/urml_autosar_runtime/py.typed +0 -0
- urml_autosar_runtime-0.5.0/tests/__init__.py +0 -0
- urml_autosar_runtime-0.5.0/tests/integration/__init__.py +0 -0
- urml_autosar_runtime-0.5.0/tests/integration/test_autosar_adapter_live.py +60 -0
- urml_autosar_runtime-0.5.0/tests/test_autosar_adapter.py +130 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# --- Python ---
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
build/
|
|
8
|
+
dist/
|
|
9
|
+
develop-eggs/
|
|
10
|
+
downloads/
|
|
11
|
+
eggs/
|
|
12
|
+
.eggs/
|
|
13
|
+
lib/
|
|
14
|
+
lib64/
|
|
15
|
+
parts/
|
|
16
|
+
sdist/
|
|
17
|
+
var/
|
|
18
|
+
wheels/
|
|
19
|
+
*.egg-info/
|
|
20
|
+
.installed.cfg
|
|
21
|
+
*.egg
|
|
22
|
+
MANIFEST
|
|
23
|
+
|
|
24
|
+
# Virtual envs
|
|
25
|
+
.venv/
|
|
26
|
+
venv/
|
|
27
|
+
env/
|
|
28
|
+
ENV/
|
|
29
|
+
.python-version
|
|
30
|
+
|
|
31
|
+
# Test / coverage / mypy / pyright
|
|
32
|
+
.coverage
|
|
33
|
+
.coverage.*
|
|
34
|
+
.cache
|
|
35
|
+
.pytest_cache/
|
|
36
|
+
.mypy_cache/
|
|
37
|
+
.dmypy.json
|
|
38
|
+
.pyre/
|
|
39
|
+
.pyright/
|
|
40
|
+
htmlcov/
|
|
41
|
+
nosetests.xml
|
|
42
|
+
coverage.xml
|
|
43
|
+
*.cover
|
|
44
|
+
.hypothesis/
|
|
45
|
+
.tox/
|
|
46
|
+
|
|
47
|
+
# --- Node / web tooling (kept out of core repo; here for safety) ---
|
|
48
|
+
node_modules/
|
|
49
|
+
.pnp.*
|
|
50
|
+
.yarn/cache/
|
|
51
|
+
.yarn/unplugged/
|
|
52
|
+
.yarn/build-state.yml
|
|
53
|
+
.yarn/install-state.gz
|
|
54
|
+
npm-debug.log*
|
|
55
|
+
yarn-debug.log*
|
|
56
|
+
yarn-error.log*
|
|
57
|
+
|
|
58
|
+
# --- C++ / Rust build artifacts (in case reference runtimes land here in early Phase 1) ---
|
|
59
|
+
target/
|
|
60
|
+
*.o
|
|
61
|
+
*.obj
|
|
62
|
+
*.a
|
|
63
|
+
*.lib
|
|
64
|
+
*.dll
|
|
65
|
+
*.dylib
|
|
66
|
+
*.exe
|
|
67
|
+
*.pdb
|
|
68
|
+
cmake-build-*/
|
|
69
|
+
CMakeCache.txt
|
|
70
|
+
CMakeFiles/
|
|
71
|
+
CMakeScripts/
|
|
72
|
+
Testing/
|
|
73
|
+
cmake_install.cmake
|
|
74
|
+
install_manifest.txt
|
|
75
|
+
compile_commands.json
|
|
76
|
+
|
|
77
|
+
# --- ROS 2 build dirs ---
|
|
78
|
+
build/
|
|
79
|
+
install/
|
|
80
|
+
log/
|
|
81
|
+
|
|
82
|
+
# --- Editor and OS junk ---
|
|
83
|
+
.vscode/
|
|
84
|
+
.idea/
|
|
85
|
+
*.swp
|
|
86
|
+
*.swo
|
|
87
|
+
*~
|
|
88
|
+
.DS_Store
|
|
89
|
+
Thumbs.db
|
|
90
|
+
desktop.ini
|
|
91
|
+
|
|
92
|
+
# --- Local-only artifacts ---
|
|
93
|
+
.env
|
|
94
|
+
.env.*
|
|
95
|
+
*.log
|
|
96
|
+
*.tmp
|
|
97
|
+
.local/
|
|
98
|
+
.scratch/
|
|
99
|
+
|
|
100
|
+
# --- Outreach campaign artifacts (operational, not part of the open standard) ---
|
|
101
|
+
# Target lists, message drafts, tracking data, and the launch-approval record
|
|
102
|
+
# stay local. They are private to the maintainer; committing them would
|
|
103
|
+
# telegraph the campaign before launch and could embarrass listed projects.
|
|
104
|
+
outreach/
|
|
105
|
+
|
|
106
|
+
# Outreach dashboard SQLite mirror (RFC-0275). Derived from
|
|
107
|
+
# examples/lighthouses/outreach*.yaml via tools/scripts/refresh_outreach_db.py.
|
|
108
|
+
# Regenerated on demand by `make outreach-refresh`.
|
|
109
|
+
tools/outreach.db
|
|
110
|
+
tools/.outreach.db
|
|
111
|
+
|
|
112
|
+
# Local Claude Code settings (per-machine; permission rules, etc.). Not committed.
|
|
113
|
+
.claude/settings.json
|
|
114
|
+
.claude/settings.local.json
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: urml-autosar-runtime
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: Industrial-automation reference runtime for URML — AUTOSAR Adaptive, 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: autosar,fieldbus,industrial,opc-ua,plc,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: autosar
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest-cov>=5; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
29
|
+
Requires-Dist: ruff>=0.5; extra == 'dev'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
<p align="center">
|
|
33
|
+
<a href="https://urml.dev"><img src="https://urml.dev/favicon.svg" alt="URML" width="72" height="72"></a>
|
|
34
|
+
</p>
|
|
35
|
+
|
|
36
|
+
<p align="center">
|
|
37
|
+
A small, opinionated, human-readable language for describing robot intent.
|
|
38
|
+
</p>
|
|
39
|
+
|
|
40
|
+
<p align="center">
|
|
41
|
+
<a href="https://urml.dev"><b>urml.dev</b></a>
|
|
42
|
+
</p>
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
# urml-autosar-runtime
|
|
47
|
+
|
|
48
|
+
**Industrial-automation reference runtime for URML** — `AutosarAdaptiveAdapter` for **AUTOSAR Adaptive** cells, via `ara`.
|
|
49
|
+
|
|
50
|
+
AUTOSAR Adaptive is the universal factory-floor / PLC companion spec. This adapter is the industrial-automation analog of the PX4/marine no-ROS proof and mirrors `BlueRovAdapter`: lazy `ara`, **no ROS 2 dependency**, a lazily-opened cached client, failures returned not raised. It hits the manufacturer / federal-procurement wedge ([RFC-0007](../../docs/rfcs/0007-manufacturer-go-to-market.md)) and complements the shipped industrial-arm family + [RFC-0013](../../docs/rfcs/0013-industrial-layer2-primitives.md) primitives. Built against the frozen substrate Protocol per [RFC-0014](../../docs/rfcs/0014-substrate-conformance.md).
|
|
51
|
+
|
|
52
|
+
## Method coverage
|
|
53
|
+
|
|
54
|
+
| URML primitive | v0.1 |
|
|
55
|
+
|---|---|
|
|
56
|
+
| `move_to` / `hover` | call the configured per-location AUTOSAR Adaptive method node |
|
|
57
|
+
| `dock` | call the configured station-service method — **the path RFC-0013 `swap_tool` rides, preserved** |
|
|
58
|
+
| `grasp` / `release` | call the configured manipulation method |
|
|
59
|
+
| `wait` | hold (success) |
|
|
60
|
+
| `measure` / `wait_for` | read the configured variable node |
|
|
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
|
+
`detect`, `capture`, `speak`, `listen` return `not_supported_on_autosar_ecu_cell` (pair a vision/HMI companion). The drone trio returns `not_applicable_autosar`.
|
|
65
|
+
|
|
66
|
+
## Spec gaps (RFC-0014 protocol)
|
|
67
|
+
|
|
68
|
+
This runtime surfaced two genuinely inexpressible needs — filed as **RFC-0015** (ara::com Method/PLC-method invocation) and **RFC-0016** (real-time/cyclic manifest block), both `Draft`, maintainer-decided. They are **not** silently bolted on. See [`SPEC-GAPS.md`](SPEC-GAPS.md), which also flags the `ara` **LGPL-3.0** optional-dependency posture for maintainer ratification.
|
|
69
|
+
|
|
70
|
+
## Install / use
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pip install -e reference/autosar-runtime[autosar] # installs ara
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from urml_autosar_runtime import AutosarAdaptiveAdapter, AutosarConfig
|
|
78
|
+
from urml_autosar_runtime.adapter import MethodTarget
|
|
79
|
+
cfg = AutosarConfig(location_to_method={"pick_bin": MethodTarget(method="sid=MoveTo", args=["pick_bin"])})
|
|
80
|
+
with AutosarAdaptiveAdapter(cfg) as cell:
|
|
81
|
+
assert cell.send_navigation_goal(location="pick_bin").success
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Status
|
|
85
|
+
|
|
86
|
+
**v0.1 (this release):**
|
|
87
|
+
- `AutosarAdaptiveAdapter` + `AutosarConfig` (ara, no ROS). `autosar_ecu_cell` US-provenance manifest + `conformance/fixtures/industrial/07_autosar_ecu_cell_positive.yaml` (RFC-0013 `pick_from`/`place_at`) verified through the runner (hermetic against `MockROSAdapter`; adapter-agnostic against `AutosarAdaptiveAdapter`).
|
|
88
|
+
- Hermetic unit tests: nav (configured + unmapped), dock/swap_tool, grasp, measure, scan (not supported), lifecycle, the unconfigured / not-supported / not-applicable sentinels, the missing-`[autosar]`-extra error, the conformance hook; no ara install required.
|
|
89
|
+
- Gated `.github/workflows/autosar-integration.yml`: `autosar-smoke` (real ara), `autosar-arm64-build` (the Jetson-class QEMU signal), `autosar-server-e2e` against a local ara server (first run is a calibration run by design — the established px4/ros2/marine convention).
|
|
90
|
+
|
|
91
|
+
**Follow-ups (not yet):** RFC-0015/0016 outcomes; a bundled ara demo server for the e2e.
|
|
92
|
+
|
|
93
|
+
## Core Commitment
|
|
94
|
+
|
|
95
|
+
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. `ara` is an LGPL-3.0 *optional* dependency — see SPEC-GAPS.md.
|
|
96
|
+
|
|
97
|
+
## Related documents
|
|
98
|
+
|
|
99
|
+
- [`/reference/marine-runtime/`](../marine-runtime/) — the zero-ROS sibling whose structure this mirrors.
|
|
100
|
+
- [`/docs/rfcs/0014-substrate-conformance.md`](../../docs/rfcs/0014-substrate-conformance.md) — the conformance contract.
|
|
101
|
+
- [`/docs/rfcs/0015-control-program-invocation.md`](../../docs/rfcs/0015-control-program-invocation.md) · [`/docs/rfcs/0016-realtime-cyclic-manifest-block.md`](../../docs/rfcs/0016-realtime-cyclic-manifest-block.md) — the surfaced spec gaps.
|
|
@@ -0,0 +1,70 @@
|
|
|
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-autosar-runtime
|
|
16
|
+
|
|
17
|
+
**Industrial-automation reference runtime for URML** — `AutosarAdaptiveAdapter` for **AUTOSAR Adaptive** cells, via `ara`.
|
|
18
|
+
|
|
19
|
+
AUTOSAR Adaptive is the universal factory-floor / PLC companion spec. This adapter is the industrial-automation analog of the PX4/marine no-ROS proof and mirrors `BlueRovAdapter`: lazy `ara`, **no ROS 2 dependency**, a lazily-opened cached client, failures returned not raised. It hits the manufacturer / federal-procurement wedge ([RFC-0007](../../docs/rfcs/0007-manufacturer-go-to-market.md)) and complements the shipped industrial-arm family + [RFC-0013](../../docs/rfcs/0013-industrial-layer2-primitives.md) primitives. Built against the frozen substrate Protocol per [RFC-0014](../../docs/rfcs/0014-substrate-conformance.md).
|
|
20
|
+
|
|
21
|
+
## Method coverage
|
|
22
|
+
|
|
23
|
+
| URML primitive | v0.1 |
|
|
24
|
+
|---|---|
|
|
25
|
+
| `move_to` / `hover` | call the configured per-location AUTOSAR Adaptive method node |
|
|
26
|
+
| `dock` | call the configured station-service method — **the path RFC-0013 `swap_tool` rides, preserved** |
|
|
27
|
+
| `grasp` / `release` | call the configured manipulation method |
|
|
28
|
+
| `wait` | hold (success) |
|
|
29
|
+
| `measure` / `wait_for` | read the configured variable node |
|
|
30
|
+
| `report` | structured record to a local sink (no cloud) |
|
|
31
|
+
| `scan` | documented not-supported result: no area-scan controller (a scan is waypoints plus a capture at each one) |
|
|
32
|
+
|
|
33
|
+
`detect`, `capture`, `speak`, `listen` return `not_supported_on_autosar_ecu_cell` (pair a vision/HMI companion). The drone trio returns `not_applicable_autosar`.
|
|
34
|
+
|
|
35
|
+
## Spec gaps (RFC-0014 protocol)
|
|
36
|
+
|
|
37
|
+
This runtime surfaced two genuinely inexpressible needs — filed as **RFC-0015** (ara::com Method/PLC-method invocation) and **RFC-0016** (real-time/cyclic manifest block), both `Draft`, maintainer-decided. They are **not** silently bolted on. See [`SPEC-GAPS.md`](SPEC-GAPS.md), which also flags the `ara` **LGPL-3.0** optional-dependency posture for maintainer ratification.
|
|
38
|
+
|
|
39
|
+
## Install / use
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install -e reference/autosar-runtime[autosar] # installs ara
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from urml_autosar_runtime import AutosarAdaptiveAdapter, AutosarConfig
|
|
47
|
+
from urml_autosar_runtime.adapter import MethodTarget
|
|
48
|
+
cfg = AutosarConfig(location_to_method={"pick_bin": MethodTarget(method="sid=MoveTo", args=["pick_bin"])})
|
|
49
|
+
with AutosarAdaptiveAdapter(cfg) as cell:
|
|
50
|
+
assert cell.send_navigation_goal(location="pick_bin").success
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Status
|
|
54
|
+
|
|
55
|
+
**v0.1 (this release):**
|
|
56
|
+
- `AutosarAdaptiveAdapter` + `AutosarConfig` (ara, no ROS). `autosar_ecu_cell` US-provenance manifest + `conformance/fixtures/industrial/07_autosar_ecu_cell_positive.yaml` (RFC-0013 `pick_from`/`place_at`) verified through the runner (hermetic against `MockROSAdapter`; adapter-agnostic against `AutosarAdaptiveAdapter`).
|
|
57
|
+
- Hermetic unit tests: nav (configured + unmapped), dock/swap_tool, grasp, measure, scan (not supported), lifecycle, the unconfigured / not-supported / not-applicable sentinels, the missing-`[autosar]`-extra error, the conformance hook; no ara install required.
|
|
58
|
+
- Gated `.github/workflows/autosar-integration.yml`: `autosar-smoke` (real ara), `autosar-arm64-build` (the Jetson-class QEMU signal), `autosar-server-e2e` against a local ara server (first run is a calibration run by design — the established px4/ros2/marine convention).
|
|
59
|
+
|
|
60
|
+
**Follow-ups (not yet):** RFC-0015/0016 outcomes; a bundled ara demo server for the e2e.
|
|
61
|
+
|
|
62
|
+
## Core Commitment
|
|
63
|
+
|
|
64
|
+
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. `ara` is an LGPL-3.0 *optional* dependency — see SPEC-GAPS.md.
|
|
65
|
+
|
|
66
|
+
## Related documents
|
|
67
|
+
|
|
68
|
+
- [`/reference/marine-runtime/`](../marine-runtime/) — the zero-ROS sibling whose structure this mirrors.
|
|
69
|
+
- [`/docs/rfcs/0014-substrate-conformance.md`](../../docs/rfcs/0014-substrate-conformance.md) — the conformance contract.
|
|
70
|
+
- [`/docs/rfcs/0015-control-program-invocation.md`](../../docs/rfcs/0015-control-program-invocation.md) · [`/docs/rfcs/0016-realtime-cyclic-manifest-block.md`](../../docs/rfcs/0016-realtime-cyclic-manifest-block.md) — the surfaced spec gaps.
|
|
@@ -0,0 +1,62 @@
|
|
|
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-autosar-runtime
|
|
16
|
+
|
|
17
|
+
Per the spec-gap protocol (RFC-0014): this runtime is built strictly
|
|
18
|
+
against the frozen substrate Protocol. Anything the AUTOSAR Adaptive
|
|
19
|
+
substrate needs that URML cannot express is recorded here and, if
|
|
20
|
+
genuinely inexpressible, promoted to a numbered RFC Draft for
|
|
21
|
+
maintainer decision — never a silent primitive/schema change.
|
|
22
|
+
|
|
23
|
+
## Genuinely inexpressible → RFC Drafts filed
|
|
24
|
+
|
|
25
|
+
- **RFC-0015 — ara::com Method / PLC-method invocation.** AUTOSAR Adaptive
|
|
26
|
+
Robotics cells routinely expose "run named ara::com Method P with
|
|
27
|
+
arguments" or "call vendor method M". This is *not* `move_to`,
|
|
28
|
+
`grasp`, or `report`, and — unlike RFC-0013's `swap_tool`, which
|
|
29
|
+
legitimately rides `send_docking_goal` because it *is* a station
|
|
30
|
+
service — a general program/method call is not a station service.
|
|
31
|
+
No existing primitive composes it. Filed as RFC-0015 (Draft); until
|
|
32
|
+
accepted, the adapter exposes only nav/dock/grasp/measure/report and
|
|
33
|
+
does not invent a primitive.
|
|
34
|
+
|
|
35
|
+
- **RFC-0016 — Real-time / cyclic manifest block.** A fieldbus/AUTOSAR Adaptive
|
|
36
|
+
cell often has a cyclic update period, a watchdog, and a requested
|
|
37
|
+
packet interval (RPI). The Layer-1 manifest has no block to declare
|
|
38
|
+
these, so a runtime cannot state the timing contract it operates
|
|
39
|
+
under. This is a manifest-schema field, not a primitive. Filed as
|
|
40
|
+
RFC-0016 (Draft); v0.1 ships without it (timing is deployment config
|
|
41
|
+
in `autosar_adapter.yaml`, not URML-declared).
|
|
42
|
+
|
|
43
|
+
## Composable (no gap, documented)
|
|
44
|
+
|
|
45
|
+
- **Station services** (e.g. `swap_tool`, `park`) → `send_docking_goal`
|
|
46
|
+
with the service name, exactly the RFC-0013 path. Preserved
|
|
47
|
+
unchanged; `service_to_method` in `AutosarConfig` maps it.
|
|
48
|
+
- **Per-location motion** → `send_navigation_goal(location=...)` →
|
|
49
|
+
configured method node. Named-pose only (the companion spec is
|
|
50
|
+
method/node oriented); raw pose goals return an honest unsuccessful
|
|
51
|
+
result, not a gap.
|
|
52
|
+
|
|
53
|
+
## Maintainer ratification flag (not a spec gap)
|
|
54
|
+
|
|
55
|
+
`ara` is **LGPL-3.0**. In-repo code is BSL 1.1 and depends on it
|
|
56
|
+
**only** via the optional `[autosar]` extra, never imported at module
|
|
57
|
+
load (the same posture as `rclpy` / `pymavlink`), so the Core
|
|
58
|
+
Commitment boundary is intact and this runtime is outside that
|
|
59
|
+
boundary regardless. Whether an LGPL optional dependency in a
|
|
60
|
+
reference runtime is acceptable is a licensing-posture call for the
|
|
61
|
+
maintainer to ratify on this PR. Fallback if rejected: gate the AUTOSAR Adaptive
|
|
62
|
+
server-integration to CI only, or vendor a minimal pure-Apache client.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.27"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "urml-autosar-runtime"
|
|
7
|
+
version = "0.5.0"
|
|
8
|
+
description = "Industrial-automation reference runtime for URML — AUTOSAR Adaptive, 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", "industrial", "opc-ua", "autosar", "plc", "fieldbus", "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
|
+
# AUTOSAR Adaptive — manifesto-named target. There is no broadly-
|
|
33
|
+
# available open-source Python ara::com stack at v0.1; deployments use
|
|
34
|
+
# a vendor adaptive-stack Python binding (Vector Informatik, ETAS,
|
|
35
|
+
# Aptiv) that is not redistributable through PyPI. The [autosar] extra
|
|
36
|
+
# is intentionally a placeholder so the install surface exists; sites
|
|
37
|
+
# point pip at their vendor wheel index. Imports are lazy — the
|
|
38
|
+
# adapter runs hermetic tests with the vendor module ABSENT (the
|
|
39
|
+
# px4/cobot/opcua posture). See SPEC-GAPS.md and isaac-integration.yml
|
|
40
|
+
# style HONESTY NOTE for the calibration-staged live e2e.
|
|
41
|
+
autosar = [
|
|
42
|
+
# Placeholder. Replace with your vendor's ara::com Python wheel at
|
|
43
|
+
# deployment time, e.g.:
|
|
44
|
+
# "vector-cara>=1.0",
|
|
45
|
+
# "etas-rta-vrte-py>=2",
|
|
46
|
+
# The hermetic suite injects a fake `ara` module into sys.modules so
|
|
47
|
+
# the test surface holds without any of these.
|
|
48
|
+
]
|
|
49
|
+
dev = [
|
|
50
|
+
"pytest>=8",
|
|
51
|
+
"pytest-cov>=5",
|
|
52
|
+
"ruff>=0.5",
|
|
53
|
+
"mypy>=1.10",
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
[project.urls]
|
|
57
|
+
Homepage = "https://github.com/urml-dev/URML"
|
|
58
|
+
Repository = "https://github.com/urml-dev/URML"
|
|
59
|
+
Issues = "https://github.com/urml-dev/URML/issues"
|
|
60
|
+
|
|
61
|
+
[tool.hatch.build.targets.wheel]
|
|
62
|
+
packages = ["src/urml_autosar_runtime"]
|
|
63
|
+
|
|
64
|
+
[tool.ruff]
|
|
65
|
+
line-length = 120
|
|
66
|
+
target-version = "py311"
|
|
67
|
+
src = ["src", "tests"]
|
|
68
|
+
|
|
69
|
+
[tool.ruff.lint]
|
|
70
|
+
select = ["E", "F", "W", "I", "B", "UP", "N", "ANN", "RUF"]
|
|
71
|
+
ignore = ["ANN401"]
|
|
72
|
+
|
|
73
|
+
[tool.ruff.lint.per-file-ignores]
|
|
74
|
+
"tests/*" = ["ANN"]
|
|
75
|
+
|
|
76
|
+
[tool.mypy]
|
|
77
|
+
strict = true
|
|
78
|
+
python_version = "3.11"
|
|
79
|
+
plugins = ["pydantic.mypy"]
|
|
80
|
+
mypy_path = "src"
|
|
81
|
+
packages = ["urml_autosar_runtime"]
|
|
82
|
+
|
|
83
|
+
[tool.pytest.ini_options]
|
|
84
|
+
minversion = "8.0"
|
|
85
|
+
testpaths = ["tests"]
|
|
86
|
+
addopts = ["-q", "--strict-markers"]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""urml_autosar_runtime — industrial-automation reference runtime for URML.
|
|
2
|
+
|
|
3
|
+
AutosarAdaptiveAdapter (+ AutosarConfig, load_autosar_config)
|
|
4
|
+
AUTOSAR Adaptive companion-spec robot cells via ara. **No ROS 2
|
|
5
|
+
dependency** — the industrial-automation analog of the PX4/marine
|
|
6
|
+
no-ROS proof, hitting the factory-floor / federal-procurement wedge
|
|
7
|
+
(RFC-0007). ara is imported lazily (the [autosar] extra), so this
|
|
8
|
+
module loads on every host. Built against the frozen substrate
|
|
9
|
+
Protocol per RFC-0014; spec gaps are recorded in SPEC-GAPS.md, not
|
|
10
|
+
silently patched.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
from urml_autosar_runtime._version import __version__
|
|
16
|
+
from urml_autosar_runtime.adapter import AutosarAdaptiveAdapter, AutosarConfig, load_autosar_config
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"AutosarAdaptiveAdapter",
|
|
20
|
+
"AutosarConfig",
|
|
21
|
+
"__version__",
|
|
22
|
+
"load_autosar_config",
|
|
23
|
+
]
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
"""AutosarAdaptiveAdapter — AUTOSAR Adaptive cell, via ara.
|
|
2
|
+
|
|
3
|
+
AUTOSAR Adaptive is the universal factory-floor companion spec; this is
|
|
4
|
+
the industrial-automation analog of the PX4/marine no-ROS proof and
|
|
5
|
+
mirrors :class:`BlueRovAdapter`: lazy ``ara``, **no ROS 2
|
|
6
|
+
dependency**, a lazily-opened cached client, failures returned not
|
|
7
|
+
raised. It hits the manufacturer / federal-procurement wedge
|
|
8
|
+
(RFC-0007) and complements the shipped industrial-arm family +
|
|
9
|
+
RFC-0013 primitives.
|
|
10
|
+
|
|
11
|
+
## v0.1 method coverage
|
|
12
|
+
|
|
13
|
+
Supported (mapped onto configured AUTOSAR Adaptive method/variable nodes):
|
|
14
|
+
|
|
15
|
+
- ``move_to`` / ``hover`` → call the configured per-location method
|
|
16
|
+
node (location → method+args via :class:`AutosarConfig`).
|
|
17
|
+
- ``dock`` → call the configured station-service method; this is the
|
|
18
|
+
path RFC-0013 ``swap_tool`` rides (service name keyed in config),
|
|
19
|
+
preserved unchanged.
|
|
20
|
+
- ``grasp`` / ``release`` → call the configured manipulation method.
|
|
21
|
+
- ``wait`` → no-op success (a cell holds position).
|
|
22
|
+
- ``measure`` / ``wait_for`` → read the configured variable node once.
|
|
23
|
+
- ``report`` → structured record to a local sink (no cloud — manifesto).
|
|
24
|
+
- ``scan`` → documented not-supported result: this adapter does not
|
|
25
|
+
expand an area into waypoints or capture along them.
|
|
26
|
+
|
|
27
|
+
Not supported by a bare cell (returned, not raised): ``detect``,
|
|
28
|
+
``capture``, ``speak``, ``listen`` — pair a vision/HMI companion. The
|
|
29
|
+
drone trio ``take_off`` / ``land`` / ``return_to_home`` are
|
|
30
|
+
``not_applicable_autosar``.
|
|
31
|
+
|
|
32
|
+
A general "invoke a named ara::com Method / PLC method with arguments"
|
|
33
|
+
is **not** expressible with the current primitives (it is not a
|
|
34
|
+
station service, unlike ``swap_tool``); that is a recorded spec gap
|
|
35
|
+
(see ``SPEC-GAPS.md`` → RFC-0015), not silently bolted on here.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
from __future__ import annotations
|
|
39
|
+
|
|
40
|
+
from contextlib import suppress
|
|
41
|
+
from typing import Any, Literal
|
|
42
|
+
|
|
43
|
+
from urml_ros2_runtime.substrate.base import (
|
|
44
|
+
ProgramCallResult,
|
|
45
|
+
unsupported_program_call,
|
|
46
|
+
CaptureResult,
|
|
47
|
+
DetectionResult,
|
|
48
|
+
ListenResult,
|
|
49
|
+
ManipulationResult,
|
|
50
|
+
MeasurementResult,
|
|
51
|
+
NavigationResult,
|
|
52
|
+
ScanResult,
|
|
53
|
+
SubstrateResult,
|
|
54
|
+
WaitResult,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
from urml_autosar_runtime._version import __version__
|
|
58
|
+
from urml_autosar_runtime.config import MethodTarget, AutosarConfig, load_autosar_config
|
|
59
|
+
|
|
60
|
+
__all__ = [
|
|
61
|
+
"MethodTarget",
|
|
62
|
+
"AutosarAdaptiveAdapter",
|
|
63
|
+
"AutosarConfig",
|
|
64
|
+
"__version__",
|
|
65
|
+
"load_autosar_config",
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
_NOT_SUPPORTED = (
|
|
69
|
+
"not_supported_on_autosar_ecu_cell: a bare AUTOSAR Adaptive cell has no {capability}. "
|
|
70
|
+
"Pair it with a vision/HMI companion adapter; the URML program, manifest, "
|
|
71
|
+
"and validator are unchanged."
|
|
72
|
+
)
|
|
73
|
+
_NOT_APPLICABLE = "not_applicable_autosar: {capability} has no meaning for a fixed industrial cell."
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def _require_ara() -> Any:
|
|
77
|
+
"""Lazy-import ara's sync client with a clear error when missing."""
|
|
78
|
+
try:
|
|
79
|
+
from ara.sync import Client # type: ignore[import-not-found,unused-ignore]
|
|
80
|
+
except ImportError as exc:
|
|
81
|
+
raise RuntimeError(
|
|
82
|
+
"ara is not installed. AutosarAdaptiveAdapter requires the [autosar] extra.\n"
|
|
83
|
+
" Install with: pip install urml-autosar-runtime[autosar]"
|
|
84
|
+
) from exc
|
|
85
|
+
return Client
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class AutosarAdaptiveAdapter:
|
|
89
|
+
"""AUTOSAR Adaptive adapter implementing the URML ROSAdapter Protocol."""
|
|
90
|
+
|
|
91
|
+
BRAND = "autosar"
|
|
92
|
+
|
|
93
|
+
def __init__(self, config: AutosarConfig | None = None) -> None:
|
|
94
|
+
self._client_cls = _require_ara()
|
|
95
|
+
self._config = config or AutosarConfig()
|
|
96
|
+
self._client: Any = None
|
|
97
|
+
self._objects: Any = None
|
|
98
|
+
self._reports: list[dict[str, Any]] = []
|
|
99
|
+
self._closed = False
|
|
100
|
+
|
|
101
|
+
def _connect(self) -> Any:
|
|
102
|
+
if self._client is not None:
|
|
103
|
+
return self._client
|
|
104
|
+
client = self._client_cls(self._config.endpoint_url, timeout=self._config.connect_timeout_seconds)
|
|
105
|
+
client.connect()
|
|
106
|
+
self._client = client
|
|
107
|
+
self._objects = client.get_node(self._config.objects_node)
|
|
108
|
+
return client
|
|
109
|
+
|
|
110
|
+
def _call(self, mt: MethodTarget) -> Any:
|
|
111
|
+
self._connect()
|
|
112
|
+
return self._objects.call_method(mt.method, *mt.args)
|
|
113
|
+
|
|
114
|
+
def close(self) -> None:
|
|
115
|
+
if self._closed:
|
|
116
|
+
return
|
|
117
|
+
if self._client is not None:
|
|
118
|
+
with suppress(Exception):
|
|
119
|
+
self._client.disconnect()
|
|
120
|
+
self._closed = True
|
|
121
|
+
|
|
122
|
+
def __enter__(self) -> AutosarAdaptiveAdapter:
|
|
123
|
+
return self
|
|
124
|
+
|
|
125
|
+
def __exit__(self, *_: object) -> None:
|
|
126
|
+
self.close()
|
|
127
|
+
|
|
128
|
+
# ------------------------------------------------------------------
|
|
129
|
+
# Supported
|
|
130
|
+
# ------------------------------------------------------------------
|
|
131
|
+
|
|
132
|
+
def send_navigation_goal(
|
|
133
|
+
self,
|
|
134
|
+
*,
|
|
135
|
+
location: str | None = None,
|
|
136
|
+
pose: dict[str, float] | None = None,
|
|
137
|
+
frame: str | None = None,
|
|
138
|
+
carrying: dict[str, Any] | None = None,
|
|
139
|
+
speed: float | None = None,
|
|
140
|
+
) -> NavigationResult:
|
|
141
|
+
if location is None:
|
|
142
|
+
return NavigationResult(
|
|
143
|
+
success=False,
|
|
144
|
+
reason="autosar_requires_named_location: an AUTOSAR Adaptive cell drives to named "
|
|
145
|
+
"method-mapped poses; raw pose goals are not exposed by the companion spec.",
|
|
146
|
+
)
|
|
147
|
+
mt = self._config.resolve_location(location)
|
|
148
|
+
if mt is None:
|
|
149
|
+
return NavigationResult(
|
|
150
|
+
success=False,
|
|
151
|
+
reason=f"location_not_configured: {location!r} is declared in the "
|
|
152
|
+
"manifest but not mapped to a method in autosar_adapter.yaml.",
|
|
153
|
+
)
|
|
154
|
+
self._call(mt)
|
|
155
|
+
return NavigationResult(success=True, final_pose=None, frame=frame or "cell")
|
|
156
|
+
|
|
157
|
+
def send_docking_goal(self, *, station: str, service: str, until: str | None = None) -> NavigationResult:
|
|
158
|
+
mt = self._config.resolve_service(service)
|
|
159
|
+
if mt is None:
|
|
160
|
+
return NavigationResult(
|
|
161
|
+
success=False,
|
|
162
|
+
reason=f"service_not_configured: station service {service!r} (station "
|
|
163
|
+
f"{station!r}) is not mapped to a method in autosar_adapter.yaml.",
|
|
164
|
+
)
|
|
165
|
+
self._call(mt)
|
|
166
|
+
return NavigationResult(success=True, final_pose=None, frame="cell")
|
|
167
|
+
|
|
168
|
+
def send_manipulation_goal(
|
|
169
|
+
self,
|
|
170
|
+
*,
|
|
171
|
+
action: Literal["grasp", "release"],
|
|
172
|
+
target: dict[str, Any] | None = None,
|
|
173
|
+
force_n: float | None = None,
|
|
174
|
+
approach: Literal["top", "side", "front", "auto"] = "auto",
|
|
175
|
+
release_mode: Literal["drop", "place", "hand_to_user"] | None = None,
|
|
176
|
+
release_at: dict[str, Any] | str | None = None,
|
|
177
|
+
arm: str | None = None,
|
|
178
|
+
grasp_type: str | None = None,
|
|
179
|
+
target_motion: str | None = None,
|
|
180
|
+
) -> ManipulationResult:
|
|
181
|
+
mt = self._config.manipulation_methods.get(action)
|
|
182
|
+
if mt is None:
|
|
183
|
+
return ManipulationResult(
|
|
184
|
+
success=False,
|
|
185
|
+
reason=f"manipulation_method_not_configured: {action!r} is not mapped "
|
|
186
|
+
"to a method in autosar_adapter.yaml.",
|
|
187
|
+
)
|
|
188
|
+
self._call(mt)
|
|
189
|
+
return ManipulationResult(success=True)
|
|
190
|
+
|
|
191
|
+
def wait_passively(self, *, duration_seconds: float) -> SubstrateResult:
|
|
192
|
+
self._connect()
|
|
193
|
+
return SubstrateResult(success=True)
|
|
194
|
+
|
|
195
|
+
def take_measurement(self, *, what: str, target: str | None, sensor: str | None) -> MeasurementResult:
|
|
196
|
+
if self._config.measurement_node is None:
|
|
197
|
+
return MeasurementResult(success=True, payload={"value": None, "what": what})
|
|
198
|
+
self._connect()
|
|
199
|
+
node = self._client.get_node(self._config.measurement_node)
|
|
200
|
+
value = node.read_value()
|
|
201
|
+
return MeasurementResult(success=True, payload={"value": value, "what": what})
|
|
202
|
+
|
|
203
|
+
def wait_for_condition(
|
|
204
|
+
self,
|
|
205
|
+
*,
|
|
206
|
+
kind: Literal["event", "signal", "input", "sensor_threshold"],
|
|
207
|
+
name: str | None,
|
|
208
|
+
input_mode: str | None,
|
|
209
|
+
threshold: dict[str, Any] | None,
|
|
210
|
+
timeout_seconds: float | None,
|
|
211
|
+
) -> WaitResult:
|
|
212
|
+
if self._config.measurement_node is None:
|
|
213
|
+
self._connect()
|
|
214
|
+
return WaitResult(success=True, timed_out=False, payload=None)
|
|
215
|
+
node = self._client.get_node(self._config.measurement_node) if self._connect() else None
|
|
216
|
+
value = node.read_value() if node is not None else None
|
|
217
|
+
return WaitResult(success=True, timed_out=False, payload={"value": value})
|
|
218
|
+
|
|
219
|
+
def emit_report(
|
|
220
|
+
self,
|
|
221
|
+
*,
|
|
222
|
+
to: str,
|
|
223
|
+
facts: dict[str, Any],
|
|
224
|
+
attachments: list[str] | None,
|
|
225
|
+
status: Literal["success", "partial", "failure"],
|
|
226
|
+
severity: Literal["info", "notice", "warning", "error"],
|
|
227
|
+
) -> SubstrateResult:
|
|
228
|
+
self._reports.append({"to": to, "status": status, "severity": severity, "facts": facts})
|
|
229
|
+
return SubstrateResult(success=True)
|
|
230
|
+
|
|
231
|
+
def run_scan(
|
|
232
|
+
self,
|
|
233
|
+
*,
|
|
234
|
+
area: dict[str, Any],
|
|
235
|
+
pattern: Literal["serpentine", "spiral", "grid", "adaptive"],
|
|
236
|
+
overlap: float,
|
|
237
|
+
altitude: float | None,
|
|
238
|
+
media: Literal["photo", "video", "sensor_only"],
|
|
239
|
+
sensor: str | None,
|
|
240
|
+
) -> ScanResult:
|
|
241
|
+
# A scan is waypoints plus a capture at each one, and this adapter
|
|
242
|
+
# does neither. Reporting success would claim an area was covered
|
|
243
|
+
# when nothing moved.
|
|
244
|
+
return ScanResult(success=False, reason=_NOT_SUPPORTED.format(capability="area-scan controller"))
|
|
245
|
+
|
|
246
|
+
# ------------------------------------------------------------------
|
|
247
|
+
# Not supported by a bare cell
|
|
248
|
+
# ------------------------------------------------------------------
|
|
249
|
+
|
|
250
|
+
def query_detection(
|
|
251
|
+
self,
|
|
252
|
+
*,
|
|
253
|
+
object_class: str,
|
|
254
|
+
attributes: dict[str, Any] | None = None,
|
|
255
|
+
where_near: str | None = None,
|
|
256
|
+
where_within: float | None = None,
|
|
257
|
+
) -> DetectionResult:
|
|
258
|
+
return DetectionResult(success=False, reason=_NOT_SUPPORTED.format(capability="onboard detection"))
|
|
259
|
+
|
|
260
|
+
def capture_media(
|
|
261
|
+
self,
|
|
262
|
+
*,
|
|
263
|
+
media: Literal["photo", "video"],
|
|
264
|
+
target: str | None,
|
|
265
|
+
duration_seconds: float | None,
|
|
266
|
+
attributes: dict[str, Any] | None,
|
|
267
|
+
camera: str | None = None,
|
|
268
|
+
) -> CaptureResult:
|
|
269
|
+
return CaptureResult(success=False, reason=_NOT_SUPPORTED.format(capability="recordable camera"))
|
|
270
|
+
|
|
271
|
+
def emit_speech(
|
|
272
|
+
self,
|
|
273
|
+
*,
|
|
274
|
+
utterance: str,
|
|
275
|
+
locale: str | None,
|
|
276
|
+
style: Literal["notice", "warning", "conversational"],
|
|
277
|
+
interrupt: bool,
|
|
278
|
+
) -> SubstrateResult:
|
|
279
|
+
return SubstrateResult(success=False, reason=_NOT_SUPPORTED.format(capability="speaker"))
|
|
280
|
+
|
|
281
|
+
def acquire_speech(
|
|
282
|
+
self,
|
|
283
|
+
*,
|
|
284
|
+
prompt: str | None,
|
|
285
|
+
locale: str | None,
|
|
286
|
+
timeout_seconds: float | None,
|
|
287
|
+
expected: Literal["free_form", "confirmation", "choice"],
|
|
288
|
+
choices: list[str] | None,
|
|
289
|
+
) -> ListenResult:
|
|
290
|
+
return ListenResult(success=False, reason=_NOT_SUPPORTED.format(capability="microphone"))
|
|
291
|
+
|
|
292
|
+
def send_takeoff_goal(self, *, altitude: float, climb_rate: float | None = None) -> NavigationResult:
|
|
293
|
+
return NavigationResult(success=False, reason=_NOT_APPLICABLE.format(capability="take_off"))
|
|
294
|
+
|
|
295
|
+
def send_land_goal(
|
|
296
|
+
self,
|
|
297
|
+
*,
|
|
298
|
+
at: str | None = None,
|
|
299
|
+
precision: Literal["standard", "precise"] = "standard",
|
|
300
|
+
) -> NavigationResult:
|
|
301
|
+
return NavigationResult(success=False, reason=_NOT_APPLICABLE.format(capability="land"))
|
|
302
|
+
|
|
303
|
+
def send_return_to_home_goal(
|
|
304
|
+
self,
|
|
305
|
+
*,
|
|
306
|
+
speed: float | None = None,
|
|
307
|
+
altitude: float | None = None,
|
|
308
|
+
) -> NavigationResult:
|
|
309
|
+
return NavigationResult(success=False, reason=_NOT_APPLICABLE.format(capability="return_to_home"))
|
|
310
|
+
|
|
311
|
+
def call_named_program(
|
|
312
|
+
self,
|
|
313
|
+
*,
|
|
314
|
+
name: str,
|
|
315
|
+
args: dict[str, Any] | None = None,
|
|
316
|
+
) -> ProgramCallResult:
|
|
317
|
+
"""``call_program``: this substrate exposes no named programs (RFC-0015)."""
|
|
318
|
+
return unsupported_program_call('autosar_ecu')
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""Deployment-side configuration for ``AutosarAdaptiveAdapter``.
|
|
2
|
+
|
|
3
|
+
An AUTOSAR Adaptive cell exposes its capabilities as method and variable
|
|
4
|
+
*nodes* under a server endpoint. Which node ids carry "move to a named
|
|
5
|
+
location", "run a station service", "grip", "read a sensor" are
|
|
6
|
+
deployment- and vendor-specific, so they do NOT belong in the URML
|
|
7
|
+
program, manifest, or envelope — they live in an ``autosar_adapter.yaml``
|
|
8
|
+
alongside the URML artifacts (the same principle as the PX4 runtime's
|
|
9
|
+
``location_to_pose`` and the marine runtime's ``location_to_waypoint``).
|
|
10
|
+
|
|
11
|
+
The adapter calls methods on the server's ObjectsNode by node id; the
|
|
12
|
+
objects node id and per-capability method node ids are all config.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
|
|
19
|
+
import yaml
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class MethodTarget(BaseModel):
|
|
24
|
+
"""A node-id of an AUTOSAR Adaptive method plus the literal args to call it with."""
|
|
25
|
+
|
|
26
|
+
model_config = ConfigDict(extra="forbid")
|
|
27
|
+
|
|
28
|
+
method: str = Field(..., description="NodeId of the method to call, e.g. 'sid=MoveTo'.")
|
|
29
|
+
args: list[str] = Field(default_factory=list, description="Literal string args passed to the method.")
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class AutosarConfig(BaseModel):
|
|
33
|
+
"""AUTOSAR Adaptive connection + node-mapping config."""
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(extra="forbid")
|
|
36
|
+
|
|
37
|
+
endpoint_url: str = Field(
|
|
38
|
+
default="someip://127.0.0.1:4840/urml/",
|
|
39
|
+
description="AUTOSAR Adaptive server endpoint. A local ara demo server uses someip://127.0.0.1:4840/.",
|
|
40
|
+
)
|
|
41
|
+
objects_node: str = Field(
|
|
42
|
+
default="i=85",
|
|
43
|
+
description="NodeId of the parent object the capability methods hang off (default: Objects).",
|
|
44
|
+
)
|
|
45
|
+
connect_timeout_seconds: float = 5.0
|
|
46
|
+
|
|
47
|
+
#: location name -> the MoveTo-style method + args that drives there.
|
|
48
|
+
location_to_method: dict[str, MethodTarget] = Field(default_factory=dict)
|
|
49
|
+
#: station-service name (e.g. swap_tool, park) -> its method + args.
|
|
50
|
+
service_to_method: dict[str, MethodTarget] = Field(default_factory=dict)
|
|
51
|
+
#: 'grasp' / 'release' -> their method nodes.
|
|
52
|
+
manipulation_methods: dict[str, MethodTarget] = Field(default_factory=dict)
|
|
53
|
+
#: a variable NodeId read by `measure` / polled by `wait_for`.
|
|
54
|
+
measurement_node: str | None = None
|
|
55
|
+
|
|
56
|
+
def resolve_location(self, name: str) -> MethodTarget | None:
|
|
57
|
+
return self.location_to_method.get(name)
|
|
58
|
+
|
|
59
|
+
def resolve_service(self, name: str) -> MethodTarget | None:
|
|
60
|
+
return self.service_to_method.get(name)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def load_autosar_config(path: str | Path) -> AutosarConfig:
|
|
64
|
+
"""Parse an ``autosar_adapter.yaml`` file into an ``AutosarConfig``."""
|
|
65
|
+
p = Path(path)
|
|
66
|
+
with p.open(encoding="utf-8") as fh:
|
|
67
|
+
data = yaml.safe_load(fh) or {}
|
|
68
|
+
if not isinstance(data, dict):
|
|
69
|
+
raise ValueError(f"autosar-config file {p} did not contain a YAML mapping at the top level.")
|
|
70
|
+
return AutosarConfig.model_validate(data)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""Live smoke for AutosarAdaptiveAdapter under a real ``ara`` install.
|
|
2
|
+
|
|
3
|
+
The AUTOSAR Adaptive analog of the PX4 runtime's
|
|
4
|
+
``tests/integration/test_px4_adapter_live.py``. The *light* gate: it
|
|
5
|
+
needs only the real ``ara`` wheel. It constructs ``AutosarAdaptiveAdapter``
|
|
6
|
+
(construction requires ara but does NOT connect — ``_connect`` is
|
|
7
|
+
lazy) and confirms the ``ConformanceRunner.adapter_factory`` hook
|
|
8
|
+
accepts it. A real-server end-to-end run against a local ara
|
|
9
|
+
demo server is the documented calibration step in
|
|
10
|
+
``autosar-integration.yml``.
|
|
11
|
+
|
|
12
|
+
## Gating
|
|
13
|
+
|
|
14
|
+
The default ``pytest`` invocation skips this module entirely. The
|
|
15
|
+
``autosar-smoke`` job in ``.github/workflows/autosar-integration.yml`` sets
|
|
16
|
+
``URML_AUTOSAR_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_AUTOSAR_INTEGRATION") != "1",
|
|
27
|
+
reason="Set URML_AUTOSAR_INTEGRATION=1 to run the AUTOSAR Adaptive live smoke (real ara, no server).",
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def test_real_ara_is_importable() -> None:
|
|
32
|
+
"""The real ara sync client is available under the smoke env."""
|
|
33
|
+
from ara.sync import Client # noqa: F401
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_adapter_constructs_against_real_ara() -> None:
|
|
37
|
+
"""AutosarAdaptiveAdapter constructs against real ara without connecting.
|
|
38
|
+
|
|
39
|
+
Construction calls ``_require_ara()`` (so it needs the real
|
|
40
|
+
wheel) but must NOT open a session — ``_connect`` is lazy and only
|
|
41
|
+
fires on the first Protocol call.
|
|
42
|
+
"""
|
|
43
|
+
from urml_autosar_runtime import AutosarAdaptiveAdapter
|
|
44
|
+
|
|
45
|
+
with AutosarAdaptiveAdapter() as adapter:
|
|
46
|
+
assert adapter._client is None # no Protocol method called -> no session
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def test_conformance_runner_accepts_real_adapter_factory() -> None:
|
|
50
|
+
"""The ConformanceRunner accepts a real AutosarAdaptiveAdapter factory.
|
|
51
|
+
|
|
52
|
+
Does NOT run the fixture suite (that needs a live AUTOSAR Adaptive server —
|
|
53
|
+
the documented calibration step). The hook itself is under test.
|
|
54
|
+
"""
|
|
55
|
+
from urml_conformance import ConformanceRunner
|
|
56
|
+
|
|
57
|
+
from urml_autosar_runtime import AutosarAdaptiveAdapter
|
|
58
|
+
|
|
59
|
+
runner = ConformanceRunner(adapter_factory=lambda: AutosarAdaptiveAdapter())
|
|
60
|
+
assert runner is not None
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"""Hermetic unit tests for AutosarAdaptiveAdapter — no ara install needed.
|
|
2
|
+
|
|
3
|
+
A fake ``ara.sync`` module is injected into ``sys.modules`` so
|
|
4
|
+
``_require_ara`` resolves and ``_connect`` runs against a
|
|
5
|
+
controllable double (the same technique px4/marine/mujoco 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 DetectionResult, ROSAdapter
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class _FakeAraInstance:
|
|
20
|
+
def __init__(self, store: dict[str, Any]) -> None:
|
|
21
|
+
self._store = store
|
|
22
|
+
|
|
23
|
+
def call_method(self, method: str, *args: Any) -> str:
|
|
24
|
+
self._store.setdefault("calls", []).append((method, args))
|
|
25
|
+
return "ok"
|
|
26
|
+
|
|
27
|
+
def read_value(self) -> float:
|
|
28
|
+
return 7.0
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class _FakeAraSession:
|
|
32
|
+
def __init__(self, url: str, timeout: float = 5.0) -> None:
|
|
33
|
+
self.url = url
|
|
34
|
+
self.connected = False
|
|
35
|
+
self.disconnected = False
|
|
36
|
+
self.store: dict[str, Any] = {}
|
|
37
|
+
|
|
38
|
+
def connect(self) -> None:
|
|
39
|
+
self.connected = True
|
|
40
|
+
|
|
41
|
+
def disconnect(self) -> None:
|
|
42
|
+
self.disconnected = True
|
|
43
|
+
|
|
44
|
+
def get_node(self, nodeid: str) -> _FakeAraInstance:
|
|
45
|
+
return _FakeAraInstance(self.store)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@pytest.fixture
|
|
49
|
+
def fake_ara() -> Iterator[type[_FakeAraSession]]:
|
|
50
|
+
sync_mod = ModuleType("ara.sync")
|
|
51
|
+
sync_mod.Client = _FakeAraSession # type: ignore[attr-defined]
|
|
52
|
+
pkg = ModuleType("ara")
|
|
53
|
+
pkg.sync = sync_mod # type: ignore[attr-defined]
|
|
54
|
+
saved = {k: sys.modules.get(k) for k in ("ara", "ara.sync")}
|
|
55
|
+
sys.modules["ara"] = pkg
|
|
56
|
+
sys.modules["ara.sync"] = sync_mod
|
|
57
|
+
try:
|
|
58
|
+
yield _FakeAraSession
|
|
59
|
+
finally:
|
|
60
|
+
for k, v in saved.items():
|
|
61
|
+
if v is None:
|
|
62
|
+
sys.modules.pop(k, None)
|
|
63
|
+
else:
|
|
64
|
+
sys.modules[k] = v
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def test_nav_dock_grasp_measure_lifecycle(fake_ara: type[_FakeAraSession]) -> None:
|
|
68
|
+
from urml_autosar_runtime import AutosarAdaptiveAdapter, AutosarConfig
|
|
69
|
+
from urml_autosar_runtime.adapter import MethodTarget
|
|
70
|
+
|
|
71
|
+
cfg = AutosarConfig(
|
|
72
|
+
location_to_method={"pick_bin": MethodTarget(method="sid=MoveTo", args=["pick_bin"])},
|
|
73
|
+
service_to_method={"swap_tool": MethodTarget(method="sid=SwapTool", args=["wide"])},
|
|
74
|
+
manipulation_methods={"grasp": MethodTarget(method="sid=Grip")},
|
|
75
|
+
measurement_node="sid=Force",
|
|
76
|
+
)
|
|
77
|
+
with AutosarAdaptiveAdapter(cfg) as cell:
|
|
78
|
+
assert isinstance(cell, ROSAdapter)
|
|
79
|
+
assert cell.send_navigation_goal(location="pick_bin").success
|
|
80
|
+
miss = cell.send_navigation_goal(location="nowhere")
|
|
81
|
+
assert miss.success is False and miss.reason is not None
|
|
82
|
+
assert miss.reason.startswith("location_not_configured")
|
|
83
|
+
# RFC-0013 swap_tool rides send_docking_goal — preserved.
|
|
84
|
+
assert cell.send_docking_goal(station="tool_change_station", service="swap_tool", until="wide").success
|
|
85
|
+
assert cell.send_manipulation_goal(action="grasp").success
|
|
86
|
+
meas = cell.take_measurement(what="force", target=None, sensor="tcp_force")
|
|
87
|
+
assert meas.success and meas.payload is not None and meas.payload["value"] == 7.0
|
|
88
|
+
assert cell.wait_passively(duration_seconds=0.1).success
|
|
89
|
+
scan = cell.run_scan(
|
|
90
|
+
area={}, pattern="grid", overlap=0.1, altitude=None, media="sensor_only", sensor=None
|
|
91
|
+
)
|
|
92
|
+
assert not scan.success and "area-scan controller" in (scan.reason or "")
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def test_unconfigured_and_unsupported_sentinels(fake_ara: type[_FakeAraSession]) -> None:
|
|
96
|
+
from urml_autosar_runtime import AutosarAdaptiveAdapter, AutosarConfig
|
|
97
|
+
|
|
98
|
+
cell = AutosarAdaptiveAdapter(AutosarConfig())
|
|
99
|
+
nores = cell.send_manipulation_goal(action="grasp")
|
|
100
|
+
assert nores.success is False
|
|
101
|
+
assert nores.reason is not None and nores.reason.startswith("manipulation_method_not_configured")
|
|
102
|
+
det: DetectionResult = cell.query_detection(object_class="widget")
|
|
103
|
+
assert det.success is False and det.reason is not None
|
|
104
|
+
assert det.reason.startswith("not_supported_on_autosar_ecu_cell")
|
|
105
|
+
for r in (cell.send_takeoff_goal(altitude=1.0), cell.send_land_goal(), cell.send_return_to_home_goal()):
|
|
106
|
+
assert r.success is False
|
|
107
|
+
assert r.reason is not None and r.reason.startswith("not_applicable_autosar")
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def test_missing_ara_is_actionable(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
111
|
+
"""Construction without the [autosar] extra raises a clear error.
|
|
112
|
+
|
|
113
|
+
Setting the sys.modules entries to None forces ``import ara.sync``
|
|
114
|
+
to raise ImportError deterministically, whether or not ara is
|
|
115
|
+
actually installed in the test environment.
|
|
116
|
+
"""
|
|
117
|
+
from urml_autosar_runtime import AutosarAdaptiveAdapter
|
|
118
|
+
|
|
119
|
+
monkeypatch.setitem(sys.modules, "ara", None)
|
|
120
|
+
monkeypatch.setitem(sys.modules, "ara.sync", None)
|
|
121
|
+
with pytest.raises(RuntimeError, match=r"\[autosar\] extra"):
|
|
122
|
+
AutosarAdaptiveAdapter()
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def test_conformance_runner_accepts_factory(fake_ara: type[_FakeAraSession]) -> None:
|
|
126
|
+
from urml_conformance import ConformanceRunner
|
|
127
|
+
|
|
128
|
+
from urml_autosar_runtime import AutosarAdaptiveAdapter
|
|
129
|
+
|
|
130
|
+
assert ConformanceRunner(adapter_factory=lambda: AutosarAdaptiveAdapter()) is not None
|