Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
cd "$RUNNER_TEMP"
"$RUNNER_TEMP/runtime-test/bin/python" -I -m unittest discover -s "$GITHUB_WORKSPACE/tests" -p 'test_platform*.py'
"$RUNNER_TEMP/runtime-test/bin/python" -I -m unittest discover -s "$GITHUB_WORKSPACE/tests" -p 'test_gravity.py'
"$RUNNER_TEMP/runtime-test/bin/python" -I -m unittest discover -s "$GITHUB_WORKSPACE/tests" -p 'test_policy*.py'
- name: Test optional video from installed wheel
env:
OPENARM_EXPECT_INSTALLED: '1'
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,21 @@ jobs:
"$RUNNER_TEMP/runtime-test/bin/python" -m pip install dist/*.whl
cd "$RUNNER_TEMP"
"$RUNNER_TEMP/runtime-test/bin/python" -I -m unittest discover -s "$GITHUB_WORKSPACE/tests"
- name: Verify optional platform and gravity from release wheel
- name: Verify optional platform, gravity and collection previews from release wheel
env:
OPENARM_EXPECT_INSTALLED: '1'
run: |
"$RUNNER_TEMP/runtime-test/bin/python" - <<'PY'
from pathlib import Path
import subprocess, sys
wheel = next(Path('dist').glob('*.whl')).resolve()
subprocess.run([sys.executable, '-m', 'pip', 'install', str(wheel) + '[platform,gravity]'], check=True)
subprocess.run([sys.executable, '-m', 'pip', 'install', str(wheel) + '[platform,gravity,video]'], check=True)
PY
cd "$RUNNER_TEMP"
"$RUNNER_TEMP/runtime-test/bin/python" -I -m unittest discover -s "$GITHUB_WORKSPACE/tests" -p 'test_platform*.py'
"$RUNNER_TEMP/runtime-test/bin/python" -I -m unittest discover -s "$GITHUB_WORKSPACE/tests" -p 'test_gravity.py'
"$RUNNER_TEMP/runtime-test/bin/python" -I -m unittest discover -s "$GITHUB_WORKSPACE/tests" -p 'test_policy*.py'
"$RUNNER_TEMP/runtime-test/bin/python" -I -m unittest discover -s "$GITHUB_WORKSPACE/tests" -p 'test_collection*.py'
- name: Publish artifacts
env:
GH_TOKEN: ${{ github.token }}
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## 0.8.1 — 2026-11-01

- Add same-origin collection visualization at `/#collection`: fresh/stale
recording status, stream activity and writer queues, plus read-only episode
inspection, causal camera/tactile/joint playback and acceptance/quality labels.
A best-effort status publisher stays separate from native acquisition; recording
controls reuse the existing teleoperation owner.
- Integrate policy visualization into the platform at `/#policy`: built-in
simulated sessions, submitted-target/feedback curves, inference latency and
bounded episode replay, available through the same port in attach-only mode.
- Preserve calibrated absolute J1–J7 manual controls, trajectory/effort checks,
queued motor reports and the calibration trajectory without encoder-zero writes.
Integrate these with v0.8.0's official gains and acquisition observer while
keeping pre-command observations and post-command feedback separate.
- Retain v0.8.0 demonstration collection, synchronized return-to-zero workflow,
native recording and export; preserve read-only CAN reconnection recovery.
- Validate merged behavior with offline fake-device tests, installed-wheel tests
and browser simulation/replay. This release adds no new physical-motion trial.

## 0.8.0 — 2026-11-01

- Add opt-in teleoperation demonstration collection: native acquisition sinks,
Expand Down
36 changes: 28 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ Python 3.12 · MIT · Linux SocketCAN for followers · Independent community pro

## Policy execution and gravity compensation

The platform also provides **数采可视化** at `/#collection`: recording state,
stream updates and writer queues, then camera/tactile/joint playback from native
collection archives. Recording controls remain in the existing teleoperation
page. See [collection visualization](docs/platform.md#collection-visualization).

The platform includes **策略可视化** to the platform at `/#policy`
(standalone same-origin page: `/policy`). It displays submitted targets and
recorded feedback separately, inference latency and a joint timeline. Built-in
simulated policies and episode replay work in `--attach-only` mode. This page
uses the version 1 policy contracts; it does not launch the Classic motor backend.
See [platform policy visualization](docs/platform.md#policy-visualization).

Operator-driven [teleoperation data collection](docs/collection.md) adds explicit
episode recording/review, native-time robot/camera/tactile archives, quality checks
and offline aligned/LeRobot export. Enable it with `leader --follow
Expand Down Expand Up @@ -43,10 +55,10 @@ python3.12 -m venv .venv
source .venv/bin/activate

# Core: state types, software mapping and control API; no GUI or hardware SDK.
pip install "openarm-runtime @ git+https://github.com/TCXM/openarm-runtime.git@v0.7.0"
pip install "openarm-runtime @ git+https://github.com/Edge-Intelligence-Lab/openarm-runtime.git@v0.8.1"

# Serial leader readout, with a browser-based virtual robot.
pip install "openarm-runtime[leader,viewer] @ git+https://github.com/TCXM/openarm-runtime.git@v0.7.0"
pip install "openarm-runtime[leader,viewer] @ git+https://github.com/Edge-Intelligence-Lab/openarm-runtime.git@v0.8.1"
```

Extras compose freely:
Expand All @@ -70,7 +82,7 @@ project's environment. With uv, declare and lock the dependency directly:

```sh
# Run in your own Python 3.12 project.
uv add "openarm-runtime[leader,viewer] @ git+https://github.com/TCXM/openarm-runtime.git@v0.7.0"
uv add "openarm-runtime[leader,viewer] @ git+https://github.com/Edge-Intelligence-Lab/openarm-runtime.git@v0.8.1"
```

**Modify the runtime while developing your application:** clone the source
Expand Down Expand Up @@ -115,7 +127,7 @@ configure the machine once using [platform.example.json](platform.example.json),
then launch:

```sh
python -m pip install "openarm-runtime[platform] @ git+https://github.com/TCXM/openarm-runtime.git@v0.7.0"
python -m pip install "openarm-runtime[platform] @ git+https://github.com/Edge-Intelligence-Lab/openarm-runtime.git@v0.8.1"
openarm-runtime platform --profile ~/.config/openarm-runtime/platform.json
```

Expand Down Expand Up @@ -270,7 +282,7 @@ ssh -N -L 8890:127.0.0.1:8890 -L 8891:127.0.0.1:8891 your-workstation
Video is available starting with v0.3.0:

```sh
python -m pip install "openarm-runtime[video] @ git+https://github.com/TCXM/openarm-runtime.git@v0.7.0"
python -m pip install "openarm-runtime[video] @ git+https://github.com/Edge-Intelligence-Lab/openarm-runtime.git@v0.8.1"
# No cameras or vendor SDK required; clearly labelled SIMULATION.
openarm-runtime video --simulate --port 5004
```
Expand Down Expand Up @@ -346,12 +358,20 @@ readback test on the development rig; quantified accuracy and repeatability are
not yet established. Read the [operator guide](docs/calibration.md) for the
required starting pose, motion sequence, stop behavior and partial-write recovery.

The motor-control panel also provides **自动标定(不写零位)**, available
as `calibrate --no-write-zero` or `calibrate_arm(..., write_zero=False)`. It runs
the same stop-seeking motion and disables at completion, preserving encoder zeros.
The final pose need not read as zero in the existing encoder coordinates.

## Scope

The working baseline covers eight motors per follower arm, Classic CAN,
whole-arm hold/relative targets, two STS3215 leader buses and virtual pose mapping.
Manual control uses validated fixed gains, ±30° relative offsets and
0.1–5°/s target speed. See [validation](docs/validation.md) for measured evidence.
The manual-control panel provides calibrated absolute J1–J7 angle sliders
and a ±30° relative gripper offset, with 0.1–5°/s target speed and 10°/s²
acceleration smoothing. Its fixed gains, feedback checks, queued reports and
read-only CAN reconnect are retained. The default `hold_arm()` API keeps its
±30° relative offsets. See [validation](docs/validation.md) for measured evidence.

Long-duration dual-arm acceptance, collision avoidance, quantified
calibration accuracy and long-term reliability are future work. Firmware encoding
Expand Down Expand Up @@ -380,7 +400,7 @@ examples in `examples/`. [Changelog](CHANGELOG.md) · [Provenance](ORIGIN.md) ·
Paxini IP-M2324-Core (68 points) with the single-channel USB serial converter:

```sh
pip install "openarm-runtime[tactile,viewer] @ git+https://github.com/TCXM/openarm-runtime.git@v0.7.0"
pip install "openarm-runtime[tactile,viewer] @ git+https://github.com/Edge-Intelligence-Lab/openarm-runtime.git@v0.8.1"
openarm-runtime tactile --device /dev/serial/by-id/YOUR_CONVERTER --device-id 2 --port 8891
```

Expand Down
7 changes: 6 additions & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,15 @@ your hardware has been separately verified for this behavior.
## Automatic follower calibration (v0.2.0)

`calibrate_arm(profile, side, *, cancelled, record, publish, progress,
allow_unreadable_mode=False)` synchronously performs a complete single-arm v2
allow_unreadable_mode=False, write_zero=True)` synchronously performs a complete single-arm v2
calibration and writes hardware zeros. `side` is `left` or `right`. It owns the
bus lease, preflight, enable, motion and disable; stop any reader first.

The retained local `write_zero=False` option runs the same physical trajectory,
then verifies the disabled end pose without writing any encoder zeros. It still
requires the calibration reference starting pose; the end pose may have nonzero
readings in the preserved encoder coordinates. CLI: `calibrate --no-write-zero`.

It returns `{motor_id: raw_zero_radians}` for IDs1–8 (the pre-write encoder frame).
`cancelled()` defaults to false; `record(event)`, `publish(states)` and
`progress(message)` default to no-ops. For real operation, supply a durable
Expand Down
7 changes: 7 additions & 0 deletions docs/collection.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,10 @@ Recording is unavailable during return/hold; end an active
recording before requesting another return. Stop/disconnect retains disable cleanup.
This joint-space return does not plan around obstacles: clear its path before
clicking the button. Real hardware return remains an operator-run acceptance check.

## Unified platform preview (v0.8.1)

Use the platform's **数采可视化** module to monitor the collecting process and
replay existing native archives. See [configuration and preview boundaries](platform.md#collection-visualization).
Status snapshots under `.runtime/` are diagnostic state, not dataset episodes;
raw manifests, samples and array payloads retain `openarm.collection/1` format.
68 changes: 66 additions & 2 deletions docs/platform.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# OpenArm Platform

`openarm-runtime platform` brings motor control, teleoperation, tactile and
vision into one local workspace at **http://127.0.0.1:8888**. Use the sidebar to
vision, collection and policy visualization into one local workspace at **http://127.0.0.1:8888**. Use the sidebar to
open each module; all pages, images and WebSocket connections pass through this
one address. The dashboard uses NiceGUI components on FastAPI/Uvicorn, and
aiohttp handles upstream HTTP, streaming responses and WebSocket connections.
Expand All @@ -14,7 +14,7 @@ The platform is available from v0.6.0. In a Python 3.12 environment, install
the optional platform dependencies and configure the machine as described below:

```sh
python -m pip install "openarm-runtime[platform] @ git+https://github.com/TCXM/openarm-runtime.git@v0.6.0"
python -m pip install "openarm-runtime[platform] @ git+https://github.com/Edge-Intelligence-Lab/openarm-runtime.git@v0.8.1"
openarm-runtime platform --profile ~/.config/openarm-runtime/platform.json
```

Expand Down Expand Up @@ -172,3 +172,67 @@ Tactile's nested viewers use `/apps/tactile/_extra/0/` and
are forwarded through these paths without requiring client access to the
internal ports. `/api/status` reports page service availability; it does not
report synchronized hardware data or certify that a motor is disabled.

## Policy visualization

The platform includes an internal **策略可视化** module at
`http://127.0.0.1:8888/#policy`; `/policy` opens it without the dashboard shell.
It uses the same NiceGUI server and needs no extra port or device service.
Existing platform profiles continue to work. The page is also available in
`--attach-only` mode and does not switch or stop a hardware module.

- Start the built-in J1 sine or hold-pose simulation (1–60 seconds). The page
runs a `PolicySession`, process-isolated inference and `SimulatedRobot`.
Simulation is an ideal position plant, not measured hardware performance.
- Choose a joint to compare submitted targets with timestamped feedback
observations. The page also shows the latest inference latency and command
count. After the session, play or drag the timeline to inspect joint values.
- Open a CLI recording from a child directory of `~/openarm-episodes`. Set the
optional top-level `policy_record_root` in the external platform JSON to use
another location. Relative paths resolve beside that JSON file. The loader
reads `events.jsonl` and only robot-state array sidecars, never image arrays
or policy plugins. Recordings with no ending event are marked incomplete.

The view retains the latest 2,000 sampling events and limits recording files
to 64 MiB. Curves are sampled to at most 701 points per series for rendering;
the timeline table uses the retained samples. Recorded feedback is historical,
not the current robot pose. Replay does not resubmit commands to hardware.

One simulated session is shared by all browser views. Closing a tab leaves the
bounded simulation running; Stop or server shutdown cancels it and closes the
inference worker. Physical policy execution remains an explicit CLI/API operation
as documented in [policy.md](policy.md).

## Collection visualization

Open **数采可视化** at `/#collection`, or `/collection` for the standalone page
on the same server. No additional device process or port is created. The page
also works in `--attach-only` mode. “进入遥操录制” selects the existing teleoperation
view through the dashboard; starting/stopping/reviewing an episode stays with
that view's owner and the original control lifecycle.

Set `collection_root` in the external platform JSON to the raw collection root.
If omitted, the platform reads `root` from the teleop command's
`--collection-profile` file when available, otherwise uses `~/openarm-collection`.
The viewer never starts acquisition to discover a directory.

Every `Collection` instance publishes a small status snapshot under
`ROOT/.runtime/INSTANCE.json` every 0.5 seconds, in a separate best-effort thread.
It includes state, task/operator, duration, stream sequence/age and pending
writer queue size. Publishers never serialize camera images or perform I/O on
the CAN thread. Preview write failure does not stop raw acquisition; snapshots
older than three seconds are displayed as stale rather than current recording
state. Existing v0.8.0 processes need to restart on v0.8.1 to publish status.

Select an existing episode to view its task, acceptance and quality issues, then
play or scrub its native timeline. Camera and tactile samples are selected only
from timestamps at or before the cursor. Target dispatch and motor feedback
receipt timestamps remain separate. Camera images are JPEG previews of the
original lossless arrays; depth previews use a fixed 0–4 m colour scale. Tactile
XYZ values remain raw counts. Inspecting or playing a record never writes review
files, changes acceptance, exports training data, or resubmits motor commands.

Preview reads at most 128 MiB of journal data and retains the latest 2,000 records
per stream. Array previews require the optional `video` extra. The common retained
window is shown on the timeline; array and journal checksum issues remain visible.
Metadata/status inspection needs no camera, tactile SDK or native CAN SDK.
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "openarm-runtime"
version = "0.8.0"
version = "0.8.1"
description = "Reusable OpenArm Classic CAN control, Feetech leader readout, tactile/video capture and optional Viser tools"
readme = "README.md"
license = "MIT"
Expand All @@ -15,9 +15,9 @@ requires-python = ">=3.12,<3.13"
dependencies = []

[project.urls]
Repository = "https://github.com/TCXM/openarm-runtime"
Issues = "https://github.com/TCXM/openarm-runtime/issues"
Changelog = "https://github.com/TCXM/openarm-runtime/blob/main/CHANGELOG.md"
Repository = "https://github.com/Edge-Intelligence-Lab/openarm-runtime"
Issues = "https://github.com/Edge-Intelligence-Lab/openarm-runtime/issues"
Changelog = "https://github.com/Edge-Intelligence-Lab/openarm-runtime/blob/main/CHANGELOG.md"

[project.optional-dependencies]
gravity = ["pin==4.1.0"]
Expand Down
36 changes: 35 additions & 1 deletion src/openarm_collection/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,16 @@ def __init__(self, root, *, capacity=512, max_bytes=256 * 1024**2):
self.previews = {}
self.tactile_values = {}
self.previous_episode = None
self.last_state = None
self.last_metadata = {}
self.last_duration = 0.0
self.ready = False
self.message = "待机"
self.closed = threading.Event()
self.monitor = threading.Thread(target=self._monitor, name="collection-health", daemon=True)
self.monitor.start()
from .status import StatusPublisher
self.status_publisher = StatusPublisher(self.root, self.status_snapshot)

def register(self, name, **spec):
with self.lock:
Expand Down Expand Up @@ -87,6 +92,9 @@ def _finish(self, reason, error):
path = episode.finish(reason)
with self.lock:
self.last = path
self.last_state = episode.manifest['state']
self.last_metadata = {key: episode.manifest['metadata'].get(key, '') for key in ('task', 'operator')}
self.last_duration = episode.manifest['ended_at'] - episode.manifest['started_at']
self.episode = None
self.message = f"待验收 · {episode.manifest['state']} · {path.name}"
if episode.manifest["quality"]["problems"]:
Expand Down Expand Up @@ -125,7 +133,33 @@ def _monitor(self):
except Exception as exc:
self.message = str(exc)

def status_snapshot(self):
"""Small diagnostic copy; never serialize or touch storage under this lock."""
with self.lock:
now = time.monotonic()
episode = self.episode
state = ('closed' if self.closed.is_set() else
('draining' if episode.stop.is_set() else 'recording') if episode else
self.last_state if self.last else 'ready' if self.ready else 'idle')
metadata = episode.manifest['metadata'] if episode else self.last_metadata
return dict(state=state, ready=self.ready, message=self.message,
task=metadata.get('task', ''), operator=metadata.get('operator', ''),
episode_id=episode.path.name if episode else self.last.name if self.last else None,
duration_s=now-episode.manifest['started_at'] if episode else self.last_duration,
queue_items=episode.queue.qsize() if episode else 0,
pending_bytes=episode.bytes if episode else 0,
error=episode.error if episode else '',
streams={name: dict(encoding=spec.get('encoding', ''),
sequence=self.sequence.get(name, 0),
age_s=now-self.latest[name] if name in self.latest else None,
max_age_s=spec.get('max_age_s', .5), required=spec.get('required', True))
for name, spec in self.streams.items()},
tactile={name: list(values) for name, values in tuple(self.tactile_values.items())})

def close(self):
self.closed.set()
self.monitor.join(timeout=2)
self.finish("shutdown", "Collection closed while recording")
try:
self.finish("shutdown", "Collection closed while recording")
finally:
self.status_publisher.close()
Loading
Loading