urml-industrial-arm-runtime 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,117 @@
1
+ # --- Python ---
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ dist/
9
+ develop-eggs/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+ MANIFEST
23
+
24
+ # Virtual envs
25
+ .venv/
26
+ venv/
27
+ env/
28
+ ENV/
29
+ .python-version
30
+
31
+ # Test / coverage / mypy / pyright
32
+ .coverage
33
+ .coverage.*
34
+ .cache
35
+ .pytest_cache/
36
+ .mypy_cache/
37
+ .dmypy.json
38
+ .pyre/
39
+ .pyright/
40
+ htmlcov/
41
+ nosetests.xml
42
+ coverage.xml
43
+ *.cover
44
+ .hypothesis/
45
+ .tox/
46
+
47
+ # --- Node / web tooling (kept out of core repo; here for safety) ---
48
+ node_modules/
49
+ .pnp.*
50
+ .yarn/cache/
51
+ .yarn/unplugged/
52
+ .yarn/build-state.yml
53
+ .yarn/install-state.gz
54
+ npm-debug.log*
55
+ yarn-debug.log*
56
+ yarn-error.log*
57
+
58
+ # --- C++ / Rust build artifacts (in case reference runtimes land here in early Phase 1) ---
59
+ target/
60
+ *.o
61
+ *.obj
62
+ *.a
63
+ *.lib
64
+ *.dll
65
+ *.dylib
66
+ *.exe
67
+ *.pdb
68
+ cmake-build-*/
69
+ CMakeCache.txt
70
+ CMakeFiles/
71
+ CMakeScripts/
72
+ Testing/
73
+ cmake_install.cmake
74
+ install_manifest.txt
75
+ compile_commands.json
76
+
77
+ # --- ROS 2 build dirs ---
78
+ build/
79
+ install/
80
+ log/
81
+
82
+ # --- Editor and OS junk ---
83
+ .vscode/
84
+ .idea/
85
+ *.swp
86
+ *.swo
87
+ *~
88
+ .DS_Store
89
+ Thumbs.db
90
+ desktop.ini
91
+
92
+ # --- Local-only artifacts ---
93
+ .env
94
+ .env.*
95
+ *.log
96
+ *.tmp
97
+ .local/
98
+ .scratch/
99
+
100
+ # --- Outreach campaign artifacts (operational, not part of the open standard) ---
101
+ # Target lists, message drafts, tracking data, and the launch-approval record
102
+ # stay local. They are private to the maintainer; committing them would
103
+ # telegraph the campaign before launch and could embarrass listed projects.
104
+ outreach/
105
+
106
+ # Outreach dashboard SQLite mirror (RFC-0275). Derived from
107
+ # examples/lighthouses/outreach*.yaml via tools/scripts/refresh_outreach_db.py.
108
+ # Regenerated on demand by `make outreach-refresh`.
109
+ tools/outreach.db
110
+ tools/.outreach.db
111
+
112
+ # Local Claude Code settings (per-machine; permission rules, etc.). Not committed.
113
+ .claude/settings.json
114
+ .claude/settings.local.json
115
+
116
+ # Claude Code session worktrees (`claude -w <name>`); see AGENTS.md "Parallel sessions".
117
+ .claude/worktrees/
@@ -0,0 +1,122 @@
1
+ Metadata-Version: 2.5
2
+ Name: urml-industrial-arm-runtime
3
+ Version: 0.5.0
4
+ Summary: ROS-Industrial / MoveIt 2 reference runtime for URML — ABB, FANUC, KUKA, YASKAWA arms.
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: abb,fanuc,industrial,kuka,moveit,robotics,ros-industrial,runtime,urml,yaskawa
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: Other/Proprietary License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Scientific/Engineering
19
+ Requires-Python: >=3.11
20
+ Requires-Dist: pydantic<3,>=2.6
21
+ Requires-Dist: pyyaml<7,>=6.0
22
+ Requires-Dist: urml-ros2-runtime>=0.5.0
23
+ Requires-Dist: urml-validator>=0.5.0
24
+ Provides-Extra: dev
25
+ Requires-Dist: mypy>=1.10; extra == 'dev'
26
+ Requires-Dist: pytest-cov>=5; extra == 'dev'
27
+ Requires-Dist: pytest>=8; extra == 'dev'
28
+ Requires-Dist: ruff>=0.5; extra == 'dev'
29
+ Description-Content-Type: text/markdown
30
+
31
+ <p align="center">
32
+ <a href="https://urml.dev"><img src="https://urml.dev/favicon.svg" alt="URML" width="72" height="72"></a>
33
+ </p>
34
+
35
+ <p align="center">
36
+ A small, opinionated, human-readable language for describing robot intent.
37
+ </p>
38
+
39
+ <p align="center">
40
+ <a href="https://urml.dev"><b>urml.dev</b></a>
41
+ </p>
42
+
43
+ ---
44
+
45
+ # urml-industrial-arm-runtime
46
+
47
+ **ROS-Industrial / MoveIt 2 reference runtime for URML** — one first-class adapter per arm vendor: **ABB, FANUC, KUKA, YASKAWA, Universal Robots, Franka Emika**.
48
+
49
+ An industrial manipulator is a fixed-base arm. Its load-bearing URML primitives are `grasp` / `release` (a gripper action) and `move_to` (an end-effector move via MoveIt 2). That dispatch shape is identical to the one the ROS 2 runtime's [`RclpyAdapter`](../ros2-runtime/) already implements, so the substrate plumbing is single-sourced: each brand adapter **composes** a `RclpyAdapter` rather than re-implementing MoveIt 2. The per-brand surface is still real and first-class — distinct classes, distinct default configs (each vendor's ROS-Industrial action-server conventions), distinct not-supported tag. "One adapter per brand", no duplicated substrate code.
50
+
51
+ ## Method coverage
52
+
53
+ Full `ROSAdapter` Protocol. Supported on a bare fixed-base arm, delegated to the composed adapter:
54
+
55
+ | URML primitive | Mapping |
56
+ |---|---|
57
+ | `grasp` / `release` | `control_msgs/GripperCommand` action |
58
+ | `move_to` / `hover` | MoveIt 2 move to a named pose (`/move_action`) |
59
+ | `measure` | single reading (joint state / wrench) |
60
+ | `wait_for` | block on a cell signal / threshold |
61
+ | `wait` | dwell in place for a duration |
62
+ | `report` | structured status upstream |
63
+
64
+ The primitives a bare arm cannot serve — `dock`, `detect`, `scan`, `capture`, `speak`, `listen`, and the drone trio `take_off` / `land` / `return_to_home` — return `SubstrateResult(success=False, reason="not_supported_on_industrial_arm[<brand>]: ...")` rather than raising. This is the same pattern `PX4Adapter` uses for `not_supported_on_bare_autopilot`. A work-cell that pairs an arm with a vision system dispatches detection through a companion adapter, exactly as the drone stack pairs flight with a ROS 2 companion; the URML program, manifest, and validator are unchanged and unaware.
65
+
66
+ ## rclpy is lazy
67
+
68
+ Importing this package works on every host (Windows included): the `rclpy` import lives inside `RclpyAdapter` and only fires when an adapter is **constructed**. Constructing a brand adapter therefore needs a sourced ROS 2 environment — the ROS-Industrial driver plus MoveIt 2 for that arm. There is no installable extra: `rclpy` ships with a ROS 2 distribution, not from PyPI (same as `urml-ros2-runtime`).
69
+
70
+ ## Install
71
+
72
+ ```bash
73
+ pip install -e reference/industrial-arm-runtime
74
+ ```
75
+
76
+ ## Use
77
+
78
+ ```python
79
+ from urml_industrial_arm_runtime import AbbAdapter
80
+
81
+ # Brand default config (ROS-Industrial conventions); override with an
82
+ # AdapterConfig for a specific cell's action servers.
83
+ with AbbAdapter() as adapter:
84
+ result = adapter.send_manipulation_goal(action="grasp", force_n=15.0)
85
+ assert result.success
86
+ ```
87
+
88
+ Through the conformance suite (the same hook every URML runtime uses):
89
+
90
+ ```python
91
+ from urml_conformance import ConformanceRunner
92
+ from urml_industrial_arm_runtime import BRAND_ADAPTERS
93
+
94
+ runner = ConformanceRunner(adapter_factory=lambda: BRAND_ADAPTERS["abb"]())
95
+ report = runner.run()
96
+ ```
97
+
98
+ ## Status
99
+
100
+ **v0.1 (this release):**
101
+ - Six first-class brand adapters (`AbbAdapter`, `FanucAdapter`, `KukaAdapter`, `YaskawaAdapter`, `UrAdapter`, `FrankaAdapter`) over a shared `IndustrialArmAdapter` core that composes `RclpyAdapter`. UR (Denmark/Teradyne) is the dominant cobot; Franka (Germany) is the dominant research arm and the educational-community flywheel — both pass the default US-federal policy.
102
+ - `BRAND_ADAPTERS` name→class registry for config-driven selection (CI matrices, the conformance `adapter_factory`).
103
+ - Hermetic unit tests: every brand, every delegated primitive, every not-supported sentinel, the conformance hook, `runtime_checkable` Protocol conformance, and context-manager teardown — no ROS 2 install required.
104
+ - Gated `.github/workflows/industrial-arm-integration.yml` (matrixed abb/fanuc/kuka/yaskawa) running the existing `conformance/fixtures/industrial/pick_red_positive` fixture through each brand adapter against a ROS 2 + MoveIt 2 sim, plus a gated `tests/integration/` scaffold. Modelled on `ros2-integration.yml`; first runs per brand are calibration runs by design, not regression signals.
105
+
106
+ **Why a vision companion.** `GraspArgs.target` is a required `VarRef` — URML `grasp` always acts on a *detected* target, so any pick-place program contains a `detect` step. A bare fixed-base arm has no onboard perception (returns `not_supported_on_industrial_arm`), exactly as a bare PX4 autopilot has none. The gated test pairs the brand arm with a vision companion via the already-tested generic `urml_px4_runtime.CompositeAdapter` (arm owns motion/manipulation/report; companion owns detection) — no industrial-specific composite code is duplicated. This mirrors the drone stack's flight+companion split.
107
+
108
+ **Follow-ups (not yet):**
109
+ - Per-brand US-compliant provenance manifests (ABB Sweden, FANUC/YASKAWA Japan, KUKA Germany). v0.1 reuses the existing compliant `industrial_cell` manifest; the profile README already documents that ABB/FANUC/KUKA controllers pass the default US-federal policy.
110
+ - A detection source wired into the sim so the gated `detect` step resolves against the real `RclpyAdapter` companion (part of the documented first-run calibration).
111
+
112
+ ## Core Commitment
113
+
114
+ This runtime is licensed under the Business Source License 1.1: free for non-production use, commercial license for production (see [`LICENSING.md`](../../LICENSING.md)). No vendor coupling, no cloud dependency.
115
+
116
+ ## Related documents
117
+
118
+ - [`/spec/profiles/industrial/`](../../spec/profiles/industrial/) — the profile this runtime targets.
119
+ - [`/spec/layer-1-hal/`](../../spec/layer-1-hal/) — manifest schema (manipulation fields).
120
+ - [`/conformance/`](../../conformance/) — the test suite that decides conformance.
121
+ - [`/reference/ros2-runtime/`](../ros2-runtime/) — the composed substrate engine (`RclpyAdapter`).
122
+ - [`/reference/px4-runtime/`](../px4-runtime/) — the sibling runtime this package's structure mirrors.
@@ -0,0 +1,92 @@
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-industrial-arm-runtime
16
+
17
+ **ROS-Industrial / MoveIt 2 reference runtime for URML** — one first-class adapter per arm vendor: **ABB, FANUC, KUKA, YASKAWA, Universal Robots, Franka Emika**.
18
+
19
+ An industrial manipulator is a fixed-base arm. Its load-bearing URML primitives are `grasp` / `release` (a gripper action) and `move_to` (an end-effector move via MoveIt 2). That dispatch shape is identical to the one the ROS 2 runtime's [`RclpyAdapter`](../ros2-runtime/) already implements, so the substrate plumbing is single-sourced: each brand adapter **composes** a `RclpyAdapter` rather than re-implementing MoveIt 2. The per-brand surface is still real and first-class — distinct classes, distinct default configs (each vendor's ROS-Industrial action-server conventions), distinct not-supported tag. "One adapter per brand", no duplicated substrate code.
20
+
21
+ ## Method coverage
22
+
23
+ Full `ROSAdapter` Protocol. Supported on a bare fixed-base arm, delegated to the composed adapter:
24
+
25
+ | URML primitive | Mapping |
26
+ |---|---|
27
+ | `grasp` / `release` | `control_msgs/GripperCommand` action |
28
+ | `move_to` / `hover` | MoveIt 2 move to a named pose (`/move_action`) |
29
+ | `measure` | single reading (joint state / wrench) |
30
+ | `wait_for` | block on a cell signal / threshold |
31
+ | `wait` | dwell in place for a duration |
32
+ | `report` | structured status upstream |
33
+
34
+ The primitives a bare arm cannot serve — `dock`, `detect`, `scan`, `capture`, `speak`, `listen`, and the drone trio `take_off` / `land` / `return_to_home` — return `SubstrateResult(success=False, reason="not_supported_on_industrial_arm[<brand>]: ...")` rather than raising. This is the same pattern `PX4Adapter` uses for `not_supported_on_bare_autopilot`. A work-cell that pairs an arm with a vision system dispatches detection through a companion adapter, exactly as the drone stack pairs flight with a ROS 2 companion; the URML program, manifest, and validator are unchanged and unaware.
35
+
36
+ ## rclpy is lazy
37
+
38
+ Importing this package works on every host (Windows included): the `rclpy` import lives inside `RclpyAdapter` and only fires when an adapter is **constructed**. Constructing a brand adapter therefore needs a sourced ROS 2 environment — the ROS-Industrial driver plus MoveIt 2 for that arm. There is no installable extra: `rclpy` ships with a ROS 2 distribution, not from PyPI (same as `urml-ros2-runtime`).
39
+
40
+ ## Install
41
+
42
+ ```bash
43
+ pip install -e reference/industrial-arm-runtime
44
+ ```
45
+
46
+ ## Use
47
+
48
+ ```python
49
+ from urml_industrial_arm_runtime import AbbAdapter
50
+
51
+ # Brand default config (ROS-Industrial conventions); override with an
52
+ # AdapterConfig for a specific cell's action servers.
53
+ with AbbAdapter() as adapter:
54
+ result = adapter.send_manipulation_goal(action="grasp", force_n=15.0)
55
+ assert result.success
56
+ ```
57
+
58
+ Through the conformance suite (the same hook every URML runtime uses):
59
+
60
+ ```python
61
+ from urml_conformance import ConformanceRunner
62
+ from urml_industrial_arm_runtime import BRAND_ADAPTERS
63
+
64
+ runner = ConformanceRunner(adapter_factory=lambda: BRAND_ADAPTERS["abb"]())
65
+ report = runner.run()
66
+ ```
67
+
68
+ ## Status
69
+
70
+ **v0.1 (this release):**
71
+ - Six first-class brand adapters (`AbbAdapter`, `FanucAdapter`, `KukaAdapter`, `YaskawaAdapter`, `UrAdapter`, `FrankaAdapter`) over a shared `IndustrialArmAdapter` core that composes `RclpyAdapter`. UR (Denmark/Teradyne) is the dominant cobot; Franka (Germany) is the dominant research arm and the educational-community flywheel — both pass the default US-federal policy.
72
+ - `BRAND_ADAPTERS` name→class registry for config-driven selection (CI matrices, the conformance `adapter_factory`).
73
+ - Hermetic unit tests: every brand, every delegated primitive, every not-supported sentinel, the conformance hook, `runtime_checkable` Protocol conformance, and context-manager teardown — no ROS 2 install required.
74
+ - Gated `.github/workflows/industrial-arm-integration.yml` (matrixed abb/fanuc/kuka/yaskawa) running the existing `conformance/fixtures/industrial/pick_red_positive` fixture through each brand adapter against a ROS 2 + MoveIt 2 sim, plus a gated `tests/integration/` scaffold. Modelled on `ros2-integration.yml`; first runs per brand are calibration runs by design, not regression signals.
75
+
76
+ **Why a vision companion.** `GraspArgs.target` is a required `VarRef` — URML `grasp` always acts on a *detected* target, so any pick-place program contains a `detect` step. A bare fixed-base arm has no onboard perception (returns `not_supported_on_industrial_arm`), exactly as a bare PX4 autopilot has none. The gated test pairs the brand arm with a vision companion via the already-tested generic `urml_px4_runtime.CompositeAdapter` (arm owns motion/manipulation/report; companion owns detection) — no industrial-specific composite code is duplicated. This mirrors the drone stack's flight+companion split.
77
+
78
+ **Follow-ups (not yet):**
79
+ - Per-brand US-compliant provenance manifests (ABB Sweden, FANUC/YASKAWA Japan, KUKA Germany). v0.1 reuses the existing compliant `industrial_cell` manifest; the profile README already documents that ABB/FANUC/KUKA controllers pass the default US-federal policy.
80
+ - A detection source wired into the sim so the gated `detect` step resolves against the real `RclpyAdapter` companion (part of the documented first-run calibration).
81
+
82
+ ## Core Commitment
83
+
84
+ This runtime is licensed under the Business Source License 1.1: free for non-production use, commercial license for production (see [`LICENSING.md`](../../LICENSING.md)). No vendor coupling, no cloud dependency.
85
+
86
+ ## Related documents
87
+
88
+ - [`/spec/profiles/industrial/`](../../spec/profiles/industrial/) — the profile this runtime targets.
89
+ - [`/spec/layer-1-hal/`](../../spec/layer-1-hal/) — manifest schema (manipulation fields).
90
+ - [`/conformance/`](../../conformance/) — the test suite that decides conformance.
91
+ - [`/reference/ros2-runtime/`](../ros2-runtime/) — the composed substrate engine (`RclpyAdapter`).
92
+ - [`/reference/px4-runtime/`](../px4-runtime/) — the sibling runtime this package's structure mirrors.
@@ -0,0 +1,74 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.27"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "urml-industrial-arm-runtime"
7
+ version = "0.5.0"
8
+ description = "ROS-Industrial / MoveIt 2 reference runtime for URML — ABB, FANUC, KUKA, YASKAWA arms."
9
+ readme = "README.md"
10
+ license = { text = "BUSL-1.1" }
11
+ requires-python = ">=3.11"
12
+ authors = [{ name = "URML Maintainers" }]
13
+ keywords = ["robotics", "industrial", "moveit", "ros-industrial", "abb", "fanuc", "kuka", "yaskawa", "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
+ # rclpy is NOT a PyPI package — it ships with a ROS 2 distribution, same
33
+ # as urml-ros2-runtime. There is therefore no installable extra: a
34
+ # constructed adapter needs a sourced ROS 2 environment (ROS-Industrial
35
+ # driver + MoveIt 2) just like RclpyAdapter. Module import works on every
36
+ # host (rclpy is imported lazily, inside RclpyAdapter).
37
+ dev = [
38
+ "pytest>=8",
39
+ "pytest-cov>=5",
40
+ "ruff>=0.5",
41
+ "mypy>=1.10",
42
+ ]
43
+
44
+ [project.urls]
45
+ Homepage = "https://github.com/urml-dev/URML"
46
+ Repository = "https://github.com/urml-dev/URML"
47
+ Issues = "https://github.com/urml-dev/URML/issues"
48
+
49
+ [tool.hatch.build.targets.wheel]
50
+ packages = ["src/urml_industrial_arm_runtime"]
51
+
52
+ [tool.ruff]
53
+ line-length = 120
54
+ target-version = "py311"
55
+ src = ["src", "tests"]
56
+
57
+ [tool.ruff.lint]
58
+ select = ["E", "F", "W", "I", "B", "UP", "N", "ANN", "RUF"]
59
+ ignore = ["ANN401"]
60
+
61
+ [tool.ruff.lint.per-file-ignores]
62
+ "tests/*" = ["ANN"]
63
+
64
+ [tool.mypy]
65
+ strict = true
66
+ python_version = "3.11"
67
+ plugins = ["pydantic.mypy"]
68
+ mypy_path = "src"
69
+ packages = ["urml_industrial_arm_runtime"]
70
+
71
+ [tool.pytest.ini_options]
72
+ minversion = "8.0"
73
+ testpaths = ["tests"]
74
+ addopts = ["-q", "--strict-markers"]
@@ -0,0 +1,84 @@
1
+ """urml_industrial_arm_runtime — ROS-Industrial / MoveIt 2 reference runtime.
2
+
3
+ One first-class adapter per vendor, all implementing the substrate-neutral
4
+ ``ROSAdapter`` Protocol:
5
+
6
+ AbbAdapter, FanucAdapter, KukaAdapter, YaskawaAdapter
7
+ Brand arm adapters. Each composes the ROS 2 runtime's RclpyAdapter
8
+ (the MoveIt 2 / control_msgs shape an industrial arm needs is already
9
+ implemented there) with a brand-default deployment config. rclpy is
10
+ imported lazily inside RclpyAdapter, so this module loads on every
11
+ host; constructing an adapter needs a sourced ROS 2 environment.
12
+
13
+ IndustrialArmAdapter
14
+ The shared core the brand classes subclass. Use a brand class
15
+ directly; this is exposed for typing and custom-vendor extension.
16
+
17
+ BRAND_ADAPTERS
18
+ Name → class registry ({"abb": AbbAdapter, ...}) for config-driven
19
+ selection (CI matrices, the conformance suite's adapter_factory).
20
+ """
21
+
22
+ from __future__ import annotations
23
+
24
+ from urml_industrial_arm_runtime._version import __version__
25
+ from urml_industrial_arm_runtime.adapter import (
26
+ AbbAdapter,
27
+ ComauAdapter,
28
+ DensoAdapter,
29
+ EpsonAdapter,
30
+ FanucAdapter,
31
+ FrankaAdapter,
32
+ HanwhaAdapter,
33
+ HyundaiAdapter,
34
+ IndustrialArmAdapter,
35
+ KawasakiAdapter,
36
+ KukaAdapter,
37
+ MitsubishiAdapter,
38
+ NachiAdapter,
39
+ OmronAdapter,
40
+ StaubliAdapter,
41
+ UrAdapter,
42
+ YaskawaAdapter,
43
+ )
44
+
45
+ BRAND_ADAPTERS: dict[str, type[IndustrialArmAdapter]] = {
46
+ "abb": AbbAdapter,
47
+ "fanuc": FanucAdapter,
48
+ "kuka": KukaAdapter,
49
+ "yaskawa": YaskawaAdapter,
50
+ "ur": UrAdapter,
51
+ "franka": FrankaAdapter,
52
+ "kawasaki": KawasakiAdapter,
53
+ "staubli": StaubliAdapter,
54
+ "comau": ComauAdapter,
55
+ "mitsubishi": MitsubishiAdapter,
56
+ "denso": DensoAdapter,
57
+ "hyundai": HyundaiAdapter,
58
+ "nachi": NachiAdapter,
59
+ "epson": EpsonAdapter,
60
+ "omron": OmronAdapter,
61
+ "hanwha": HanwhaAdapter,
62
+ }
63
+
64
+ __all__ = [
65
+ "BRAND_ADAPTERS",
66
+ "AbbAdapter",
67
+ "ComauAdapter",
68
+ "DensoAdapter",
69
+ "EpsonAdapter",
70
+ "FanucAdapter",
71
+ "FrankaAdapter",
72
+ "HanwhaAdapter",
73
+ "HyundaiAdapter",
74
+ "IndustrialArmAdapter",
75
+ "KawasakiAdapter",
76
+ "KukaAdapter",
77
+ "MitsubishiAdapter",
78
+ "NachiAdapter",
79
+ "OmronAdapter",
80
+ "StaubliAdapter",
81
+ "UrAdapter",
82
+ "YaskawaAdapter",
83
+ "__version__",
84
+ ]
@@ -0,0 +1,3 @@
1
+ """Package version. Bumped per release."""
2
+
3
+ __version__ = "0.5.0"
@@ -0,0 +1,534 @@
1
+ """ROS-Industrial / MoveIt 2 arm adapters — one first-class class per vendor.
2
+
3
+ An industrial manipulator is a fixed-base arm. Its load-bearing URML
4
+ primitives are ``grasp`` / ``release`` (a gripper action) and ``move_to``
5
+ (an end-effector / named-pose move via MoveIt 2). That dispatch shape is
6
+ *identical* to the one the ROS 2 runtime's :class:`RclpyAdapter` already
7
+ implements (``control_msgs/GripperCommand`` for the gripper,
8
+ ``nav2_msgs/NavigateToPose``-style action send-and-wait for moves). So the
9
+ substrate plumbing is single-sourced: each brand adapter **composes** a
10
+ :class:`RclpyAdapter` rather than re-implementing MoveIt 2.
11
+
12
+ The per-brand surface is still real and first-class: :class:`AbbAdapter`,
13
+ :class:`FanucAdapter`, :class:`KukaAdapter`, :class:`YaskawaAdapter` are
14
+ distinct classes with distinct default configs (the vendor's
15
+ ROS-Industrial action-server conventions) and a brand-scoped
16
+ not-supported tag. "One adapter per brand", no duplicated substrate code.
17
+
18
+ A bare arm has no mobile base, no flight, and no onboard
19
+ perception/speech. Those primitives return a documented
20
+ ``not_supported_on_industrial_arm[<brand>]`` result rather than raising —
21
+ the same pattern :class:`PX4Adapter` uses for
22
+ ``not_supported_on_bare_autopilot``. A work-cell that pairs an arm with a
23
+ vision system dispatches detection through a companion adapter, exactly
24
+ as the drone stack pairs flight with a ROS 2 companion. The URML program,
25
+ manifest, and validator are unchanged and unaware.
26
+
27
+ ## rclpy is lazy
28
+
29
+ Importing this module works on every host (Windows included): the
30
+ ``rclpy`` import lives inside :class:`RclpyAdapter` and only fires when an
31
+ adapter is *constructed*. Constructing a brand adapter therefore needs a
32
+ sourced ROS 2 environment (the ROS-Industrial driver + MoveIt 2 for that
33
+ arm), just like :class:`RclpyAdapter`. Hermetic tests inject a fake inner
34
+ adapter via the ``inner_factory`` hook and never touch rclpy.
35
+ """
36
+
37
+ from __future__ import annotations
38
+
39
+ from collections.abc import Callable
40
+ from contextlib import suppress
41
+ from typing import Any, Literal
42
+
43
+ from urml_ros2_runtime.substrate.adapter_config import ActionServerConfig, AdapterConfig
44
+ from urml_ros2_runtime.substrate.base import (
45
+ CaptureResult,
46
+ DetectionResult,
47
+ ListenResult,
48
+ ManipulationResult,
49
+ MeasurementResult,
50
+ NavigationResult,
51
+ ProgramCallResult,
52
+ ROSAdapter,
53
+ ScanResult,
54
+ SubstrateResult,
55
+ WaitResult,
56
+ )
57
+ from urml_ros2_runtime.substrate.rclpy_adapter import RclpyAdapter
58
+
59
+ from urml_industrial_arm_runtime._version import __version__
60
+
61
+ __all__ = [
62
+ "AbbAdapter",
63
+ "ComauAdapter",
64
+ "DensoAdapter",
65
+ "EpsonAdapter",
66
+ "FanucAdapter",
67
+ "FrankaAdapter",
68
+ "HanwhaAdapter",
69
+ "HyundaiAdapter",
70
+ "IndustrialArmAdapter",
71
+ "KawasakiAdapter",
72
+ "KukaAdapter",
73
+ "MitsubishiAdapter",
74
+ "NachiAdapter",
75
+ "OmronAdapter",
76
+ "StaubliAdapter",
77
+ "UrAdapter",
78
+ "YaskawaAdapter",
79
+ "__version__",
80
+ ]
81
+
82
+ # The not-supported sentinel for every primitive a bare fixed-base arm
83
+ # cannot serve. Extracted so tests can match exactly, mirroring
84
+ # PX4Adapter._NOT_SUPPORTED_REASON.
85
+ _NOT_SUPPORTED_TEMPLATE = (
86
+ "not_supported_on_industrial_arm[{brand}]: a fixed-base manipulator has no "
87
+ "{capability}. Pair the arm with a companion adapter (vision / mobile base) "
88
+ "for full coverage; the URML program, manifest, and validator are unchanged."
89
+ )
90
+
91
+ # v0.1 ROS-Industrial action-server conventions per vendor. These are the
92
+ # vanilla-install defaults a deployer typically keeps; sites that
93
+ # namespace their cells override them in an adapter.yaml, exactly as
94
+ # RclpyAdapter documents for its own AdapterConfig.
95
+ _BRAND_GRIPPER_SERVER = {
96
+ "abb": "/abb/gripper/gripper_cmd",
97
+ "fanuc": "/fanuc/gripper/gripper_cmd",
98
+ "kuka": "/kuka/gripper/gripper_cmd",
99
+ "yaskawa": "/motoman/gripper/gripper_cmd", # YASKAWA's ROS-Industrial driver is `motoman`.
100
+ "ur": "/ur/robotiq_gripper/gripper_cmd", # UR cobots most commonly carry a Robotiq gripper.
101
+ "franka": "/franka/franka_gripper/gripper_cmd", # Franka's ROS package is `franka_gripper`.
102
+ "kawasaki": "/kawasaki/gripper/gripper_cmd", # Kawasaki's ROS package is `kawasaki_robot`.
103
+ "staubli": "/staubli/gripper/gripper_cmd", # Stäubli VAL3 driver — `staubli_val3_driver`.
104
+ "comau": "/comau/gripper/gripper_cmd", # Comau ROS 2 driver — `comau_ros2_driver`.
105
+ "mitsubishi": "/melfa/gripper/gripper_cmd", # Mitsubishi Electric MELFA — `melfa_ros2`.
106
+ "denso": "/denso/gripper/gripper_cmd", # Denso — `denso_robot_ros2`.
107
+ "hyundai": "/hyundai/gripper/gripper_cmd", # Hyundai Robotics — `hyundai_robot_ros2`.
108
+ "nachi": "/nachi/gripper/gripper_cmd", # Nachi-Fujikoshi — `nachi_robot_ros2`.
109
+ "epson": "/epson/gripper/gripper_cmd", # Seiko Epson — `epson_robot_ros2`.
110
+ "omron": "/omron/gripper/gripper_cmd", # Omron (Adept legacy) — `omron_industrial_robot`.
111
+ "hanwha": "/hanwha/gripper/gripper_cmd", # Hanwha HCR cobot via ROS — `hanwha_hcr_ros2`.
112
+ }
113
+
114
+ InnerFactory = Callable[[], ROSAdapter]
115
+
116
+
117
+ class IndustrialArmAdapter:
118
+ """Shared core: a brand arm adapter over a composed RclpyAdapter.
119
+
120
+ Subclasses set :pyattr:`BRAND` and may override :pymeth:`default_config`.
121
+ Construct with no arguments to use the brand default config, or pass an
122
+ :class:`AdapterConfig` to point at a specific cell's action servers.
123
+ """
124
+
125
+ #: Vendor tag — overridden by each brand subclass. Surfaces in the
126
+ #: not-supported reason and the default node name.
127
+ BRAND: str = "generic"
128
+
129
+ def __init__(
130
+ self,
131
+ config: AdapterConfig | None = None,
132
+ *,
133
+ node_name: str | None = None,
134
+ inner_factory: InnerFactory | None = None,
135
+ ) -> None:
136
+ self._config = config or self.default_config()
137
+ node = node_name or f"urml_{self.BRAND}_arm"
138
+ factory: InnerFactory = inner_factory or (lambda: RclpyAdapter(self._config, node_name=node))
139
+ self._inner: ROSAdapter = factory()
140
+ self._closed = False
141
+
142
+ @classmethod
143
+ def default_config(cls) -> AdapterConfig:
144
+ """Brand-default deployment config (ROS-Industrial conventions).
145
+
146
+ ``move_group`` is MoveIt 2's vanilla ``/move_action``. The gripper
147
+ action server follows the vendor's ROS-Industrial driver naming.
148
+ A real cell overrides these in an adapter.yaml.
149
+ """
150
+ gripper_server = _BRAND_GRIPPER_SERVER.get(cls.BRAND, "/gripper/gripper_cmd")
151
+ return AdapterConfig(
152
+ action_servers=ActionServerConfig(
153
+ move_group="/move_action",
154
+ gripper={f"{cls.BRAND}_gripper": gripper_server},
155
+ ),
156
+ )
157
+
158
+ # ------------------------------------------------------------------
159
+ # Lifecycle
160
+ # ------------------------------------------------------------------
161
+
162
+ def close(self) -> None:
163
+ """Tear down the composed adapter. Safe to call multiple times."""
164
+ if self._closed:
165
+ return
166
+ inner_close = getattr(self._inner, "close", None)
167
+ if callable(inner_close):
168
+ with suppress(Exception):
169
+ inner_close()
170
+ self._closed = True
171
+
172
+ def __enter__(self) -> IndustrialArmAdapter:
173
+ return self
174
+
175
+ def __exit__(self, *_: object) -> None:
176
+ self.close()
177
+
178
+ # ------------------------------------------------------------------
179
+ # Supported on a fixed-base arm — delegate to the composed adapter
180
+ # ------------------------------------------------------------------
181
+
182
+ def send_navigation_goal(
183
+ self,
184
+ *,
185
+ location: str | None = None,
186
+ pose: dict[str, float] | None = None,
187
+ frame: str | None = None,
188
+ carrying: dict[str, Any] | None = None,
189
+ speed: float | None = None,
190
+ ) -> NavigationResult:
191
+ """``move_to`` / ``hover``: a MoveIt 2 move to a named pose."""
192
+ return self._inner.send_navigation_goal(
193
+ location=location, pose=pose, frame=frame, carrying=carrying, speed=speed
194
+ )
195
+
196
+ def send_manipulation_goal(
197
+ self,
198
+ *,
199
+ action: Literal["grasp", "release"],
200
+ target: dict[str, Any] | None = None,
201
+ force_n: float | None = None,
202
+ approach: Literal["top", "side", "front", "auto"] = "auto",
203
+ release_mode: Literal["drop", "place", "hand_to_user"] | None = None,
204
+ release_at: dict[str, Any] | str | None = None,
205
+ arm: str | None = None,
206
+ grasp_type: str | None = None,
207
+ target_motion: str | None = None,
208
+ ) -> ManipulationResult:
209
+ """``grasp`` / ``release``: a ``control_msgs/GripperCommand`` action."""
210
+ return self._inner.send_manipulation_goal(
211
+ action=action,
212
+ target=target,
213
+ force_n=force_n,
214
+ approach=approach,
215
+ release_mode=release_mode,
216
+ release_at=release_at,
217
+ arm=arm,
218
+ grasp_type=grasp_type,
219
+ target_motion=target_motion,
220
+ )
221
+
222
+ def take_measurement(
223
+ self,
224
+ *,
225
+ what: str,
226
+ target: str | None,
227
+ sensor: str | None,
228
+ ) -> MeasurementResult:
229
+ """``measure``: a single reading (e.g. joint state / wrench)."""
230
+ return self._inner.take_measurement(what=what, target=target, sensor=sensor)
231
+
232
+ def wait_for_condition(
233
+ self,
234
+ *,
235
+ kind: Literal["event", "signal", "input", "sensor_threshold"],
236
+ name: str | None,
237
+ input_mode: str | None,
238
+ threshold: dict[str, Any] | None,
239
+ timeout_seconds: float | None,
240
+ ) -> WaitResult:
241
+ """``wait_for``: block on a cell signal / threshold."""
242
+ return self._inner.wait_for_condition(
243
+ kind=kind,
244
+ name=name,
245
+ input_mode=input_mode,
246
+ threshold=threshold,
247
+ timeout_seconds=timeout_seconds,
248
+ )
249
+
250
+ def wait_passively(self, *, duration_seconds: float) -> SubstrateResult:
251
+ """``wait``: dwell in place for a duration."""
252
+ return self._inner.wait_passively(duration_seconds=duration_seconds)
253
+
254
+ def emit_report(
255
+ self,
256
+ *,
257
+ to: str,
258
+ facts: dict[str, Any],
259
+ attachments: list[str] | None,
260
+ status: Literal["success", "partial", "failure"],
261
+ severity: Literal["info", "notice", "warning", "error"],
262
+ ) -> SubstrateResult:
263
+ """``report``: structured status upstream."""
264
+ return self._inner.emit_report(
265
+ to=to, facts=facts, attachments=attachments, status=status, severity=severity
266
+ )
267
+
268
+ def call_named_program(
269
+ self,
270
+ *,
271
+ name: str,
272
+ args: dict[str, Any] | None = None,
273
+ ) -> ProgramCallResult:
274
+ """``call_program``: invoke a controller-resident program by name.
275
+
276
+ For an industrial arm this is the on-controller job mechanism — a
277
+ Kawasaki AS-language program, a FANUC TP program, a KUKA KRL routine.
278
+ Delegated to the composed adapter; a real cell overrides
279
+ :pymeth:`RclpyAdapter.call_named_program` with its driver's
280
+ program-launch service (RFC-0015).
281
+ """
282
+ return self._inner.call_named_program(name=name, args=args)
283
+
284
+ # ------------------------------------------------------------------
285
+ # Not supported on a bare fixed-base arm
286
+ # ------------------------------------------------------------------
287
+
288
+ def _reason(self, capability: str) -> str:
289
+ return _NOT_SUPPORTED_TEMPLATE.format(brand=self.BRAND, capability=capability)
290
+
291
+ def send_docking_goal(
292
+ self,
293
+ *,
294
+ station: str,
295
+ service: str,
296
+ until: str | None = None,
297
+ ) -> NavigationResult:
298
+ return NavigationResult(success=False, reason=self._reason("docking station (it is fixed-base)"))
299
+
300
+ def query_detection(
301
+ self,
302
+ *,
303
+ object_class: str,
304
+ attributes: dict[str, Any] | None = None,
305
+ where_near: str | None = None,
306
+ where_within: float | None = None,
307
+ ) -> DetectionResult:
308
+ return DetectionResult(success=False, reason=self._reason("onboard perception"))
309
+
310
+ def run_scan(
311
+ self,
312
+ *,
313
+ area: dict[str, Any],
314
+ pattern: Literal["serpentine", "spiral", "grid", "adaptive"],
315
+ overlap: float,
316
+ altitude: float | None,
317
+ media: Literal["photo", "video", "sensor_only"],
318
+ sensor: str | None,
319
+ ) -> ScanResult:
320
+ return ScanResult(success=False, reason=self._reason("area-scan capability"))
321
+
322
+ def capture_media(
323
+ self,
324
+ *,
325
+ media: Literal["photo", "video"],
326
+ target: str | None,
327
+ duration_seconds: float | None,
328
+ attributes: dict[str, Any] | None,
329
+ camera: str | None = None,
330
+ ) -> CaptureResult:
331
+ return CaptureResult(success=False, reason=self._reason("onboard camera"))
332
+
333
+ def emit_speech(
334
+ self,
335
+ *,
336
+ utterance: str,
337
+ locale: str | None,
338
+ style: Literal["notice", "warning", "conversational"],
339
+ interrupt: bool,
340
+ ) -> SubstrateResult:
341
+ return SubstrateResult(success=False, reason=self._reason("speaker"))
342
+
343
+ def acquire_speech(
344
+ self,
345
+ *,
346
+ prompt: str | None,
347
+ locale: str | None,
348
+ timeout_seconds: float | None,
349
+ expected: Literal["free_form", "confirmation", "choice"],
350
+ choices: list[str] | None,
351
+ ) -> ListenResult:
352
+ return ListenResult(success=False, reason=self._reason("microphone"))
353
+
354
+ def send_takeoff_goal(
355
+ self,
356
+ *,
357
+ altitude: float,
358
+ climb_rate: float | None = None,
359
+ ) -> NavigationResult:
360
+ return NavigationResult(success=False, reason=self._reason("flight capability"))
361
+
362
+ def send_land_goal(
363
+ self,
364
+ *,
365
+ at: str | None = None,
366
+ precision: Literal["standard", "precise"] = "standard",
367
+ ) -> NavigationResult:
368
+ return NavigationResult(success=False, reason=self._reason("flight capability"))
369
+
370
+ def send_return_to_home_goal(
371
+ self,
372
+ *,
373
+ speed: float | None = None,
374
+ altitude: float | None = None,
375
+ ) -> NavigationResult:
376
+ return NavigationResult(success=False, reason=self._reason("flight capability"))
377
+
378
+
379
+ class AbbAdapter(IndustrialArmAdapter):
380
+ """ABB arm via the ``abb_ros2`` ROS-Industrial driver + MoveIt 2."""
381
+
382
+ BRAND = "abb"
383
+
384
+
385
+ class FanucAdapter(IndustrialArmAdapter):
386
+ """FANUC arm via the ROS-Industrial FANUC driver + MoveIt 2."""
387
+
388
+ BRAND = "fanuc"
389
+
390
+
391
+ class KukaAdapter(IndustrialArmAdapter):
392
+ """KUKA arm via the KUKA ROS 2 driver (EKI/RSI ros2_control) + MoveIt 2."""
393
+
394
+ BRAND = "kuka"
395
+
396
+
397
+ class YaskawaAdapter(IndustrialArmAdapter):
398
+ """YASKAWA (Motoman) arm via the ``motoman`` ROS-Industrial driver + MoveIt 2."""
399
+
400
+ BRAND = "yaskawa"
401
+
402
+
403
+ class UrAdapter(IndustrialArmAdapter):
404
+ """Universal Robots cobot via the ``ur_robot_driver`` (ROS 2) + MoveIt 2.
405
+
406
+ UR is the dominant collaborative arm; it uses the same MoveIt 2 /
407
+ ``control_msgs`` dispatch as the other industrial brands, so it is a
408
+ pure brand specialization of the shared core. Denmark-made,
409
+ Teradyne (US) owned — passes the default US-federal policy.
410
+ """
411
+
412
+ BRAND = "ur"
413
+
414
+
415
+ class FrankaAdapter(IndustrialArmAdapter):
416
+ """Franka Emika arm via ``franka_ros2`` + MoveIt 2.
417
+
418
+ The dominant research/teaching arm; first-class here because the
419
+ educational community is a core adoption flywheel. Germany-made —
420
+ passes the default US-federal policy.
421
+ """
422
+
423
+ BRAND = "franka"
424
+
425
+
426
+ class KawasakiAdapter(IndustrialArmAdapter):
427
+ """Kawasaki arm via the ``khi_ros2`` ROS-Industrial driver + MoveIt 2.
428
+
429
+ Wraps the upstream ``Kawasaki-Robotics/khi_ros2`` driver as it ships;
430
+ the supported Kawasaki controller line is whatever the upstream driver
431
+ supports at the URML-target commit. Per Kawasaki-Robotics maintainer
432
+ clarification on khi_ros2 issue #9 (kurita-taisuke, 2026-05-26), the
433
+ driver does not currently support E-series controllers, and the legacy
434
+ D / C series are not on the roadmap.
435
+
436
+ AS-language program invocation is the maintainer-endorsed binding for
437
+ URML's ``call_program`` primitive (RFC-0015, confirmed by kurita-taisuke
438
+ on khi_ros2 issue #9, Q2): a `call_program` step maps to launching a
439
+ named Kawasaki AS program on the controller.
440
+
441
+ Japan-made — passes the default US-federal policy (JP allied origin).
442
+ """
443
+
444
+ BRAND = "kawasaki"
445
+
446
+
447
+ class StaubliAdapter(IndustrialArmAdapter):
448
+ """Stäubli arm via ``staubli_val3_driver`` (VAL 3 protocol bridge) + MoveIt 2.
449
+
450
+ Switzerland-made — passes the default US-federal policy (CH allied).
451
+ """
452
+
453
+ BRAND = "staubli"
454
+
455
+
456
+ class ComauAdapter(IndustrialArmAdapter):
457
+ """Comau arm via ``comau_ros2_driver`` + MoveIt 2.
458
+
459
+ Italy-made (Stellantis subsidiary) — passes the default US-federal
460
+ policy (IT allied origin).
461
+ """
462
+
463
+ BRAND = "comau"
464
+
465
+
466
+ class MitsubishiAdapter(IndustrialArmAdapter):
467
+ """Mitsubishi Electric MELFA arm via ``melfa_ros2`` + MoveIt 2.
468
+
469
+ Japan-made — passes the default US-federal policy. Vendor token is
470
+ ``mitsubishi_electric`` in provenance to disambiguate from any other
471
+ Mitsubishi-prefixed entity.
472
+ """
473
+
474
+ BRAND = "mitsubishi"
475
+
476
+
477
+ class DensoAdapter(IndustrialArmAdapter):
478
+ """Denso arm via ``denso_robot_ros2`` + MoveIt 2.
479
+
480
+ Japan-made — passes the default US-federal policy.
481
+ """
482
+
483
+ BRAND = "denso"
484
+
485
+
486
+ class HyundaiAdapter(IndustrialArmAdapter):
487
+ """Hyundai Robotics arm via ``hyundai_robot_ros2`` + MoveIt 2.
488
+
489
+ South Korea-made — passes the default US-federal policy (KR allied
490
+ origin; not on the denylist).
491
+ """
492
+
493
+ BRAND = "hyundai"
494
+
495
+
496
+ class NachiAdapter(IndustrialArmAdapter):
497
+ """Nachi-Fujikoshi arm via ``nachi_robot_ros2`` + MoveIt 2.
498
+
499
+ Japan-made — passes the default US-federal policy.
500
+ """
501
+
502
+ BRAND = "nachi"
503
+
504
+
505
+ class EpsonAdapter(IndustrialArmAdapter):
506
+ """Seiko Epson SCARA / 6-axis arm via ``epson_robot_ros2`` + MoveIt 2.
507
+
508
+ Japan-made — passes the default US-federal policy.
509
+ """
510
+
511
+ BRAND = "epson"
512
+
513
+
514
+ class OmronAdapter(IndustrialArmAdapter):
515
+ """Omron industrial arm (the former Adept line) via ``omron_industrial_robot``
516
+ ROS-Industrial driver + MoveIt 2.
517
+
518
+ Japan-made (Adept Technology was acquired by Omron in 2015) — passes
519
+ the default US-federal policy.
520
+ """
521
+
522
+ BRAND = "omron"
523
+
524
+
525
+ class HanwhaAdapter(IndustrialArmAdapter):
526
+ """Hanwha HCR collaborative arm via ``hanwha_hcr_ros2`` + MoveIt 2.
527
+
528
+ Unlike Doosan/Techman/Kinova (zero-ROS vendor SDKs handled by
529
+ ``cobot-runtime``), Hanwha publishes a ROS 2 driver shaped exactly
530
+ like the other ROS-Industrial brands, so it belongs in this runtime.
531
+ South Korea-made — passes the default US-federal policy.
532
+ """
533
+
534
+ BRAND = "hanwha"
File without changes
@@ -0,0 +1,98 @@
1
+ """End-to-end: a URML pick-place fixture run on a simulated industrial arm.
2
+
3
+ The PX4 analog is ``reference/px4-runtime/tests/integration/
4
+ test_px4_sitl_e2e.py``. This takes the existing ``industrial/
5
+ pick_red_positive`` conformance fixture and runs it through the *same*
6
+ ``ConformanceRunner`` the hermetic suite uses, with ``adapter_factory``
7
+ wired to a live brand arm composed with a vision companion.
8
+
9
+ ## Why a composite
10
+
11
+ ``GraspArgs.target`` is a required ``VarRef`` — URML ``grasp`` always
12
+ acts on a *detected* target, so a pick-place program necessarily
13
+ contains a ``detect`` step. A bare fixed-base arm has no onboard
14
+ perception (it returns ``not_supported_on_industrial_arm`` for
15
+ ``query_detection``), exactly as a bare PX4 autopilot has no
16
+ perception. The honest deployment, and the one this test exercises, is
17
+ the brand arm paired with a vision companion via the already-tested
18
+ ``urml_px4_runtime.CompositeAdapter`` (a generic two-backend router;
19
+ the ``flight``/``companion`` slot names are role-neutral). Arm owns
20
+ motion + manipulation + report; the vision companion owns detection.
21
+
22
+ ## Gating
23
+
24
+ Two gates, both required:
25
+
26
+ - ``URML_INDUSTRIAL_ARM_SIM=1`` opts in to the heavy sim test.
27
+ - ``URML_ARM_BRAND`` selects the vendor (abb | fanuc | kuka |
28
+ yaskawa); defaults to ``abb``.
29
+
30
+ The default ``pytest`` invocation skips this module entirely. The
31
+ ``industrial-arm-integration.yml`` workflow brings up a ROS 2 + MoveIt 2
32
+ sim, sets the env vars, and runs it per brand; it uploads ROS logs and
33
+ the pytest output as artifacts on ``always()``.
34
+
35
+ ## Honest scope
36
+
37
+ A MoveIt 2 sim with fake controllers is not physical hardware. This
38
+ proves the brand adapter actually drives a simulated arm from a URML
39
+ program. The first run is a calibration run (the vendor moveit_config /
40
+ launch names below are best-effort, authored without the ability to run
41
+ the sim — same convention as the px4 and ros2 integration workflows),
42
+ not a regression signal.
43
+ """
44
+
45
+ from __future__ import annotations
46
+
47
+ import os
48
+
49
+ import pytest
50
+
51
+ pytestmark = pytest.mark.skipif(
52
+ os.environ.get("URML_INDUSTRIAL_ARM_SIM") != "1",
53
+ reason="Set URML_INDUSTRIAL_ARM_SIM=1 (and have a MoveIt 2 sim running) to run this.",
54
+ )
55
+
56
+ _FIXTURE_NAME = "industrial/pick_red_positive"
57
+
58
+
59
+ def test_pick_place_fixture_runs_against_sim() -> None:
60
+ """The pick-place fixture passes when run against a simulated arm + vision."""
61
+ from urml_conformance import ConformanceRunner, discover_fixtures
62
+ from urml_ros2_runtime.substrate.adapter_config import AdapterConfig
63
+ from urml_ros2_runtime.substrate.rclpy_adapter import RclpyAdapter
64
+
65
+ # CompositeAdapter is a generic two-backend router shipped with the
66
+ # px4 runtime; reused here so no industrial-specific composite code
67
+ # is duplicated. Imported lazily so the package keeps no px4 dep.
68
+ from urml_px4_runtime import CompositeAdapter
69
+
70
+ from urml_industrial_arm_runtime import BRAND_ADAPTERS
71
+
72
+ brand = os.environ.get("URML_ARM_BRAND", "abb").strip().lower()
73
+ if brand not in BRAND_ADAPTERS:
74
+ pytest.fail(f"URML_ARM_BRAND={brand!r} is not one of {sorted(BRAND_ADAPTERS)!r}")
75
+
76
+ cases = [c for c in discover_fixtures() if c.name == _FIXTURE_NAME]
77
+ assert cases, f"fixture {_FIXTURE_NAME!r} not found in the conformance suite"
78
+
79
+ # Arm in the `flight` slot (motion + manipulation + report); vision
80
+ # in the `companion` slot (perception). Override the default routing
81
+ # so manipulation/report/wait_for go to the ARM, not the vision box.
82
+ arm_to_flight = {
83
+ "send_manipulation_goal": "flight",
84
+ "take_measurement": "flight",
85
+ "wait_for_condition": "flight",
86
+ "emit_report": "flight",
87
+ }
88
+
89
+ def _factory() -> CompositeAdapter:
90
+ arm = BRAND_ADAPTERS[brand]() # brand default ROS-Industrial config
91
+ vision = RclpyAdapter(AdapterConfig(), node_name=f"urml_{brand}_vision")
92
+ return CompositeAdapter(flight=arm, companion=vision, routing=arm_to_flight)
93
+
94
+ runner = ConformanceRunner(cases=cases, adapter_factory=_factory)
95
+ report = runner.run()
96
+ assert report.all_passed, (
97
+ f"{_FIXTURE_NAME} failed against the {brand} MoveIt 2 sim:\n" + report.render()
98
+ )
@@ -0,0 +1,203 @@
1
+ """Hermetic unit tests for the industrial-arm brand adapters.
2
+
3
+ No ROS 2 install required. The brand adapters compose a RclpyAdapter,
4
+ but RclpyAdapter only imports rclpy when *it* is constructed. These
5
+ tests bypass that entirely via the ``inner_factory`` hook: a recording
6
+ fake stands in for the composed adapter, so every wrapper code path
7
+ (delegation + the not-supported sentinels) is exercised against a
8
+ controllable double. Real ROS 2 / MoveIt 2 behavior is covered
9
+ separately by the gated integration workflow.
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ from typing import Any
15
+
16
+ import pytest
17
+ from urml_ros2_runtime.substrate.base import (
18
+ ManipulationResult,
19
+ NavigationResult,
20
+ ProgramCallResult,
21
+ ROSAdapter,
22
+ SubstrateResult,
23
+ )
24
+
25
+ from urml_industrial_arm_runtime import (
26
+ AbbAdapter,
27
+ ComauAdapter,
28
+ DensoAdapter,
29
+ EpsonAdapter,
30
+ FanucAdapter,
31
+ FrankaAdapter,
32
+ HanwhaAdapter,
33
+ HyundaiAdapter,
34
+ IndustrialArmAdapter,
35
+ KawasakiAdapter,
36
+ KukaAdapter,
37
+ MitsubishiAdapter,
38
+ NachiAdapter,
39
+ OmronAdapter,
40
+ StaubliAdapter,
41
+ UrAdapter,
42
+ YaskawaAdapter,
43
+ )
44
+
45
+ BRAND_CLASSES = [
46
+ AbbAdapter,
47
+ FanucAdapter,
48
+ KukaAdapter,
49
+ YaskawaAdapter,
50
+ UrAdapter,
51
+ FrankaAdapter,
52
+ KawasakiAdapter,
53
+ StaubliAdapter,
54
+ ComauAdapter,
55
+ MitsubishiAdapter,
56
+ DensoAdapter,
57
+ HyundaiAdapter,
58
+ NachiAdapter,
59
+ EpsonAdapter,
60
+ OmronAdapter,
61
+ HanwhaAdapter,
62
+ ]
63
+ BRAND_IDS = [c.BRAND for c in BRAND_CLASSES]
64
+
65
+
66
+ class _RecordingInner:
67
+ """Records delegated calls; returns recognizable success results."""
68
+
69
+ def __init__(self) -> None:
70
+ self.calls: list[tuple[str, dict[str, Any]]] = []
71
+ self.closed = False
72
+
73
+ def send_navigation_goal(self, **kw: Any) -> NavigationResult:
74
+ self.calls.append(("send_navigation_goal", kw))
75
+ return NavigationResult(success=True, final_pose={"x": 1.0}, frame="world")
76
+
77
+ def send_manipulation_goal(self, **kw: Any) -> ManipulationResult:
78
+ self.calls.append(("send_manipulation_goal", kw))
79
+ return ManipulationResult(success=True, grip_force_n=12.5)
80
+
81
+ def take_measurement(self, **kw: Any) -> SubstrateResult:
82
+ self.calls.append(("take_measurement", kw))
83
+ return SubstrateResult(success=True)
84
+
85
+ def wait_for_condition(self, **kw: Any) -> SubstrateResult:
86
+ self.calls.append(("wait_for_condition", kw))
87
+ return SubstrateResult(success=True)
88
+
89
+ def wait_passively(self, **kw: Any) -> SubstrateResult:
90
+ self.calls.append(("wait_passively", kw))
91
+ return SubstrateResult(success=True)
92
+
93
+ def emit_report(self, **kw: Any) -> SubstrateResult:
94
+ self.calls.append(("emit_report", kw))
95
+ return SubstrateResult(success=True)
96
+
97
+ def call_named_program(self, **kw: Any) -> ProgramCallResult:
98
+ self.calls.append(("call_named_program", kw))
99
+ return ProgramCallResult(success=True)
100
+
101
+ def close(self) -> None:
102
+ self.closed = True
103
+
104
+
105
+ def _make(cls: type[IndustrialArmAdapter]) -> tuple[IndustrialArmAdapter, _RecordingInner]:
106
+ inner = _RecordingInner()
107
+ adapter = cls(inner_factory=lambda: inner)
108
+ return adapter, inner
109
+
110
+
111
+ @pytest.mark.parametrize("cls", BRAND_CLASSES, ids=BRAND_IDS)
112
+ def test_brand_tag_and_default_config(cls: type[IndustrialArmAdapter]) -> None:
113
+ adapter, _ = _make(cls)
114
+ assert adapter.BRAND == cls.BRAND
115
+ cfg = cls.default_config()
116
+ # MoveIt 2 vanilla move-group, and a brand-keyed gripper server.
117
+ assert cfg.action_servers.move_group == "/move_action"
118
+ assert f"{cls.BRAND}_gripper" in cfg.action_servers.gripper
119
+
120
+
121
+ @pytest.mark.parametrize("cls", BRAND_CLASSES, ids=BRAND_IDS)
122
+ def test_supported_primitives_delegate(cls: type[IndustrialArmAdapter]) -> None:
123
+ adapter, inner = _make(cls)
124
+
125
+ grip = adapter.send_manipulation_goal(action="grasp", force_n=10.0)
126
+ assert grip.success and grip.grip_force_n == 12.5
127
+
128
+ move = adapter.send_navigation_goal(location="fixture_a")
129
+ assert move.success and move.frame == "world"
130
+
131
+ assert adapter.wait_passively(duration_seconds=0.1).success
132
+ assert adapter.take_measurement(what="joint_state", target=None, sensor=None).success
133
+ assert adapter.emit_report(
134
+ to="cell_log", facts={"ok": True}, attachments=None, status="success", severity="info"
135
+ ).success
136
+ assert adapter.call_named_program(name="pick_place_cycle").success
137
+
138
+ delegated = [name for name, _ in inner.calls]
139
+ assert delegated == [
140
+ "send_manipulation_goal",
141
+ "send_navigation_goal",
142
+ "wait_passively",
143
+ "take_measurement",
144
+ "emit_report",
145
+ "call_named_program",
146
+ ]
147
+
148
+
149
+ @pytest.mark.parametrize("cls", BRAND_CLASSES, ids=BRAND_IDS)
150
+ def test_grasp_passes_arm_grasp_type_and_target_motion_on(cls: type[IndustrialArmAdapter]) -> None:
151
+ """The adapter dropped `arm` on the way to the ROS 2 adapter and could not take the other two."""
152
+ adapter, inner = _make(cls)
153
+ assert adapter.send_manipulation_goal(
154
+ action="grasp", arm="left", grasp_type="precision", target_motion="tracked"
155
+ ).success
156
+ name, kw = inner.calls[-1]
157
+ assert name == "send_manipulation_goal"
158
+ assert (kw["arm"], kw["grasp_type"], kw["target_motion"]) == ("left", "precision", "tracked")
159
+
160
+
161
+ @pytest.mark.parametrize("cls", BRAND_CLASSES, ids=BRAND_IDS)
162
+ def test_unsupported_primitives_return_branded_sentinel(cls: type[IndustrialArmAdapter]) -> None:
163
+ adapter, inner = _make(cls)
164
+ tag = f"not_supported_on_industrial_arm[{cls.BRAND}]"
165
+
166
+ results = [
167
+ adapter.send_docking_goal(station="d1", service="park"),
168
+ adapter.query_detection(object_class="widget"),
169
+ adapter.run_scan(area={}, pattern="grid", overlap=0.1, altitude=None, media="photo", sensor=None),
170
+ adapter.capture_media(media="photo", target=None, duration_seconds=None, attributes=None),
171
+ adapter.emit_speech(utterance="hi", locale=None, style="notice", interrupt=False),
172
+ adapter.acquire_speech(
173
+ prompt=None, locale=None, timeout_seconds=None, expected="free_form", choices=None
174
+ ),
175
+ adapter.send_takeoff_goal(altitude=5.0),
176
+ adapter.send_land_goal(),
177
+ adapter.send_return_to_home_goal(),
178
+ ]
179
+ for r in results:
180
+ assert r.success is False
181
+ assert r.reason is not None and r.reason.startswith(tag)
182
+ # Not-supported paths must never reach the composed adapter.
183
+ assert inner.calls == []
184
+
185
+
186
+ @pytest.mark.parametrize("cls", BRAND_CLASSES, ids=BRAND_IDS)
187
+ def test_is_a_ros_adapter_and_closes(cls: type[IndustrialArmAdapter]) -> None:
188
+ adapter, inner = _make(cls)
189
+ # runtime_checkable Protocol conformance.
190
+ assert isinstance(adapter, ROSAdapter)
191
+ with adapter as a:
192
+ assert a is adapter
193
+ assert inner.closed is True
194
+
195
+
196
+ def test_conformance_runner_accepts_brand_factory() -> None:
197
+ """The ConformanceRunner accepts an industrial-arm adapter factory."""
198
+ from urml_conformance import ConformanceRunner
199
+
200
+ runner = ConformanceRunner(
201
+ adapter_factory=lambda: AbbAdapter(inner_factory=lambda: _RecordingInner())
202
+ )
203
+ assert runner is not None