a2a-robots-pollen 0.1.1__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.
- a2a_robots_pollen-0.1.1/.gitignore +8 -0
- a2a_robots_pollen-0.1.1/CHANGELOG.md +17 -0
- a2a_robots_pollen-0.1.1/PKG-INFO +79 -0
- a2a_robots_pollen-0.1.1/README.md +56 -0
- a2a_robots_pollen-0.1.1/examples/serve_reachy2.py +57 -0
- a2a_robots_pollen-0.1.1/pyproject.toml +40 -0
- a2a_robots_pollen-0.1.1/src/a2a_robots_pollen/__init__.py +28 -0
- a2a_robots_pollen-0.1.1/src/a2a_robots_pollen/backend.py +422 -0
- a2a_robots_pollen-0.1.1/src/a2a_robots_pollen/fake.py +406 -0
- a2a_robots_pollen-0.1.1/src/a2a_robots_pollen/planner.py +186 -0
- a2a_robots_pollen-0.1.1/tests/test_contract.py +7 -0
- a2a_robots_pollen-0.1.1/tests/test_planner.py +204 -0
- a2a_robots_pollen-0.1.1/tests/test_reachy2_backend.py +553 -0
- a2a_robots_pollen-0.1.1/tests/test_reachy2_sdk_grpc.py +612 -0
- a2a_robots_pollen-0.1.1/uv.lock +1235 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.1.1](https://github.com/hybroai/a2a-robots/compare/a2a-robots-pollen-v0.1.0...a2a-robots-pollen-v0.1.1) (2026-11-18)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Miscellaneous Chores
|
|
7
|
+
|
|
8
|
+
* **pollen:** bootstrap first PyPI release ([c1fd353](https://github.com/hybroai/a2a-robots/commit/c1fd3533dcb2b36e3a659fba99e8283c3c79d3b4))
|
|
9
|
+
|
|
10
|
+
## Changelog
|
|
11
|
+
|
|
12
|
+
All notable changes to this project will be documented in this file.
|
|
13
|
+
|
|
14
|
+
Entries are generated by
|
|
15
|
+
[release-please](https://github.com/googleapis/release-please) from
|
|
16
|
+
Conventional Commits. This project adheres to
|
|
17
|
+
[Semantic Versioning](https://semver.org/).
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: a2a-robots-pollen
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Pollen Robotics Reachy 2 backend for a2a-robots
|
|
5
|
+
Project-URL: Repository, https://github.com/hybroai/a2a-robots
|
|
6
|
+
Author-email: HYBRO AI <info@hybro.ai>
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
14
|
+
Requires-Python: >=3.11
|
|
15
|
+
Requires-Dist: a2a-robots
|
|
16
|
+
Requires-Dist: numpy>=1.26
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
19
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
20
|
+
Provides-Extra: sdk
|
|
21
|
+
Requires-Dist: reachy2-sdk<2,>=1.0.15; extra == 'sdk'
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# a2a-robots-pollen
|
|
25
|
+
|
|
26
|
+
[Pollen Robotics Reachy 2](https://github.com/pollen-robotics/reachy2-sdk) backend for [a2a-robots](../../README.md).
|
|
27
|
+
|
|
28
|
+
Install from PyPI: `pip install a2a-robots-pollen`.
|
|
29
|
+
|
|
30
|
+
## Reachy 2 backend
|
|
31
|
+
|
|
32
|
+
`Reachy2Backend` (aliased as `PollenBackend`) exposes Reachy 2's dual 7-DoF arms (`l_arm`, `r_arm`) and parallel grippers through `a2a_robots.RobotBackend` and `a2a_robots.RobotAdapter`.
|
|
33
|
+
|
|
34
|
+
- Arm poses come from Reachy 2 forward kinematics in the robot's own coordinate system. The backend labels them with the configured `frame` (default `"world"`); on a mobile base that is still the robot frame, not a fixed room frame, so size the workspace box accordingly. Explicit joint positions from `arm.get_current_positions(degrees=False)` are passed into `arm.forward_kinematics(q_rad, degrees=False)` to avoid the `forward_kinematics(None, degrees=False)` degree-vs-radian and 8-actuator bug in `reachy2-sdk 1.0.15`.
|
|
35
|
+
- The default planner is `Reachy2Planner`, which calls `arm.inverse_kinematics(..., degrees=False)`, verifies forward-kinematics reachability within tolerance, rejects solutions whose per-joint travel exceeds `max_joint_delta_rad` (default 1.0 rad), and generates speed-limited minimum-jerk joint trajectories streamed via `arm.send_goal_positions(check_positions=False)`. Pass `planner=` to plug in another `a2a_robots.planning.Planner`.
|
|
36
|
+
- `open` and `close` stream `arm.gripper.set_opening(...)` in small increments and check the `stop` flag every control step (20 ms by default). Stalls during the first `startup_grace_s` (0.2 s) of `close` are ignored only while the opening is still at its start value (mid-range start plus brief latency). After that grace, or once the opening has moved, stalls count — including a re-close that is already on an object. If the gripper then stays stalled short of its target (`closed_opening_pct < opening < open_opening_pct`) for `grasp_settle_s` (0.2 s), `observe()` reports `held=True` and non-empty `contact` (`contact["finger"]` is a proxy estimate `(100 - opening) / 10`, since Reachy 2's `ParallelGripper` does not measure contact force). A stall that lasts at least `contact_stall_s` (0.1 s) but then closes past the object returns `FailureCode.SLIPPED`; shorter stalls, such as a late state update, are ignored. The gripper only reports its opening, so a lag lasting between the two durations that then catches up in empty air also reads as `slipped`.
|
|
37
|
+
- `held` stays true only while the measured opening remains within `grasp_opening_tol_pct` (5%) of the opening recorded when `close` settled. `hold()` cancels active SDK gotos (`cancel_all_goto()`) on every arm and gripper and locks the current joint angles. Hands that are still near that grasp opening are re-commanded to a closed gripper target (0%) so a stop while carrying does not open the squeeze; otherwise `hold()` keeps the measured opening (so a stopped mid-`open` does not slam shut).
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
`a2a-robots-pollen` is an independent `uv` project with its own `uv.lock` and an optional `sdk` extra for `reachy2-sdk`. Offline tests and `FakeReachySDK` work out of the box without installing `reachy2-sdk`:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Offline with the built-in test double (no reachy2-sdk):
|
|
45
|
+
REACHY2_FAKE=1 uv run --directory packages/a2a-robots-pollen python examples/serve_reachy2.py
|
|
46
|
+
|
|
47
|
+
# Live / simulated Reachy 2 (installs the `sdk` extra: reachy2-sdk):
|
|
48
|
+
uv run --directory packages/a2a-robots-pollen --extra sdk python examples/serve_reachy2.py
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The offline fake path is what unit tests exercise by default. Integration coverage against the real `reachy2-sdk` classes (in-process gRPC over `FakeReachySDK`) runs with `--extra sdk`. A smoke test against the `pollenrobotics/reachy2` Docker simulator is available when `REACHY2_HOST` is set (see Tests).
|
|
52
|
+
|
|
53
|
+
Or in Python:
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from a2a_robots import RobotAdapter, SafetyLimits, Workspace, serve_robot
|
|
57
|
+
from a2a_robots_pollen import Reachy2Backend, connect
|
|
58
|
+
|
|
59
|
+
backend = Reachy2Backend(connect("localhost"))
|
|
60
|
+
limits = SafetyLimits(workspace=Workspace("world", (-0.5, -0.8, -0.5), (0.8, 0.8, 0.8)))
|
|
61
|
+
adapter = RobotAdapter(backend, limits, name="Reachy 2")
|
|
62
|
+
serve_robot(adapter, port=9100)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Tests
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Offline unit & adapter tests against FakeReachySDK
|
|
69
|
+
uv run --directory packages/a2a-robots-pollen --extra dev pytest
|
|
70
|
+
|
|
71
|
+
# Integration tests against the real reachy2-sdk classes over an in-process gRPC server
|
|
72
|
+
A2A_ROBOTS_REQUIRE_REACHY2_SDK=1 uv run --directory packages/a2a-robots-pollen \
|
|
73
|
+
--extra sdk --extra dev pytest tests/test_reachy2_sdk_grpc.py
|
|
74
|
+
|
|
75
|
+
# Smoke test against a running Pollen Reachy 2 Docker simulator (pollenrobotics/reachy2)
|
|
76
|
+
REACHY2_HOST=localhost A2A_ROBOTS_REQUIRE_REACHY2_SDK=1 uv run --directory packages/a2a-robots-pollen \
|
|
77
|
+
--extra sdk --extra dev pytest tests/test_reachy2_sdk_grpc.py -k docker_sim
|
|
78
|
+
```
|
|
79
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# a2a-robots-pollen
|
|
2
|
+
|
|
3
|
+
[Pollen Robotics Reachy 2](https://github.com/pollen-robotics/reachy2-sdk) backend for [a2a-robots](../../README.md).
|
|
4
|
+
|
|
5
|
+
Install from PyPI: `pip install a2a-robots-pollen`.
|
|
6
|
+
|
|
7
|
+
## Reachy 2 backend
|
|
8
|
+
|
|
9
|
+
`Reachy2Backend` (aliased as `PollenBackend`) exposes Reachy 2's dual 7-DoF arms (`l_arm`, `r_arm`) and parallel grippers through `a2a_robots.RobotBackend` and `a2a_robots.RobotAdapter`.
|
|
10
|
+
|
|
11
|
+
- Arm poses come from Reachy 2 forward kinematics in the robot's own coordinate system. The backend labels them with the configured `frame` (default `"world"`); on a mobile base that is still the robot frame, not a fixed room frame, so size the workspace box accordingly. Explicit joint positions from `arm.get_current_positions(degrees=False)` are passed into `arm.forward_kinematics(q_rad, degrees=False)` to avoid the `forward_kinematics(None, degrees=False)` degree-vs-radian and 8-actuator bug in `reachy2-sdk 1.0.15`.
|
|
12
|
+
- The default planner is `Reachy2Planner`, which calls `arm.inverse_kinematics(..., degrees=False)`, verifies forward-kinematics reachability within tolerance, rejects solutions whose per-joint travel exceeds `max_joint_delta_rad` (default 1.0 rad), and generates speed-limited minimum-jerk joint trajectories streamed via `arm.send_goal_positions(check_positions=False)`. Pass `planner=` to plug in another `a2a_robots.planning.Planner`.
|
|
13
|
+
- `open` and `close` stream `arm.gripper.set_opening(...)` in small increments and check the `stop` flag every control step (20 ms by default). Stalls during the first `startup_grace_s` (0.2 s) of `close` are ignored only while the opening is still at its start value (mid-range start plus brief latency). After that grace, or once the opening has moved, stalls count — including a re-close that is already on an object. If the gripper then stays stalled short of its target (`closed_opening_pct < opening < open_opening_pct`) for `grasp_settle_s` (0.2 s), `observe()` reports `held=True` and non-empty `contact` (`contact["finger"]` is a proxy estimate `(100 - opening) / 10`, since Reachy 2's `ParallelGripper` does not measure contact force). A stall that lasts at least `contact_stall_s` (0.1 s) but then closes past the object returns `FailureCode.SLIPPED`; shorter stalls, such as a late state update, are ignored. The gripper only reports its opening, so a lag lasting between the two durations that then catches up in empty air also reads as `slipped`.
|
|
14
|
+
- `held` stays true only while the measured opening remains within `grasp_opening_tol_pct` (5%) of the opening recorded when `close` settled. `hold()` cancels active SDK gotos (`cancel_all_goto()`) on every arm and gripper and locks the current joint angles. Hands that are still near that grasp opening are re-commanded to a closed gripper target (0%) so a stop while carrying does not open the squeeze; otherwise `hold()` keeps the measured opening (so a stopped mid-`open` does not slam shut).
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
`a2a-robots-pollen` is an independent `uv` project with its own `uv.lock` and an optional `sdk` extra for `reachy2-sdk`. Offline tests and `FakeReachySDK` work out of the box without installing `reachy2-sdk`:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Offline with the built-in test double (no reachy2-sdk):
|
|
22
|
+
REACHY2_FAKE=1 uv run --directory packages/a2a-robots-pollen python examples/serve_reachy2.py
|
|
23
|
+
|
|
24
|
+
# Live / simulated Reachy 2 (installs the `sdk` extra: reachy2-sdk):
|
|
25
|
+
uv run --directory packages/a2a-robots-pollen --extra sdk python examples/serve_reachy2.py
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The offline fake path is what unit tests exercise by default. Integration coverage against the real `reachy2-sdk` classes (in-process gRPC over `FakeReachySDK`) runs with `--extra sdk`. A smoke test against the `pollenrobotics/reachy2` Docker simulator is available when `REACHY2_HOST` is set (see Tests).
|
|
29
|
+
|
|
30
|
+
Or in Python:
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
from a2a_robots import RobotAdapter, SafetyLimits, Workspace, serve_robot
|
|
34
|
+
from a2a_robots_pollen import Reachy2Backend, connect
|
|
35
|
+
|
|
36
|
+
backend = Reachy2Backend(connect("localhost"))
|
|
37
|
+
limits = SafetyLimits(workspace=Workspace("world", (-0.5, -0.8, -0.5), (0.8, 0.8, 0.8)))
|
|
38
|
+
adapter = RobotAdapter(backend, limits, name="Reachy 2")
|
|
39
|
+
serve_robot(adapter, port=9100)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Tests
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Offline unit & adapter tests against FakeReachySDK
|
|
46
|
+
uv run --directory packages/a2a-robots-pollen --extra dev pytest
|
|
47
|
+
|
|
48
|
+
# Integration tests against the real reachy2-sdk classes over an in-process gRPC server
|
|
49
|
+
A2A_ROBOTS_REQUIRE_REACHY2_SDK=1 uv run --directory packages/a2a-robots-pollen \
|
|
50
|
+
--extra sdk --extra dev pytest tests/test_reachy2_sdk_grpc.py
|
|
51
|
+
|
|
52
|
+
# Smoke test against a running Pollen Reachy 2 Docker simulator (pollenrobotics/reachy2)
|
|
53
|
+
REACHY2_HOST=localhost A2A_ROBOTS_REQUIRE_REACHY2_SDK=1 uv run --directory packages/a2a-robots-pollen \
|
|
54
|
+
--extra sdk --extra dev pytest tests/test_reachy2_sdk_grpc.py -k docker_sim
|
|
55
|
+
```
|
|
56
|
+
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""Serve a Pollen Robotics Reachy 2 robot on http://127.0.0.1:9100/.
|
|
2
|
+
|
|
3
|
+
Uses ``FakeReachySDK`` when ``--fake`` is passed or ``REACHY2_FAKE=1`` is set,
|
|
4
|
+
and connects to a live or simulated Reachy 2 gRPC server at ``REACHY2_HOST``
|
|
5
|
+
(default ``"localhost"``) otherwise.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import argparse
|
|
11
|
+
import os
|
|
12
|
+
|
|
13
|
+
from a2a_robots import RobotAdapter, SafetyLimits, Workspace, serve_robot
|
|
14
|
+
from a2a_robots_pollen import FakeReachySDK, Reachy2Backend, connect
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def build_adapter(*, fake: bool = False, host: str = "localhost") -> RobotAdapter:
|
|
18
|
+
if fake:
|
|
19
|
+
reachy = FakeReachySDK()
|
|
20
|
+
assert reachy.r_arm is not None
|
|
21
|
+
pos = reachy.r_arm.forward_kinematics(
|
|
22
|
+
reachy.r_arm.get_current_positions(degrees=False), degrees=False
|
|
23
|
+
)[:3, 3]
|
|
24
|
+
reachy.place_object("cube", (float(pos[0]), float(pos[1]), float(pos[2])))
|
|
25
|
+
else:
|
|
26
|
+
reachy = connect(host)
|
|
27
|
+
|
|
28
|
+
backend = Reachy2Backend(reachy)
|
|
29
|
+
limits = SafetyLimits(
|
|
30
|
+
workspace=Workspace("world", (-0.5, -0.8, -0.5), (0.8, 0.8, 0.8)),
|
|
31
|
+
max_step_m=0.05,
|
|
32
|
+
max_step_rad=0.25,
|
|
33
|
+
)
|
|
34
|
+
return RobotAdapter(
|
|
35
|
+
backend,
|
|
36
|
+
limits,
|
|
37
|
+
name="Pollen Reachy 2",
|
|
38
|
+
description="Pollen Robotics Reachy 2 dual-arm humanoid robot via reachy2-sdk.",
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
if __name__ == "__main__":
|
|
43
|
+
parser = argparse.ArgumentParser(description=__doc__)
|
|
44
|
+
parser.add_argument(
|
|
45
|
+
"--fake",
|
|
46
|
+
action="store_true",
|
|
47
|
+
default=os.environ.get("REACHY2_FAKE") == "1",
|
|
48
|
+
help="Use offline FakeReachySDK instead of connecting via gRPC.",
|
|
49
|
+
)
|
|
50
|
+
parser.add_argument(
|
|
51
|
+
"--host",
|
|
52
|
+
default=os.environ.get("REACHY2_HOST", "localhost"),
|
|
53
|
+
help="Reachy 2 gRPC host (default: localhost or REACHY2_HOST).",
|
|
54
|
+
)
|
|
55
|
+
parser.add_argument("--port", type=int, default=9100)
|
|
56
|
+
args = parser.parse_args()
|
|
57
|
+
serve_robot(build_adapter(fake=args.fake, host=args.host), port=args.port)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.24"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "a2a-robots-pollen"
|
|
7
|
+
version = "0.1.1"
|
|
8
|
+
description = "Pollen Robotics Reachy 2 backend for a2a-robots"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
authors = [{ name = "HYBRO AI", email = "info@hybro.ai" }]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3.11",
|
|
17
|
+
"Programming Language :: Python :: 3.12",
|
|
18
|
+
"Programming Language :: Python :: 3.13",
|
|
19
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
20
|
+
]
|
|
21
|
+
dependencies = ["a2a-robots", "numpy>=1.26"]
|
|
22
|
+
|
|
23
|
+
[project.optional-dependencies]
|
|
24
|
+
sdk = ["reachy2-sdk>=1.0.15,<2"]
|
|
25
|
+
dev = ["pytest>=8", "pytest-asyncio>=0.23"]
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
Repository = "https://github.com/hybroai/a2a-robots"
|
|
29
|
+
|
|
30
|
+
[tool.uv.sources]
|
|
31
|
+
a2a-robots = { path = "../..", editable = true }
|
|
32
|
+
|
|
33
|
+
[tool.hatch.build.targets.wheel]
|
|
34
|
+
packages = ["src/a2a_robots_pollen"]
|
|
35
|
+
|
|
36
|
+
[tool.pytest.ini_options]
|
|
37
|
+
asyncio_mode = "auto"
|
|
38
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
39
|
+
testpaths = ["tests"]
|
|
40
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Pollen Robotics Reachy 2 backend for a2a-robots."""
|
|
2
|
+
|
|
3
|
+
__version__ = "0.1.1"
|
|
4
|
+
|
|
5
|
+
from a2a_robots_pollen.backend import PollenBackend, Reachy2Backend, connect
|
|
6
|
+
from a2a_robots_pollen.fake import FakeReachySDK
|
|
7
|
+
from a2a_robots_pollen.planner import (
|
|
8
|
+
ARM_JOINTS,
|
|
9
|
+
Reachy2Planner,
|
|
10
|
+
hand_joints,
|
|
11
|
+
matrix_to_pose,
|
|
12
|
+
pose_error,
|
|
13
|
+
pose_to_matrix,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"ARM_JOINTS",
|
|
18
|
+
"FakeReachySDK",
|
|
19
|
+
"PollenBackend",
|
|
20
|
+
"Reachy2Backend",
|
|
21
|
+
"Reachy2Planner",
|
|
22
|
+
"__version__",
|
|
23
|
+
"connect",
|
|
24
|
+
"hand_joints",
|
|
25
|
+
"matrix_to_pose",
|
|
26
|
+
"pose_error",
|
|
27
|
+
"pose_to_matrix",
|
|
28
|
+
]
|