armnet-client 0.3.2__tar.gz → 0.3.4__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.
- {armnet_client-0.3.2 → armnet_client-0.3.4}/PKG-INFO +5 -3
- {armnet_client-0.3.2 → armnet_client-0.3.4}/pyproject.toml +8 -3
- armnet_client-0.3.4/src/armnet_client/_config.py +31 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/client.py +12 -6
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/current_gate.py +10 -6
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/eval_support/__init__.py +2 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/eval_support/dataset.py +2 -1
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/eval_support/robot.py +165 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/execute.py +4 -4
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/groot_eval.py +27 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/lerobot_eval.py +141 -5
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/lerobot_record.py +24 -20
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/lerobot_teleop.py +24 -19
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/openpi_eval.py +32 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/policy_eval.py +33 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/runtime_groot_eval/groot_eval_runtime.py +17 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/runtime_lerobot_eval/.dockerignore +1 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/runtime_lerobot_eval/Dockerfile +16 -1
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/runtime_lerobot_eval/lerobot_eval_runtime.py +209 -6
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/runtime_lerobot_teleop/lerobot_teleop_runtime.py +2 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/runtime_openpi_eval/Dockerfile +10 -5
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/runtime_openpi_eval/openpi_eval_runtime.py +51 -20
- armnet_client-0.3.4/src/armnet_client/variation.py +198 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_bimanual_lerobot.py +103 -3
- armnet_client-0.3.4/tests/test_bimanual_yam_robot.py +272 -0
- armnet_client-0.3.4/tests/test_client_defaults.py +46 -0
- armnet_client-0.3.4/tests/test_client_exposes_no_rail_homing_control.py +77 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_current_gate.py +6 -9
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_eval_support.py +28 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_execute_queue.py +27 -2
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_groot_eval.py +2 -6
- armnet_client-0.3.4/tests/test_instrumentation_cli.py +22 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_lerobot_eval_build_context.py +82 -1
- armnet_client-0.3.4/tests/test_lerobot_eval_yam_dispatch.py +140 -0
- armnet_client-0.3.4/tests/test_lerobot_eval_yam_image.py +256 -0
- armnet_client-0.3.4/tests/test_policy_eval.py +231 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_rail_cli.py +19 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_runtime_build_context.py +11 -0
- armnet_client-0.3.4/tests/test_variation_preflight.py +231 -0
- armnet_client-0.3.4/tests/yam_eval_fakes.py +123 -0
- armnet_client-0.3.2/src/armnet_client/_config.py +0 -41
- armnet_client-0.3.2/tests/test_policy_eval.py +0 -118
- {armnet_client-0.3.2 → armnet_client-0.3.4}/.gitignore +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/LICENSE +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/README.md +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/__init__.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/_credential_cache.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/cli.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/current_gate_datasets.json +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/current_gate_profile.json +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/eval_support/recovery.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/eval_support/rollout.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/image.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/instrumentation.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/keypoint_capture.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/lerobot_train.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/local.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/local_container.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/rerun_stream.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/robot_telemetry/__init__.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/robot_telemetry/inspect.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/robot_telemetry/schema.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/robot_telemetry/session.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/robot_telemetry/writer.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/runtime_build.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/runtime_groot_eval/Dockerfile +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/runtime_lerobot_eval/diffusion_resolution_patch.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/runtime_lerobot_eval/install_molmoact2_plugin.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/runtime_lerobot_eval/state_guard.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/runtime_lerobot_record/Dockerfile +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/runtime_lerobot_record/lerobot_record_runtime.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/runtime_lerobot_teleop/Dockerfile +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/runtime_openpi_eval/state_guard.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/teleop_stream.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/src/armnet_client/volume.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/fixtures/robot_telemetry_schema.json +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_cli_jobs.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_eval_completion_grace.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_instrumentation_watch.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_lerobot_eval_policy_device.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_lightbox_cli.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_openpi_state_guard.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_record_finish_on_completion.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_robot_telemetry_cli.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_robot_telemetry_inspect.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_robot_telemetry_lean_schema.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_robot_telemetry_runtime_integration.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_robot_telemetry_schema.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_robot_telemetry_session.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_robot_telemetry_writer.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_runtime_is_not_required.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_teleop_finish_on_completion.py +0 -0
- {armnet_client-0.3.2 → armnet_client-0.3.4}/tests/test_wait_interrupt_stop.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: armnet-client
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: armnet client SDK — submit jobs to the platform from dev machines and CI.
|
|
5
5
|
Project-URL: Homepage, https://armnet.dev
|
|
6
6
|
Project-URL: Documentation, https://docs.armnet.dev/packages/client/
|
|
@@ -8,17 +8,19 @@ Author: Ville Kuosmanen
|
|
|
8
8
|
License-Expression: Apache-2.0
|
|
9
9
|
License-File: LICENSE
|
|
10
10
|
Requires-Python: <3.13,>=3.12
|
|
11
|
-
Requires-Dist: armnet-core>=0.3.
|
|
11
|
+
Requires-Dist: armnet-core>=0.3.2
|
|
12
12
|
Requires-Dist: httpx<1,>=0.27
|
|
13
13
|
Requires-Dist: pydantic<3,>=2.6
|
|
14
14
|
Requires-Dist: pynput<2,>=1.8
|
|
15
15
|
Requires-Dist: python-dotenv<2,>=1.0
|
|
16
16
|
Requires-Dist: tqdm<5,>=4.66
|
|
17
17
|
Requires-Dist: websocket-client<2,>=1.8
|
|
18
|
+
Provides-Extra: current-gate
|
|
19
|
+
Requires-Dist: huggingface-hub<2,>=0.28; extra == 'current-gate'
|
|
18
20
|
Provides-Extra: dev
|
|
19
21
|
Requires-Dist: pytest>=8; extra == 'dev'
|
|
20
22
|
Provides-Extra: local
|
|
21
|
-
Requires-Dist: armnet-runtime>=0.3.
|
|
23
|
+
Requires-Dist: armnet-runtime>=0.3.2; extra == 'local'
|
|
22
24
|
Provides-Extra: teleop
|
|
23
25
|
Requires-Dist: lerobot[feetech,smolvla]==0.5.1; extra == 'teleop'
|
|
24
26
|
Provides-Extra: viz
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "armnet-client"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.4"
|
|
8
8
|
description = "armnet client SDK \u2014 submit jobs to the platform from dev machines and CI."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.12,<3.13"
|
|
@@ -18,7 +18,7 @@ authors = [{ name = "Ville Kuosmanen" }]
|
|
|
18
18
|
# armnet-busybox is deliberately absent — an environment is installed in the
|
|
19
19
|
# runtime image that needs it, never on the submitting side.
|
|
20
20
|
dependencies = [
|
|
21
|
-
"armnet-core>=0.3.
|
|
21
|
+
"armnet-core>=0.3.2",
|
|
22
22
|
"pydantic>=2.6,<3",
|
|
23
23
|
"httpx>=0.27,<1",
|
|
24
24
|
"websocket-client>=1.8,<2",
|
|
@@ -40,13 +40,18 @@ dev = [
|
|
|
40
40
|
# Submitting jobs to a real cell does not \u2014 containers install the runtime
|
|
41
41
|
# themselves \u2014 which is why this is an extra and not a hard dependency.
|
|
42
42
|
local = [
|
|
43
|
-
"armnet-runtime>=0.3.
|
|
43
|
+
"armnet-runtime>=0.3.2",
|
|
44
44
|
]
|
|
45
45
|
# Live visualization: replays a job's ctx.log_rerun_data(...) stream into a
|
|
46
46
|
# Rerun viewer (execute(..., use_rerun=True) / init_rerun()).
|
|
47
47
|
viz = [
|
|
48
48
|
"rerun-sdk>=0.20,<1",
|
|
49
49
|
]
|
|
50
|
+
# Offline derivation of the arm-current safety profile downloads telemetry
|
|
51
|
+
# sidecars from Hugging Face datasets.
|
|
52
|
+
current-gate = [
|
|
53
|
+
"huggingface-hub>=0.28,<2",
|
|
54
|
+
]
|
|
50
55
|
# Remote teleoperation: drive a remote cell's robot from a locally-attached
|
|
51
56
|
# LeRobot leader arm (stream_job_teleop / TeleoperatorConfig).
|
|
52
57
|
teleop = [
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""SDK configuration.
|
|
2
|
+
|
|
3
|
+
The production orchestrator URL is built into the public SDK so normal users do
|
|
4
|
+
not configure infrastructure endpoints. ``DEBUG_ARMNET_ORCHESTRATOR_URI`` is
|
|
5
|
+
the single development/CI override for a locally running stack.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import os
|
|
11
|
+
|
|
12
|
+
from armnet_core import API_KEY_ENV
|
|
13
|
+
|
|
14
|
+
DEFAULT_ORCHESTRATOR_URL = "https://armnet-orchestrator-240868335442.europe-west2.run.app"
|
|
15
|
+
|
|
16
|
+
DEBUG_OVERRIDE_ENV = "DEBUG_ARMNET_ORCHESTRATOR_URI"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def orchestrator_url() -> str:
|
|
20
|
+
"""Resolve the orchestrator base URL.
|
|
21
|
+
|
|
22
|
+
Returns the env-var override if set, otherwise the SDK default.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
return os.environ.get(DEBUG_OVERRIDE_ENV) or DEFAULT_ORCHESTRATOR_URL
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def api_key() -> str | None:
|
|
29
|
+
"""Resolve the API key used for authenticated orchestrator requests."""
|
|
30
|
+
|
|
31
|
+
return os.environ.get(API_KEY_ENV)
|
|
@@ -29,6 +29,7 @@ from armnet_core import (
|
|
|
29
29
|
WhoAmI,
|
|
30
30
|
)
|
|
31
31
|
from armnet_client._config import api_key as default_api_key
|
|
32
|
+
from armnet_client._config import orchestrator_url
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
class OrchestratorError(RuntimeError):
|
|
@@ -48,20 +49,21 @@ class OrchestratorError(RuntimeError):
|
|
|
48
49
|
class OrchestratorClient:
|
|
49
50
|
"""Synchronous client for the orchestrator HTTP API.
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
Defaults to Armnet's production API and the ``ARMNET_API_KEY`` environment
|
|
53
|
+
variable. Pass ``base_url`` or ``api_key`` explicitly for development and
|
|
54
|
+
custom integrations.
|
|
53
55
|
"""
|
|
54
56
|
|
|
55
57
|
def __init__(
|
|
56
58
|
self,
|
|
57
|
-
base_url: str =
|
|
59
|
+
base_url: Optional[str] = None,
|
|
58
60
|
timeout: float = 30.0,
|
|
59
61
|
api_key: Optional[str] = None,
|
|
60
62
|
) -> None:
|
|
61
63
|
key = api_key if api_key is not None else default_api_key()
|
|
62
64
|
headers = {API_KEY_HEADER: key} if key else None
|
|
63
65
|
self._client = httpx.Client(
|
|
64
|
-
base_url=base_url.rstrip("/"),
|
|
66
|
+
base_url=(base_url or orchestrator_url()).rstrip("/"),
|
|
65
67
|
timeout=timeout,
|
|
66
68
|
headers=headers,
|
|
67
69
|
)
|
|
@@ -99,9 +101,13 @@ class OrchestratorClient:
|
|
|
99
101
|
_raise_for_status(resp)
|
|
100
102
|
return Job.model_validate(resp.json())
|
|
101
103
|
|
|
102
|
-
def list_jobs(
|
|
104
|
+
def list_jobs(
|
|
105
|
+
self, *, limit: int = 10, queued_only: bool = False
|
|
106
|
+
) -> list[Job]:
|
|
103
107
|
"""GET /jobs — the current user's most-recent jobs (newest first)."""
|
|
104
|
-
resp = self._client.get(
|
|
108
|
+
resp = self._client.get(
|
|
109
|
+
"/jobs", params={"limit": limit, "queued_only": queued_only}
|
|
110
|
+
)
|
|
105
111
|
_raise_for_status(resp)
|
|
106
112
|
return [Job.model_validate(item) for item in resp.json()]
|
|
107
113
|
|
|
@@ -11,12 +11,14 @@ from importlib import resources
|
|
|
11
11
|
from pathlib import Path
|
|
12
12
|
from typing import Any
|
|
13
13
|
|
|
14
|
-
from armnet_client.robot_telemetry.schema import CANONICAL_JOINTS,
|
|
14
|
+
from armnet_client.robot_telemetry.schema import (CANONICAL_JOINTS,
|
|
15
|
+
LIVE_GROUP_BITS)
|
|
15
16
|
|
|
16
17
|
CURRENT_BIT = 1 << LIVE_GROUP_BITS["current"]
|
|
17
18
|
DEFAULT_PERCENTILES = (95, 99)
|
|
18
19
|
DEFAULT_GATE_PERCENTILE = 99
|
|
19
|
-
|
|
20
|
+
# Cell configuration owns the gate; jobs request no percentile tightening by default.
|
|
21
|
+
DEFAULT_GATE_PERCENT_ABOVE = 0.0
|
|
20
22
|
DEFAULT_GATE_DURATION_MS = 200.0
|
|
21
23
|
# Joints whose baseline max is at or below this use max as the trip limit
|
|
22
24
|
# instead of percentile × (1 + percent_above). Catches near-zero joints like
|
|
@@ -168,7 +170,7 @@ def download_dataset_root(repo_id: str, *, cache_dir: Path | None = None) -> Pat
|
|
|
168
170
|
except ImportError as exc: # pragma: no cover - env dependent
|
|
169
171
|
raise ImportError(
|
|
170
172
|
"huggingface_hub is required to download datasets for current-gate "
|
|
171
|
-
"derivation; install
|
|
173
|
+
"derivation; install 'armnet-client[current-gate]'"
|
|
172
174
|
) from exc
|
|
173
175
|
kwargs: dict[str, Any] = {
|
|
174
176
|
"repo_id": repo_id,
|
|
@@ -262,9 +264,10 @@ def current_gate_config(
|
|
|
262
264
|
) -> dict | None:
|
|
263
265
|
"""Build the job-arg payload for the edge current gate.
|
|
264
266
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
267
|
+
Joints whose baseline max is at or below ``TINY_MAX_THRESHOLD`` use that
|
|
268
|
+
max as the trip limit instead. Pass ``percent_above <= 0`` (or ``None``)
|
|
269
|
+
to omit the optional job-level percentile tightening; the cell-owned edge
|
|
270
|
+
gate remains active.
|
|
268
271
|
"""
|
|
269
272
|
if percent_above is None or float(percent_above) <= 0.0:
|
|
270
273
|
return None
|
|
@@ -275,6 +278,7 @@ def current_gate_config(
|
|
|
275
278
|
raise ValueError("current gate duration must be greater than zero")
|
|
276
279
|
return {
|
|
277
280
|
"enabled": True,
|
|
281
|
+
"mode": "percentile",
|
|
278
282
|
"percentile": int(percentile),
|
|
279
283
|
"percent_above": percent,
|
|
280
284
|
"duration_ms": duration,
|
|
@@ -23,6 +23,7 @@ from armnet_client.eval_support.recovery import (
|
|
|
23
23
|
)
|
|
24
24
|
from armnet_client.eval_support.robot import (
|
|
25
25
|
SharedCameraRobot,
|
|
26
|
+
make_bimanual_yam_robot,
|
|
26
27
|
make_so101_robot,
|
|
27
28
|
partition_bimanual_cameras,
|
|
28
29
|
relative_target_limits,
|
|
@@ -40,6 +41,7 @@ __all__ = [
|
|
|
40
41
|
"SharedCameraRobot",
|
|
41
42
|
"create_eval_dataset",
|
|
42
43
|
"generate_eval_repo_id",
|
|
44
|
+
"make_bimanual_yam_robot",
|
|
43
45
|
"make_so101_robot",
|
|
44
46
|
"partition_bimanual_cameras",
|
|
45
47
|
"proxy_is_dead",
|
|
@@ -55,12 +55,13 @@ def create_eval_dataset(
|
|
|
55
55
|
vcodec: str = DEFAULT_VCODEC,
|
|
56
56
|
encoder_threads: int = DEFAULT_ENCODER_THREADS,
|
|
57
57
|
num_cameras: int = 1,
|
|
58
|
+
robot_type: str = "so-101",
|
|
58
59
|
) -> LeRobotDataset:
|
|
59
60
|
return LeRobotDataset.create(
|
|
60
61
|
repo_id=repo_id,
|
|
61
62
|
fps=fps,
|
|
62
63
|
root=str(Path("/tmp/eval_datasets") / repo_id),
|
|
63
|
-
robot_type=
|
|
64
|
+
robot_type=robot_type,
|
|
64
65
|
features=features,
|
|
65
66
|
use_videos=True,
|
|
66
67
|
streaming_encoding=streaming_encoding,
|
|
@@ -8,6 +8,7 @@ openpi runtime quietly kept a per-tick round trip the LeRobot one had dropped.
|
|
|
8
8
|
from __future__ import annotations
|
|
9
9
|
|
|
10
10
|
import logging
|
|
11
|
+
import math
|
|
11
12
|
from typing import Any
|
|
12
13
|
|
|
13
14
|
from lerobot.cameras import make_cameras_from_configs
|
|
@@ -17,6 +18,7 @@ from lerobot.utils.errors import DeviceNotConnectedError
|
|
|
17
18
|
|
|
18
19
|
from armnet_runtime.lerobot.import_swap import feetech_bus_is_remote
|
|
19
20
|
from armnet_runtime.lerobot.remote_feetech import expect_edge_relative_target_clamp
|
|
21
|
+
from armnet_runtime.lerobot.remote_yam import ACTION_KEYS as YAM_ACTION_KEYS
|
|
20
22
|
|
|
21
23
|
logger = logging.getLogger(__name__)
|
|
22
24
|
|
|
@@ -170,3 +172,166 @@ def make_so101_robot(ctx: Any, cameras: dict[str, Any] | None = None) -> Any:
|
|
|
170
172
|
)
|
|
171
173
|
)
|
|
172
174
|
return SharedCameraRobot(robot, shared_cameras) if shared_cameras else robot
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def _load_yam_follower_types() -> tuple[Any, Any]:
|
|
178
|
+
try:
|
|
179
|
+
from lerobot_robot_yam import YAMFollowerRobot, YAMFollowerRobotConfig
|
|
180
|
+
except ImportError as exc:
|
|
181
|
+
raise ImportError(
|
|
182
|
+
"bimanual-yam eval requires the lerobot-robot-yam plugin "
|
|
183
|
+
"(lerobot_robot_yam). Install it in the eval image from ARMNET_YAM_GIT_REF."
|
|
184
|
+
) from exc
|
|
185
|
+
return YAMFollowerRobot, YAMFollowerRobotConfig
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def _camera_hw(camera: Any) -> tuple[Any, Any, int]:
|
|
189
|
+
height = getattr(camera, "height", None)
|
|
190
|
+
width = getattr(camera, "width", None)
|
|
191
|
+
if isinstance(camera, dict):
|
|
192
|
+
height = camera.get("height", height)
|
|
193
|
+
width = camera.get("width", width)
|
|
194
|
+
return (height, width, 3)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def _prefixed_yam_scalars(side: str) -> dict[str, type]:
|
|
198
|
+
return {f"{side}_{key}": float for key in YAM_ACTION_KEYS}
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
class BimanualYAMRobot:
|
|
202
|
+
"""Two YAM followers with BiSO-style ``left_``/``right_`` feature prefixes."""
|
|
203
|
+
|
|
204
|
+
def __init__(self, left_arm: Any, right_arm: Any) -> None:
|
|
205
|
+
self.left_arm = left_arm
|
|
206
|
+
self.right_arm = right_arm
|
|
207
|
+
|
|
208
|
+
@property
|
|
209
|
+
def cameras(self) -> dict[str, Any]:
|
|
210
|
+
return {
|
|
211
|
+
**{f"left_{name}": camera for name, camera in self.left_arm.cameras.items()},
|
|
212
|
+
**{f"right_{name}": camera for name, camera in self.right_arm.cameras.items()},
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
@property
|
|
216
|
+
def is_connected(self) -> bool:
|
|
217
|
+
return bool(self.left_arm.is_connected and self.right_arm.is_connected)
|
|
218
|
+
|
|
219
|
+
@property
|
|
220
|
+
def is_calibrated(self) -> bool:
|
|
221
|
+
return True
|
|
222
|
+
|
|
223
|
+
@property
|
|
224
|
+
def action_features(self) -> dict[str, Any]:
|
|
225
|
+
return {**_prefixed_yam_scalars("left"), **_prefixed_yam_scalars("right")}
|
|
226
|
+
|
|
227
|
+
@property
|
|
228
|
+
def observation_features(self) -> dict[str, Any]:
|
|
229
|
+
features = dict(self.action_features)
|
|
230
|
+
for name, camera in self.left_arm.cameras.items():
|
|
231
|
+
features[f"left_{name}"] = _camera_hw(camera)
|
|
232
|
+
for name, camera in self.right_arm.cameras.items():
|
|
233
|
+
features[f"right_{name}"] = _camera_hw(camera)
|
|
234
|
+
return features
|
|
235
|
+
|
|
236
|
+
def connect(self, calibrate: bool = True) -> None:
|
|
237
|
+
self.left_arm.connect(calibrate=calibrate)
|
|
238
|
+
try:
|
|
239
|
+
self.right_arm.connect(calibrate=calibrate)
|
|
240
|
+
except Exception:
|
|
241
|
+
try:
|
|
242
|
+
self.left_arm.disconnect()
|
|
243
|
+
except Exception:
|
|
244
|
+
logger.exception(
|
|
245
|
+
"could not disconnect left YAM arm after right connect failure"
|
|
246
|
+
)
|
|
247
|
+
raise
|
|
248
|
+
|
|
249
|
+
def disconnect(self) -> None:
|
|
250
|
+
for side, arm in (("left", self.left_arm), ("right", self.right_arm)):
|
|
251
|
+
try:
|
|
252
|
+
arm.disconnect()
|
|
253
|
+
except Exception:
|
|
254
|
+
logger.exception("could not disconnect %s YAM arm", side)
|
|
255
|
+
|
|
256
|
+
def get_observation(self) -> dict[str, Any]:
|
|
257
|
+
observation: dict[str, Any] = {}
|
|
258
|
+
for side, arm in (("left", self.left_arm), ("right", self.right_arm)):
|
|
259
|
+
for key, value in arm.get_observation().items():
|
|
260
|
+
if key in YAM_ACTION_KEYS or key in arm.cameras:
|
|
261
|
+
observation[f"{side}_{key}"] = value
|
|
262
|
+
return observation
|
|
263
|
+
|
|
264
|
+
def send_action(self, action: dict[str, float]) -> dict[str, float]:
|
|
265
|
+
expected = set(self.action_features)
|
|
266
|
+
incoming = set(action)
|
|
267
|
+
if incoming != expected:
|
|
268
|
+
missing = sorted(expected - incoming)
|
|
269
|
+
extra = sorted(incoming - expected)
|
|
270
|
+
details = []
|
|
271
|
+
if missing:
|
|
272
|
+
details.append(f"missing {missing}")
|
|
273
|
+
if extra:
|
|
274
|
+
details.append(f"unexpected {extra}")
|
|
275
|
+
raise ValueError(
|
|
276
|
+
"bimanual-yam send_action requires exactly the 14 prefixed "
|
|
277
|
+
f"action keys ({'; '.join(details)})"
|
|
278
|
+
)
|
|
279
|
+
for key, value in action.items():
|
|
280
|
+
try:
|
|
281
|
+
finite = math.isfinite(value)
|
|
282
|
+
except TypeError as exc:
|
|
283
|
+
raise ValueError(
|
|
284
|
+
f"bimanual-yam action {key!r} must be a finite number, "
|
|
285
|
+
f"got {value!r}"
|
|
286
|
+
) from exc
|
|
287
|
+
if not finite:
|
|
288
|
+
raise ValueError(
|
|
289
|
+
f"bimanual-yam action {key!r} must be finite, got {value!r}"
|
|
290
|
+
)
|
|
291
|
+
left_action = {
|
|
292
|
+
key.removeprefix("left_"): value
|
|
293
|
+
for key, value in action.items()
|
|
294
|
+
if key.startswith("left_")
|
|
295
|
+
}
|
|
296
|
+
right_action = {
|
|
297
|
+
key.removeprefix("right_"): value
|
|
298
|
+
for key, value in action.items()
|
|
299
|
+
if key.startswith("right_")
|
|
300
|
+
}
|
|
301
|
+
sent_left = self.left_arm.send_action(left_action)
|
|
302
|
+
sent_right = self.right_arm.send_action(right_action)
|
|
303
|
+
return {
|
|
304
|
+
**{f"left_{key}": value for key, value in sent_left.items()},
|
|
305
|
+
**{f"right_{key}": value for key, value in sent_right.items()},
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
def make_bimanual_yam_robot(ctx: Any, cameras: dict[str, Any] | None = None) -> Any:
|
|
310
|
+
"""Build two YAM followers for a bimanual-yam cell."""
|
|
311
|
+
|
|
312
|
+
yam_robot_cls, yam_config_cls = _load_yam_follower_types()
|
|
313
|
+
cameras = ctx.camera_configs if cameras is None else cameras
|
|
314
|
+
arm_cameras, shared_cameras = partition_bimanual_cameras(cameras)
|
|
315
|
+
left = yam_robot_cls(
|
|
316
|
+
yam_config_cls(
|
|
317
|
+
port=ctx.cell.arm("left").robot_port,
|
|
318
|
+
cameras=arm_cameras["left"],
|
|
319
|
+
)
|
|
320
|
+
)
|
|
321
|
+
try:
|
|
322
|
+
right = yam_robot_cls(
|
|
323
|
+
yam_config_cls(
|
|
324
|
+
port=ctx.cell.arm("right").robot_port,
|
|
325
|
+
cameras=arm_cameras["right"],
|
|
326
|
+
)
|
|
327
|
+
)
|
|
328
|
+
except Exception:
|
|
329
|
+
try:
|
|
330
|
+
left.disconnect()
|
|
331
|
+
except Exception:
|
|
332
|
+
logger.exception(
|
|
333
|
+
"could not disconnect left YAM arm after right construct failure"
|
|
334
|
+
)
|
|
335
|
+
raise
|
|
336
|
+
robot = BimanualYAMRobot(left, right)
|
|
337
|
+
return SharedCameraRobot(robot, shared_cameras) if shared_cameras else robot
|
|
@@ -58,10 +58,10 @@ def execute(
|
|
|
58
58
|
Omit ``task`` to submit a task-less job: any cell of ``embodiment`` may run
|
|
59
59
|
it, regardless of the task it is configured for.
|
|
60
60
|
|
|
61
|
-
``allow_queue`` (default True):
|
|
62
|
-
|
|
63
|
-
with a non-terminal ``JobResult`` (status ``
|
|
64
|
-
|
|
61
|
+
``allow_queue`` (default True): the job is durably queued in JetStream. If
|
|
62
|
+
no cell claims it during the submission response window, this call returns
|
|
63
|
+
immediately with a non-terminal ``JobResult`` (status ``queued``) rather
|
|
64
|
+
than blocking. Set ``allow_queue=False``
|
|
65
65
|
for jobs that only make sense running right now (e.g. interactive
|
|
66
66
|
teleop/rerun): the orchestrator refuses to create the job (raising
|
|
67
67
|
:class:`~armnet_client.client.OrchestratorError`, HTTP 409) if it can't
|
|
@@ -19,6 +19,13 @@ from armnet_client.current_gate import (
|
|
|
19
19
|
current_gate_job_args,
|
|
20
20
|
)
|
|
21
21
|
from armnet_client.runtime_build import stage_armnet_packages
|
|
22
|
+
# No pre-flight here: this backend exposes no manual rail or brightness
|
|
23
|
+
# override to check, so every scenario it runs comes from the sampler.
|
|
24
|
+
from armnet_client.variation import (
|
|
25
|
+
DEFAULT_VARIATION_SEED,
|
|
26
|
+
normalize_variation_cli_args,
|
|
27
|
+
variation_job_args,
|
|
28
|
+
)
|
|
22
29
|
from armnet_client.volume import upload_to_cloud_volume
|
|
23
30
|
|
|
24
31
|
try:
|
|
@@ -66,6 +73,19 @@ class ArmnetConfig:
|
|
|
66
73
|
streaming_encoding: bool = True
|
|
67
74
|
vcodec: str = "libsvtav1"
|
|
68
75
|
encoder_threads: int = 2
|
|
76
|
+
# Perturb rail position and lighting a little each episode,
|
|
77
|
+
# so the score reflects how well the policy generalises rather than how well
|
|
78
|
+
# one pose was staged. Off by default: an unvaried eval is still the right
|
|
79
|
+
# measurement when comparing against earlier unvaried numbers.
|
|
80
|
+
variation: bool = False
|
|
81
|
+
# Optional per-family overrides. None inherits `variation`; setting just
|
|
82
|
+
# one True while variation is False varies only that family.
|
|
83
|
+
variation_rail: Optional[bool] = None
|
|
84
|
+
variation_lighting: Optional[bool] = None
|
|
85
|
+
# Fixes the perturbation sequence, so two policies meet the same scenes and
|
|
86
|
+
# a re-run reproduces. Only the device draws use it; the policy's own
|
|
87
|
+
# randomness stays on --seed.
|
|
88
|
+
variation_seed: int = DEFAULT_VARIATION_SEED
|
|
69
89
|
current_gate_percentile: int = DEFAULT_GATE_PERCENTILE
|
|
70
90
|
current_gate_percent_above: float = DEFAULT_GATE_PERCENT_ABOVE
|
|
71
91
|
current_gate_duration_ms: float = DEFAULT_GATE_DURATION_MS
|
|
@@ -83,6 +103,7 @@ def main() -> None:
|
|
|
83
103
|
_load_dotenv()
|
|
84
104
|
import sys
|
|
85
105
|
|
|
106
|
+
sys.argv[:] = normalize_variation_cli_args(sys.argv)
|
|
86
107
|
sys.argv[:] = _normalize_current_gate_cli_args(sys.argv)
|
|
87
108
|
_eval_main()
|
|
88
109
|
|
|
@@ -155,6 +176,12 @@ def submit_groot_eval(cfg: ArmnetGrootEvalPipelineConfig) -> None:
|
|
|
155
176
|
**({"record_dataset_repo_id": cfg.armnet.record_dataset_repo_id}
|
|
156
177
|
if cfg.armnet.record_dataset_repo_id else {}),
|
|
157
178
|
**({} if cfg.armnet.push_to_hub else {"no_push_to_hub": True}),
|
|
179
|
+
**variation_job_args(
|
|
180
|
+
cfg.armnet.variation,
|
|
181
|
+
cfg.armnet.variation_seed,
|
|
182
|
+
rail=cfg.armnet.variation_rail,
|
|
183
|
+
lighting=cfg.armnet.variation_lighting,
|
|
184
|
+
),
|
|
158
185
|
**current_gate_job_args(
|
|
159
186
|
cfg.armnet.current_gate_percentile,
|
|
160
187
|
cfg.armnet.current_gate_percent_above,
|