armnet-client 0.3.0__tar.gz → 0.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {armnet_client-0.3.0 → armnet_client-0.3.2}/.gitignore +4 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/PKG-INFO +1 -1
- {armnet_client-0.3.0 → armnet_client-0.3.2}/pyproject.toml +1 -1
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/eval_support/__init__.py +2 -0
- armnet_client-0.3.2/src/armnet_client/eval_support/rollout.py +15 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/groot_eval.py +2 -12
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/image.py +89 -1
- armnet_client-0.3.2/src/armnet_client/keypoint_capture.py +33 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/lerobot_eval.py +45 -73
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/lerobot_record.py +22 -23
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/lerobot_teleop.py +37 -20
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/openpi_eval.py +23 -34
- armnet_client-0.3.2/src/armnet_client/runtime_build.py +210 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/runtime_groot_eval/Dockerfile +11 -5
- armnet_client-0.3.2/src/armnet_client/runtime_lerobot_eval/.dockerignore +14 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/runtime_lerobot_eval/Dockerfile +10 -7
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/runtime_lerobot_eval/lerobot_eval_runtime.py +4 -1
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/runtime_lerobot_record/Dockerfile +11 -6
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/runtime_lerobot_record/lerobot_record_runtime.py +59 -4
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/runtime_lerobot_teleop/Dockerfile +11 -7
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/runtime_lerobot_teleop/lerobot_teleop_runtime.py +68 -7
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/runtime_openpi_eval/Dockerfile +12 -8
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/runtime_openpi_eval/openpi_eval_runtime.py +5 -2
- armnet_client-0.3.2/tests/test_eval_completion_grace.py +77 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/tests/test_groot_eval.py +7 -1
- armnet_client-0.3.2/tests/test_lerobot_eval_build_context.py +139 -0
- armnet_client-0.3.2/tests/test_lightbox_cli.py +80 -0
- armnet_client-0.3.2/tests/test_rail_cli.py +77 -0
- armnet_client-0.3.2/tests/test_record_finish_on_completion.py +180 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/tests/test_runtime_build_context.py +5 -3
- armnet_client-0.3.2/tests/test_teleop_finish_on_completion.py +192 -0
- armnet_client-0.3.0/src/armnet_client/runtime_build.py +0 -55
- armnet_client-0.3.0/src/armnet_client/runtime_lerobot_eval/.dockerignore +0 -23
- armnet_client-0.3.0/tests/test_lerobot_eval_build_context.py +0 -83
- armnet_client-0.3.0/tests/test_lightbox_cli.py +0 -34
- {armnet_client-0.3.0 → armnet_client-0.3.2}/LICENSE +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/README.md +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/__init__.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/_config.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/_credential_cache.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/cli.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/client.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/current_gate.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/current_gate_datasets.json +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/current_gate_profile.json +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/eval_support/dataset.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/eval_support/recovery.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/eval_support/robot.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/execute.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/instrumentation.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/lerobot_train.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/local.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/local_container.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/policy_eval.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/rerun_stream.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/robot_telemetry/__init__.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/robot_telemetry/inspect.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/robot_telemetry/schema.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/robot_telemetry/session.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/robot_telemetry/writer.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/runtime_groot_eval/groot_eval_runtime.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/runtime_lerobot_eval/diffusion_resolution_patch.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/runtime_lerobot_eval/install_molmoact2_plugin.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/runtime_lerobot_eval/state_guard.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/runtime_openpi_eval/state_guard.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/teleop_stream.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/src/armnet_client/volume.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/tests/fixtures/robot_telemetry_schema.json +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/tests/test_bimanual_lerobot.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/tests/test_cli_jobs.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/tests/test_current_gate.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/tests/test_eval_support.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/tests/test_execute_queue.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/tests/test_instrumentation_watch.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/tests/test_lerobot_eval_policy_device.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/tests/test_openpi_state_guard.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/tests/test_policy_eval.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/tests/test_robot_telemetry_cli.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/tests/test_robot_telemetry_inspect.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/tests/test_robot_telemetry_lean_schema.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/tests/test_robot_telemetry_runtime_integration.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/tests/test_robot_telemetry_schema.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/tests/test_robot_telemetry_session.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/tests/test_robot_telemetry_writer.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/tests/test_runtime_is_not_required.py +0 -0
- {armnet_client-0.3.0 → armnet_client-0.3.2}/tests/test_wait_interrupt_stop.py +0 -0
|
@@ -174,6 +174,10 @@ wandb
|
|
|
174
174
|
logfile.asc
|
|
175
175
|
armnet/robot_cell.json
|
|
176
176
|
|
|
177
|
+
# Rail servo current-profiling captures (bench artefacts; findings live in
|
|
178
|
+
# docs/plans/2026-08-10-rail-axis-bring-up-calibration.md)
|
|
179
|
+
armnet/rail-current-*.csv
|
|
180
|
+
|
|
177
181
|
# cpp
|
|
178
182
|
devel
|
|
179
183
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: armnet-client
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
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/
|
|
@@ -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.2"
|
|
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"
|
|
@@ -27,8 +27,10 @@ from armnet_client.eval_support.robot import (
|
|
|
27
27
|
partition_bimanual_cameras,
|
|
28
28
|
relative_target_limits,
|
|
29
29
|
)
|
|
30
|
+
from armnet_client.eval_support.rollout import DEFAULT_COMPLETION_GRACE_S
|
|
30
31
|
|
|
31
32
|
__all__ = [
|
|
33
|
+
"DEFAULT_COMPLETION_GRACE_S",
|
|
32
34
|
"DEFAULT_DEVICE_RECOVERY_S",
|
|
33
35
|
"DEFAULT_ENCODER_THREADS",
|
|
34
36
|
"DEFAULT_MAX_DEVICE_ABORTS",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Timing shared by every eval runtime's rollout loop."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
# How long to keep driving the policy after the environment has decided the
|
|
6
|
+
# episode, so a rollout ends on a finished motion rather than freezing on the
|
|
7
|
+
# frame the goal was met. The verdict is already latched, so this is never a
|
|
8
|
+
# second chance at the goal.
|
|
9
|
+
#
|
|
10
|
+
# One second, matching record and teleop. It used to be five here, which on a
|
|
11
|
+
# task decided the instant a button goes down — the press is an edge, so the
|
|
12
|
+
# verdict lands immediately — meant every rollout spent five seconds looking
|
|
13
|
+
# stalled after it was already over. Across a 20-rollout demo that is over a
|
|
14
|
+
# minute and a half of watching nothing happen.
|
|
15
|
+
DEFAULT_COMPLETION_GRACE_S = 1.0
|
|
@@ -18,6 +18,7 @@ from armnet_client.current_gate import (
|
|
|
18
18
|
DEFAULT_GATE_PERCENTILE,
|
|
19
19
|
current_gate_job_args,
|
|
20
20
|
)
|
|
21
|
+
from armnet_client.runtime_build import stage_armnet_packages
|
|
21
22
|
from armnet_client.volume import upload_to_cloud_volume
|
|
22
23
|
|
|
23
24
|
try:
|
|
@@ -197,23 +198,12 @@ class _RuntimeBuildContext:
|
|
|
197
198
|
for name in ("Dockerfile", "groot_eval_runtime.py"):
|
|
198
199
|
with resources.as_file(package_root / name) as path:
|
|
199
200
|
shutil.copy2(path, root / name)
|
|
200
|
-
|
|
201
|
-
if repo_root is not None:
|
|
202
|
-
shutil.copytree(repo_root / "core", root / "core")
|
|
203
|
-
shutil.copytree(repo_root / "runtime", root / "runtime")
|
|
201
|
+
stage_armnet_packages(root, ("core", "runtime"))
|
|
204
202
|
return root
|
|
205
203
|
|
|
206
204
|
def __exit__(self, *_exc) -> None:
|
|
207
205
|
self._tmp.cleanup()
|
|
208
206
|
|
|
209
207
|
|
|
210
|
-
def _find_repo_root() -> Path | None:
|
|
211
|
-
for parent in [Path.cwd(), *Path.cwd().parents]:
|
|
212
|
-
candidate = parent / "core" / "src" / "armnet_core"
|
|
213
|
-
if candidate.exists() and (parent / "runtime" / "src" / "armnet_runtime").exists():
|
|
214
|
-
return parent
|
|
215
|
-
return None
|
|
216
|
-
|
|
217
|
-
|
|
218
208
|
if __name__ == "__main__":
|
|
219
209
|
main()
|
|
@@ -60,6 +60,24 @@ _HASH_SKIP_DIRS = {
|
|
|
60
60
|
"node_modules",
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
# What a registry manifest may be, for the existence check. A multi-arch push
|
|
64
|
+
# lands as an index rather than a manifest, so asking only for the latter reads
|
|
65
|
+
# an image that is there as missing.
|
|
66
|
+
_MANIFEST_MEDIA_TYPES = (
|
|
67
|
+
"application/vnd.docker.distribution.manifest.v2+json",
|
|
68
|
+
"application/vnd.docker.distribution.manifest.list.v2+json",
|
|
69
|
+
"application/vnd.oci.image.manifest.v1+json",
|
|
70
|
+
"application/vnd.oci.image.index.v1+json",
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
_REGISTRY_TIMEOUT_S = 30.0
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def _tag_for(name: str, build_hash: str) -> str:
|
|
77
|
+
"""The local tag for a built image: shared so a predicted ref cannot drift."""
|
|
78
|
+
|
|
79
|
+
return f"{name}:armnet-{build_hash[:12]}"
|
|
80
|
+
|
|
63
81
|
|
|
64
82
|
class ImageBuildError(RuntimeError):
|
|
65
83
|
"""Raised when ``docker build`` fails."""
|
|
@@ -99,6 +117,76 @@ class Image:
|
|
|
99
117
|
def from_ref(cls, ref: str) -> "Image":
|
|
100
118
|
return cls(ref=ref)
|
|
101
119
|
|
|
120
|
+
@classmethod
|
|
121
|
+
def planned_ref(
|
|
122
|
+
cls,
|
|
123
|
+
dockerfile: Union[str, Path],
|
|
124
|
+
name: str,
|
|
125
|
+
context_dir: Union[str, Path, None] = None,
|
|
126
|
+
*,
|
|
127
|
+
platform: Optional[str] = None,
|
|
128
|
+
build_contexts: Optional[Mapping[str, Union[str, Path]]] = None,
|
|
129
|
+
) -> str:
|
|
130
|
+
"""The registry ref :meth:`build` then :meth:`push` would produce.
|
|
131
|
+
|
|
132
|
+
Worked out from the source alone: the tag is a hash of the build
|
|
133
|
+
context, so the answer needs no Docker daemon and no build. It does
|
|
134
|
+
need the registry credentials, since only they say which namespace the
|
|
135
|
+
image lands in.
|
|
136
|
+
|
|
137
|
+
This is what lets a caller ask "is this already pushed?" before
|
|
138
|
+
spending twenty minutes producing a byte-identical image.
|
|
139
|
+
"""
|
|
140
|
+
|
|
141
|
+
dockerfile_path = Path(dockerfile).resolve()
|
|
142
|
+
if not dockerfile_path.is_file():
|
|
143
|
+
raise FileNotFoundError(f"Dockerfile not found: {dockerfile_path}")
|
|
144
|
+
context_path = (
|
|
145
|
+
Path(context_dir).resolve() if context_dir is not None else dockerfile_path.parent
|
|
146
|
+
)
|
|
147
|
+
if not context_path.is_dir():
|
|
148
|
+
raise FileNotFoundError(f"build context not found: {context_path}")
|
|
149
|
+
resolved_build_contexts = {
|
|
150
|
+
ctx_name: Path(ctx_path).resolve()
|
|
151
|
+
for ctx_name, ctx_path in (build_contexts or {}).items()
|
|
152
|
+
}
|
|
153
|
+
build_hash = _compute_build_hash(
|
|
154
|
+
dockerfile_path,
|
|
155
|
+
context_path,
|
|
156
|
+
platform=platform or os.environ.get("ARMNET_DOCKER_PLATFORM"),
|
|
157
|
+
build_contexts=resolved_build_contexts,
|
|
158
|
+
)
|
|
159
|
+
creds = _get_or_fetch_credentials()
|
|
160
|
+
return f"{creds.registry}/{creds.namespace}/{_tag_for(name, build_hash)}"
|
|
161
|
+
|
|
162
|
+
@staticmethod
|
|
163
|
+
def exists_in_registry(ref: str) -> bool:
|
|
164
|
+
"""Whether ``ref`` is already in the registry.
|
|
165
|
+
|
|
166
|
+
Asks the registry's manifest endpoint directly with the same
|
|
167
|
+
short-lived token a push would use, so it costs one request and needs
|
|
168
|
+
no Docker.
|
|
169
|
+
"""
|
|
170
|
+
|
|
171
|
+
registry, _, repository_and_tag = ref.partition("/")
|
|
172
|
+
repository, _, tag = repository_and_tag.rpartition(":")
|
|
173
|
+
if not registry or not repository or not tag:
|
|
174
|
+
raise ValueError(f"not a registry ref: {ref!r}")
|
|
175
|
+
creds = _get_or_fetch_credentials()
|
|
176
|
+
response = httpx.head(
|
|
177
|
+
f"https://{registry}/v2/{repository}/manifests/{tag}",
|
|
178
|
+
headers={
|
|
179
|
+
"Authorization": f"Bearer {creds.password}",
|
|
180
|
+
"Accept": ", ".join(_MANIFEST_MEDIA_TYPES),
|
|
181
|
+
},
|
|
182
|
+
timeout=_REGISTRY_TIMEOUT_S,
|
|
183
|
+
follow_redirects=True,
|
|
184
|
+
)
|
|
185
|
+
if response.status_code == 404:
|
|
186
|
+
return False
|
|
187
|
+
response.raise_for_status()
|
|
188
|
+
return True
|
|
189
|
+
|
|
102
190
|
def push(self, *, if_possible: bool = False) -> "Image":
|
|
103
191
|
"""Push this image to the platform's registry; return a new Image
|
|
104
192
|
whose ref points at the registry.
|
|
@@ -215,7 +303,7 @@ class Image:
|
|
|
215
303
|
platform=platform,
|
|
216
304
|
build_contexts=resolved_build_contexts,
|
|
217
305
|
)
|
|
218
|
-
tag =
|
|
306
|
+
tag = _tag_for(name, build_hash)
|
|
219
307
|
|
|
220
308
|
resolved_cache_from, resolved_cache_to = _resolve_buildx_cache(
|
|
221
309
|
name, cache_from, cache_to
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""Helpers for teleop keypoint capture (manual and interval)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def parse_capture_interval_s(raw: Any) -> float | None:
|
|
9
|
+
"""Job-arg / CLI value → positive seconds, or None when disabled."""
|
|
10
|
+
if raw is None:
|
|
11
|
+
return None
|
|
12
|
+
try:
|
|
13
|
+
interval = float(raw)
|
|
14
|
+
except (TypeError, ValueError):
|
|
15
|
+
return None
|
|
16
|
+
if interval <= 0:
|
|
17
|
+
return None
|
|
18
|
+
return interval
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def interval_capture_due(
|
|
22
|
+
now: float, last_capture_at: float | None, interval_s: float | None
|
|
23
|
+
) -> bool:
|
|
24
|
+
"""True when an interval capture should fire at ``now``.
|
|
25
|
+
|
|
26
|
+
First sample is due as soon as interval capture is enabled (caller still
|
|
27
|
+
gates on having a teleop action). Later samples wait ``interval_s``.
|
|
28
|
+
"""
|
|
29
|
+
if interval_s is None:
|
|
30
|
+
return False
|
|
31
|
+
if last_capture_at is None:
|
|
32
|
+
return True
|
|
33
|
+
return (now - last_capture_at) >= interval_s
|
|
@@ -5,7 +5,6 @@ import os
|
|
|
5
5
|
import shutil
|
|
6
6
|
import sys
|
|
7
7
|
import tempfile
|
|
8
|
-
import tomllib
|
|
9
8
|
from dataclasses import dataclass, field
|
|
10
9
|
from importlib import resources
|
|
11
10
|
from pathlib import Path
|
|
@@ -22,7 +21,7 @@ from armnet_client.current_gate import (
|
|
|
22
21
|
DEFAULT_GATE_PERCENTILE,
|
|
23
22
|
current_gate_job_args,
|
|
24
23
|
)
|
|
25
|
-
from armnet_client.runtime_build import stage_client_modules
|
|
24
|
+
from armnet_client.runtime_build import stage_armnet_packages, stage_client_modules
|
|
26
25
|
from armnet_client.volume import upload_to_cloud_volume
|
|
27
26
|
|
|
28
27
|
logger = logging.getLogger(__name__)
|
|
@@ -63,26 +62,28 @@ class ArmnetConfig:
|
|
|
63
62
|
streaming_encoding: bool = True
|
|
64
63
|
vcodec: str = "libsvtav1"
|
|
65
64
|
encoder_threads: int = 2
|
|
66
|
-
# Knob detent the workspace reset leaves the BusyBox on. The knob is a relative
|
|
67
|
-
# encoder with no absolute position, so without this a knob goal reports as
|
|
68
|
-
# unscorable rather than being guessed at. Ignored on cells without a box.
|
|
69
|
-
busybox_knob_home: Optional[int] = None
|
|
70
65
|
# Seconds the policy keeps being driven after the box decides an episode, so
|
|
71
66
|
# a rollout ends on a finished motion instead of freezing the instant the
|
|
72
67
|
# last button goes down. The verdict is already latched; this does not give
|
|
73
68
|
# the policy a second chance. 0 ends the episode immediately.
|
|
74
|
-
|
|
75
|
-
#
|
|
76
|
-
#
|
|
77
|
-
|
|
78
|
-
|
|
69
|
+
# Keep in step with eval_support.DEFAULT_COMPLETION_GRACE_S, which applies to
|
|
70
|
+
# submissions that do not send this at all (importing it here would drag
|
|
71
|
+
# lerobot into the client).
|
|
72
|
+
completion_grace_s: float = 1.0
|
|
73
|
+
# Ask an operator to confirm every workspace reset. An instrumented cell
|
|
74
|
+
# otherwise restores the scene itself wherever it can: replaying a motion
|
|
75
|
+
# plan, or skipping the reset for a goal made only of button presses.
|
|
76
|
+
disable_automated_reset: bool = False
|
|
79
77
|
# Override cell lightbox brightness for the run, percent 0-100. None uses
|
|
80
78
|
# the cell JSON default; ignored on cells without a lightbox.
|
|
81
|
-
|
|
82
|
-
#
|
|
83
|
-
#
|
|
84
|
-
|
|
85
|
-
|
|
79
|
+
lightbox_brightness: Optional[int] = None
|
|
80
|
+
# Override cell lightbox PWM frequency for the run, Hz. None uses the cell
|
|
81
|
+
# JSON default; ignored on cells without a lightbox.
|
|
82
|
+
lightbox_frequency: Optional[int] = None
|
|
83
|
+
# Position of the cell's rail axis (7th-axis slide) for the run, fraction
|
|
84
|
+
# 0..1 of the usable rail. None leaves the slide untouched; ignored on
|
|
85
|
+
# cells without a rail (the edge pings servo id 7 to find out).
|
|
86
|
+
rail: Optional[float] = None
|
|
86
87
|
robot_telemetry: Literal["off", "context", "safety", "full"] = "full"
|
|
87
88
|
robot_telemetry_strict: bool = False
|
|
88
89
|
current_gate_percentile: Literal[95, 99] = DEFAULT_GATE_PERCENTILE
|
|
@@ -151,12 +152,7 @@ def _eval_main(cfg: ArmnetEvalPipelineConfig) -> None:
|
|
|
151
152
|
)
|
|
152
153
|
policy_path = f"volume://{cfg.armnet.volume_policy_path}"
|
|
153
154
|
|
|
154
|
-
|
|
155
|
-
image = Image.build(
|
|
156
|
-
dockerfile=context_dir / "Dockerfile",
|
|
157
|
-
context_dir=context_dir,
|
|
158
|
-
name=_IMAGE_NAME,
|
|
159
|
-
).push()
|
|
155
|
+
image = build_eval_image()
|
|
160
156
|
|
|
161
157
|
policy_device = _resolve_remote_policy_device(str(cfg.policy.device))
|
|
162
158
|
|
|
@@ -187,14 +183,14 @@ def _eval_main(cfg: ArmnetEvalPipelineConfig) -> None:
|
|
|
187
183
|
if cfg.armnet.robot_telemetry_strict
|
|
188
184
|
else {}
|
|
189
185
|
),
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
"
|
|
193
|
-
|
|
194
|
-
**({"
|
|
195
|
-
if cfg.armnet.
|
|
196
|
-
**({"
|
|
197
|
-
if cfg.armnet.
|
|
186
|
+
"completion_grace_s": max(0.0, float(cfg.armnet.completion_grace_s)),
|
|
187
|
+
**({"disable_automated_reset": True} if cfg.armnet.disable_automated_reset else {}),
|
|
188
|
+
**({"lightbox_brightness": int(cfg.armnet.lightbox_brightness)}
|
|
189
|
+
if cfg.armnet.lightbox_brightness is not None else {}),
|
|
190
|
+
**({"lightbox_frequency": int(cfg.armnet.lightbox_frequency)}
|
|
191
|
+
if cfg.armnet.lightbox_frequency is not None else {}),
|
|
192
|
+
**({"rail_position": max(0.0, min(1.0, float(cfg.armnet.rail)))}
|
|
193
|
+
if cfg.armnet.rail is not None else {}),
|
|
198
194
|
**({"hf_user": cfg.armnet.hf_user}
|
|
199
195
|
if cfg.armnet.hf_user else {}),
|
|
200
196
|
},
|
|
@@ -258,6 +254,24 @@ def _normalize_telemetry_cli_args(argv: list[str]) -> list[str]:
|
|
|
258
254
|
return normalized
|
|
259
255
|
|
|
260
256
|
|
|
257
|
+
def build_eval_image() -> Image:
|
|
258
|
+
"""Build the lerobot-eval runtime image and push it to the registry.
|
|
259
|
+
|
|
260
|
+
Takes nothing from a job. The policy is loaded at runtime from a repo id, so
|
|
261
|
+
one image serves every eval, and the tag is a hash of the build context —
|
|
262
|
+
same source, same ref, whichever machine builds it. That is what lets CI
|
|
263
|
+
build this without a robot, and what the demo Space points its
|
|
264
|
+
``ARMNET_DEMO_EVAL_IMAGE`` at.
|
|
265
|
+
"""
|
|
266
|
+
|
|
267
|
+
with _runtime_build_context() as context_dir:
|
|
268
|
+
return Image.build(
|
|
269
|
+
dockerfile=context_dir / "Dockerfile",
|
|
270
|
+
context_dir=context_dir,
|
|
271
|
+
name=_IMAGE_NAME,
|
|
272
|
+
).push()
|
|
273
|
+
|
|
274
|
+
|
|
261
275
|
def _runtime_build_context():
|
|
262
276
|
return _RuntimeBuildContext()
|
|
263
277
|
|
|
@@ -280,54 +294,12 @@ class _RuntimeBuildContext:
|
|
|
280
294
|
root,
|
|
281
295
|
("robot_telemetry", "eval_support", "runtime_lerobot_eval.state_guard"),
|
|
282
296
|
)
|
|
283
|
-
|
|
284
|
-
if repo_root is not None:
|
|
285
|
-
dependencies: list[str] = []
|
|
286
|
-
for package in ("core", "runtime", "busybox"):
|
|
287
|
-
source = repo_root / package
|
|
288
|
-
_copy_runtime_package(source, root / package)
|
|
289
|
-
project = tomllib.loads(
|
|
290
|
-
(source / "pyproject.toml").read_text()
|
|
291
|
-
)["project"]
|
|
292
|
-
dependencies.extend(
|
|
293
|
-
dependency
|
|
294
|
-
for dependency in project.get("dependencies", [])
|
|
295
|
-
if not dependency.startswith("armnet-")
|
|
296
|
-
)
|
|
297
|
-
(root / "armnet-package-requirements.txt").write_text(
|
|
298
|
-
"\n".join(dict.fromkeys(dependencies)) + "\n"
|
|
299
|
-
)
|
|
297
|
+
stage_armnet_packages(root, ("core", "runtime", "busybox"))
|
|
300
298
|
return root
|
|
301
299
|
|
|
302
300
|
def __exit__(self, *_exc) -> None:
|
|
303
301
|
self._tmp.cleanup()
|
|
304
302
|
|
|
305
303
|
|
|
306
|
-
def _copy_runtime_package(source: Path, destination: Path) -> None:
|
|
307
|
-
"""Copy only files that can affect an installed runtime package."""
|
|
308
|
-
|
|
309
|
-
destination.mkdir()
|
|
310
|
-
shutil.copy2(source / "pyproject.toml", destination / "pyproject.toml")
|
|
311
|
-
if (source / "README.md").is_file():
|
|
312
|
-
# Hatchling requires declared readmes to exist, but documentation content
|
|
313
|
-
# does not affect the package executed in the cell.
|
|
314
|
-
(destination / "README.md").write_text(
|
|
315
|
-
f"# {source.name}\n\nRuntime image package.\n"
|
|
316
|
-
)
|
|
317
|
-
shutil.copytree(
|
|
318
|
-
source / "src",
|
|
319
|
-
destination / "src",
|
|
320
|
-
ignore=shutil.ignore_patterns("__pycache__", "*.pyc"),
|
|
321
|
-
)
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
def _find_repo_root() -> Path | None:
|
|
325
|
-
for parent in [Path.cwd(), *Path.cwd().parents]:
|
|
326
|
-
candidate = parent / "core" / "src" / "armnet_core"
|
|
327
|
-
if candidate.exists() and (parent / "runtime" / "src" / "armnet_runtime").exists():
|
|
328
|
-
return parent
|
|
329
|
-
return None
|
|
330
|
-
|
|
331
|
-
|
|
332
304
|
if __name__ == "__main__":
|
|
333
305
|
main()
|
|
@@ -52,7 +52,7 @@ from armnet_client import (
|
|
|
52
52
|
stream_job_teleop,
|
|
53
53
|
)
|
|
54
54
|
from armnet_client._config import orchestrator_url
|
|
55
|
-
from armnet_client.runtime_build import stage_client_modules
|
|
55
|
+
from armnet_client.runtime_build import stage_armnet_packages, stage_client_modules
|
|
56
56
|
from armnet_client.current_gate import (
|
|
57
57
|
DEFAULT_GATE_DURATION_MS,
|
|
58
58
|
DEFAULT_GATE_PERCENT_ABOVE,
|
|
@@ -145,10 +145,12 @@ def _parse_args(argv: list[str] | None = None) -> argparse.Namespace:
|
|
|
145
145
|
),
|
|
146
146
|
)
|
|
147
147
|
# Same option names as armnet-lerobot-eval / armnet-openpi-eval.
|
|
148
|
-
parser.add_argument("--
|
|
149
|
-
parser.add_argument("--
|
|
150
|
-
parser.add_argument("--
|
|
151
|
-
parser.add_argument("--
|
|
148
|
+
parser.add_argument("--armnet.disable-automated-reset", dest="disable_automated_reset", action="store_true", help="Ask an operator to confirm every workspace reset. An instrumented cell otherwise restores the scene itself wherever it can — replaying a motion plan, or skipping the reset entirely for a goal made only of button presses, which spring back on their own")
|
|
149
|
+
parser.add_argument("--armnet.finish-on-task-completion", dest="finish_on_task_completion", action="store_true", help="End an episode as soon as the cell's environment scores the task complete. Off by default: you end episodes yourself with the arrow keys")
|
|
150
|
+
parser.add_argument("--armnet.completion-grace-s", dest="completion_grace_s", type=float, default=None, help="Seconds to keep recording after the task is scored complete, so the episode ends on you bringing the arm clear rather than on the frame the goal was met (default 1). Only used with --armnet.finish-on-task-completion; 0 ends the episode immediately")
|
|
151
|
+
parser.add_argument("--lightbox-brightness", dest="lightbox_brightness", type=_lightbox_pct, default=None, help="Override cell lightbox brightness for the session, percent 0-100. Omit to use the cell JSON default. Ignored on cells without a lightbox")
|
|
152
|
+
parser.add_argument("--lightbox-frequency", dest="lightbox_frequency", type=_lightbox_hz, default=None, help="Override cell lightbox PWM frequency for the session, Hz. Omit to use the cell JSON default. Ignored on cells without a lightbox")
|
|
153
|
+
parser.add_argument("--rail", dest="rail", type=float, default=None, help="Position the cell's rail axis (7th-axis slide) before the session, fraction 0..1 of the usable rail. Omit to leave it where it is; ignored on cells without a rail")
|
|
152
154
|
parser.add_argument("--armnet.embodiment", dest="embodiment", default="lerobot/so-101", help="Robot embodiment (default lerobot/so-101)")
|
|
153
155
|
parser.add_argument("--armnet.task", dest="task", default=None, help="Cell task slug; omit to let any cell of the embodiment pick the job up")
|
|
154
156
|
parser.add_argument(
|
|
@@ -180,6 +182,13 @@ def _lightbox_pct(value: str) -> int:
|
|
|
180
182
|
return pct
|
|
181
183
|
|
|
182
184
|
|
|
185
|
+
def _lightbox_hz(value: str) -> int:
|
|
186
|
+
hz = int(value)
|
|
187
|
+
if hz <= 0:
|
|
188
|
+
raise argparse.ArgumentTypeError("lightbox frequency must be a positive integer (Hz)")
|
|
189
|
+
return hz
|
|
190
|
+
|
|
191
|
+
|
|
183
192
|
def _parse_secrets(pairs: list[str]) -> dict[str, str]:
|
|
184
193
|
secrets: dict[str, str] = {}
|
|
185
194
|
for pair in pairs:
|
|
@@ -242,11 +251,13 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
242
251
|
**({"no_push_to_hub": True} if args.no_push_to_hub else {}),
|
|
243
252
|
**({"private_to_hub": True} if args.private_to_hub else {}),
|
|
244
253
|
**({"resume": True} if args.resume else {}),
|
|
245
|
-
**({"
|
|
246
|
-
|
|
247
|
-
**({"
|
|
248
|
-
|
|
249
|
-
**({"
|
|
254
|
+
**({"disable_automated_reset": True} if args.disable_automated_reset else {}),
|
|
255
|
+
**({"finish_on_task_completion": True} if args.finish_on_task_completion else {}),
|
|
256
|
+
**({"completion_grace_s": max(0.0, args.completion_grace_s)}
|
|
257
|
+
if args.completion_grace_s is not None else {}),
|
|
258
|
+
**({"lightbox_brightness": args.lightbox_brightness} if args.lightbox_brightness is not None else {}),
|
|
259
|
+
**({"lightbox_frequency": args.lightbox_frequency} if args.lightbox_frequency is not None else {}),
|
|
260
|
+
**({"rail_position": max(0.0, min(1.0, args.rail))} if args.rail is not None else {}),
|
|
250
261
|
},
|
|
251
262
|
secrets=_parse_secrets(args.secret),
|
|
252
263
|
timeout_seconds=timeout_seconds,
|
|
@@ -337,24 +348,12 @@ class _RuntimeBuildContext:
|
|
|
337
348
|
stage_client_modules(
|
|
338
349
|
root, ("robot_telemetry", "eval_support", "instrumentation")
|
|
339
350
|
)
|
|
340
|
-
|
|
341
|
-
if repo_root is not None:
|
|
342
|
-
shutil.copytree(repo_root / "core", root / "core")
|
|
343
|
-
shutil.copytree(repo_root / "runtime", root / "runtime")
|
|
344
|
-
shutil.copytree(repo_root / "busybox", root / "busybox")
|
|
351
|
+
stage_armnet_packages(root, ("core", "runtime", "busybox"))
|
|
345
352
|
return root
|
|
346
353
|
|
|
347
354
|
def __exit__(self, *_exc) -> None:
|
|
348
355
|
self._tmp.cleanup()
|
|
349
356
|
|
|
350
357
|
|
|
351
|
-
def _find_repo_root() -> Path | None:
|
|
352
|
-
for parent in [Path.cwd(), *Path.cwd().parents]:
|
|
353
|
-
candidate = parent / "core" / "src" / "armnet_core"
|
|
354
|
-
if candidate.exists() and (parent / "runtime" / "src" / "armnet_runtime").exists():
|
|
355
|
-
return parent
|
|
356
|
-
return None
|
|
357
|
-
|
|
358
|
-
|
|
359
358
|
if __name__ == "__main__":
|
|
360
359
|
sys.exit(main())
|
|
@@ -43,7 +43,7 @@ from armnet_client import (
|
|
|
43
43
|
stream_job_teleop,
|
|
44
44
|
)
|
|
45
45
|
from armnet_client._config import orchestrator_url
|
|
46
|
-
from armnet_client.runtime_build import stage_client_modules
|
|
46
|
+
from armnet_client.runtime_build import stage_armnet_packages, stage_client_modules
|
|
47
47
|
from armnet_client.current_gate import (
|
|
48
48
|
DEFAULT_GATE_DURATION_MS,
|
|
49
49
|
DEFAULT_GATE_PERCENT_ABOVE,
|
|
@@ -91,6 +91,8 @@ def _parse_args(argv: list[str] | None = None) -> argparse.Namespace:
|
|
|
91
91
|
parser.add_argument("--armnet.task", dest="task", default=None, help="Cell task slug; omit to let any cell of the embodiment pick the job up")
|
|
92
92
|
parser.add_argument("--armnet.fps", dest="fps", type=int, default=20, help="Follower control rate on the cell in Hz (default 20)")
|
|
93
93
|
parser.add_argument("--armnet.duration_s", dest="duration_s", type=float, default=300.0, help="How long to teleoperate, in seconds (default 300)")
|
|
94
|
+
parser.add_argument("--armnet.finish-on-task-completion", dest="finish_on_task_completion", action="store_true", help="Stop once the cell's environment scores the task complete. Off by default: teleop runs for the full duration whatever the workspace reports")
|
|
95
|
+
parser.add_argument("--armnet.completion-grace-s", dest="completion_grace_s", type=float, default=None, help="Seconds to keep teleoperating after the task is scored complete, leaving time to bring the arm back (default 1). Only used with --armnet.finish-on-task-completion; 0 stops immediately")
|
|
94
96
|
parser.add_argument(
|
|
95
97
|
"--current-gate-percentile",
|
|
96
98
|
type=int,
|
|
@@ -116,8 +118,19 @@ def _parse_args(argv: list[str] | None = None) -> argparse.Namespace:
|
|
|
116
118
|
f"(default: {DEFAULT_GATE_DURATION_MS:g})"
|
|
117
119
|
),
|
|
118
120
|
)
|
|
119
|
-
parser.add_argument("--lightbox", dest="
|
|
120
|
-
parser.add_argument("--
|
|
121
|
+
parser.add_argument("--lightbox-brightness", dest="lightbox_brightness", type=_lightbox_pct, default=None, help="Override cell lightbox brightness for the session, percent 0-100. Omit to use the cell JSON default. Ignored on cells without a lightbox")
|
|
122
|
+
parser.add_argument("--lightbox-frequency", dest="lightbox_frequency", type=_lightbox_hz, default=None, help="Override cell lightbox PWM frequency for the session, Hz. Omit to use the cell JSON default. Ignored on cells without a lightbox")
|
|
123
|
+
parser.add_argument("--rail", dest="rail", type=float, default=None, help="Position the cell's rail axis (7th-axis slide) before the session, fraction 0..1 of the usable rail. Omit to leave it where it is; ignored on cells without a rail")
|
|
124
|
+
parser.add_argument(
|
|
125
|
+
"--capture-interval-s",
|
|
126
|
+
dest="capture_interval_s",
|
|
127
|
+
type=float,
|
|
128
|
+
default=None,
|
|
129
|
+
help=(
|
|
130
|
+
"Auto-print a teleop keypoint every N seconds while the leader is "
|
|
131
|
+
"commanding (Right Arrow still works). Omit or <=0 disables."
|
|
132
|
+
),
|
|
133
|
+
)
|
|
121
134
|
parser.add_argument(
|
|
122
135
|
"--secret",
|
|
123
136
|
action="append",
|
|
@@ -147,6 +160,13 @@ def _lightbox_pct(value: str) -> int:
|
|
|
147
160
|
return pct
|
|
148
161
|
|
|
149
162
|
|
|
163
|
+
def _lightbox_hz(value: str) -> int:
|
|
164
|
+
hz = int(value)
|
|
165
|
+
if hz <= 0:
|
|
166
|
+
raise argparse.ArgumentTypeError("lightbox frequency must be a positive integer (Hz)")
|
|
167
|
+
return hz
|
|
168
|
+
|
|
169
|
+
|
|
150
170
|
def _parse_secrets(pairs: list[str]) -> dict[str, str]:
|
|
151
171
|
secrets: dict[str, str] = {}
|
|
152
172
|
for pair in pairs:
|
|
@@ -183,13 +203,22 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
183
203
|
"fps": args.fps,
|
|
184
204
|
"use_rerun": True,
|
|
185
205
|
"calibrate": False,
|
|
186
|
-
**({"lightbox_brightness": args.
|
|
206
|
+
**({"lightbox_brightness": args.lightbox_brightness} if args.lightbox_brightness is not None else {}),
|
|
207
|
+
**({"lightbox_frequency": args.lightbox_frequency} if args.lightbox_frequency is not None else {}),
|
|
187
208
|
**current_gate_job_args(
|
|
188
209
|
args.current_gate_percentile,
|
|
189
210
|
args.current_gate_percent_above,
|
|
190
211
|
args.current_gate_duration_ms,
|
|
191
212
|
),
|
|
192
|
-
**({"
|
|
213
|
+
**({"rail_position": max(0.0, min(1.0, args.rail))} if args.rail is not None else {}),
|
|
214
|
+
**({"finish_on_task_completion": True} if args.finish_on_task_completion else {}),
|
|
215
|
+
**({"completion_grace_s": max(0.0, args.completion_grace_s)}
|
|
216
|
+
if args.completion_grace_s is not None else {}),
|
|
217
|
+
**(
|
|
218
|
+
{"capture_interval_s": args.capture_interval_s}
|
|
219
|
+
if args.capture_interval_s is not None and args.capture_interval_s > 0
|
|
220
|
+
else {}
|
|
221
|
+
),
|
|
193
222
|
},
|
|
194
223
|
secrets=_parse_secrets(args.secret),
|
|
195
224
|
timeout_seconds=timeout_seconds,
|
|
@@ -280,26 +309,14 @@ class _RuntimeBuildContext:
|
|
|
280
309
|
for name in ("Dockerfile", "lerobot_teleop_runtime.py"):
|
|
281
310
|
with resources.as_file(package_root / name) as path:
|
|
282
311
|
shutil.copy2(path, root / name)
|
|
283
|
-
stage_client_modules(root, ("eval_support", "instrumentation"))
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
shutil.copytree(repo_root / "core", root / "core")
|
|
287
|
-
shutil.copytree(repo_root / "runtime", root / "runtime")
|
|
288
|
-
# So an operator can watch the instrumentation while they drive.
|
|
289
|
-
shutil.copytree(repo_root / "busybox", root / "busybox")
|
|
312
|
+
stage_client_modules(root, ("eval_support", "instrumentation", "keypoint_capture"))
|
|
313
|
+
# busybox is there so an operator can watch the instrumentation as they drive.
|
|
314
|
+
stage_armnet_packages(root, ("core", "runtime", "busybox"))
|
|
290
315
|
return root
|
|
291
316
|
|
|
292
317
|
def __exit__(self, *_exc) -> None:
|
|
293
318
|
self._tmp.cleanup()
|
|
294
319
|
|
|
295
320
|
|
|
296
|
-
def _find_repo_root() -> Path | None:
|
|
297
|
-
for parent in [Path.cwd(), *Path.cwd().parents]:
|
|
298
|
-
candidate = parent / "core" / "src" / "armnet_core"
|
|
299
|
-
if candidate.exists() and (parent / "runtime" / "src" / "armnet_runtime").exists():
|
|
300
|
-
return parent
|
|
301
|
-
return None
|
|
302
|
-
|
|
303
|
-
|
|
304
321
|
if __name__ == "__main__":
|
|
305
322
|
sys.exit(main())
|