Metadata-Version: 2.4
Name: archeone
Version: 0.1.0
Summary: Synchronous client for ArcheOneBrain embodied inference, with observation windows and optional PiPER IK
Author: DylanUnicorn
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/DylanUnicorn/archeone
Project-URL: Repository, https://github.com/DylanUnicorn/archeone
Project-URL: Issues, https://github.com/DylanUnicorn/archeone/issues
Keywords: robotics,embodied-ai,vla,policy,piper,archeone
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: licenses/dreamlabs-LICENSE
License-File: licenses/dreamlabs-NOTICE
License-File: licenses/jaxls-LICENSE
License-File: licenses/pyroki-LICENSE
Requires-Dist: numpy>=1.24
Requires-Dist: Pillow>=10
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: twine>=5; extra == "dev"
Provides-Extra: ik
Requires-Dist: einops>=0.7; extra == "ik"
Requires-Dist: jax==0.7.1; extra == "ik"
Requires-Dist: jax-dataclasses==1.6.3; extra == "ik"
Requires-Dist: jaxlib==0.7.1; extra == "ik"
Requires-Dist: jaxlie==1.5.0; extra == "ik"
Requires-Dist: jaxtyping; extra == "ik"
Requires-Dist: loguru; extra == "ik"
Requires-Dist: pydantic>=2; extra == "ik"
Requires-Dist: scipy>=1.11; extra == "ik"
Requires-Dist: termcolor; extra == "ik"
Requires-Dist: typing-extensions>=4.5.0; extra == "ik"
Requires-Dist: yourdfpy==0.0.60; extra == "ik"
Dynamic: license-file

# archeone

`archeone` is a synchronous Python client for **ArcheOneBrain**, an embodied
inference service reached over the `/v1/get_action` protocol. It keeps the
observation-window, session, error-envelope, action-pacing, seam-smoothing and
optional IK behavior that protocol defines, and raises its errors under `AR-*`
names.

Two models are served:

| Model | Use |
| --- | --- |
| `archeone/archeone-brain-1.0` | the full model |
| `archeone/archeone-brain-1.0-flash` | the lower-latency model |

Request them by these names. The service maps them onto its own checkpoints
internally; the upstream checkpoint ids are not part of the public surface.

The SDK core is hardware-free. Hardware integrations live under `examples/`.

**New here? Read [docs/quickstart.md](docs/quickstart.md).** It walks from
creating your first token through installing the SDK to a real PiPER grasp,
with a verification step after each stage.

## Install

```bash
pip install archeone
```

That installs the client only, with `numpy` and `Pillow`. For the optional
PiPER inverse kinematics, which pulls JAX and the vendored solver:

```bash
pip install "archeone[ik]"
```

For development:

```bash
python -m pip install -e ".[ik,dev]"
```

## Synchronous inference

`ArcheoneClient` accepts one latest state plus one JPEG frame per camera on
every camera tick. It keeps an internal 9-frame, 5 fps window per camera and
sends frames oldest-to-newest.

```python
import time
from archeone import ArcheoneClient

client = ArcheoneClient(
    api_key="sk-...",
    base_url="https://gateway.example",
    checkpoint="archeone/archeone-brain-1.0",
)

client.set_observation(
    frames={
        "video.overhead": overhead_jpeg,
        "video.wrist_l": left_jpeg,
        "video.wrist_r": right_jpeg,
    },
    observation={
        "state.right_arm": right_joints,
        "state.right_gripper": [right_gripper],
        "state.left_arm": left_joints,
        "state.left_gripper": [left_gripper],
        "state.right_eef_xyz": right_xyz,
        "state.right_eef_rot6": right_rot6,
        "state.right_grip": [right_grip],
        "state.left_eef_xyz": left_xyz,
        "state.left_eef_rot6": left_rot6,
        "state.left_grip": [left_grip],
        "prompt": "Grab the bottle",
    },
    timestamp=time.monotonic(),
)

chunk = client.get_action()
```

The gateway's `status.code` decides success. HTTP 200 alone is not success.
`AR-2000 POOL_WARMING` is surfaced as `CapacityError`; keep the same
`episode_key` and retry per `retry_after_s`. A cold pool can take tens of
minutes to come up; do not open new sessions while it warms.

## Hardware validation

`examples/piper_two_arm_demo.py` is the operator-facing PiPER integration. It
refuses to run without `--execute`, uses the existing station control driver's
fresh-feedback, motor-ready, and joint-limit gates, and never enables, homes,
zeros, or disables the motors. It validates every returned chunk against the
URDF limits before sending it, and streams the chunk at 250 Hz from the measured
pose.

The SDK itself has been exercised against the real gateway with three RealSense
streams and both hands' FK-derived EEF fields; a real arm execution requires the
arm to be inside the station's URDF joint envelope and an operator present.

### Station notes

These came out of bringing the left arm up on the real station; each one
silently ruins a run if it is wrong.

**Tool frame.** The checkpoint was trained with the station's calibrated PiPER
tool, `approach = +z` and `jaw = +y` in the flange frame, which is a frame
rotated 90 degrees about the flange z from the flange's own axes. Sending EEFs
in the flange frame instead makes the model's wrist pose off by a right angle,
and the arm answers by twisting its last wrist joint rather than approaching.
`archeone/ik/dream_ik/specs.py` carries that rotation; it reproduces the
station's own recorded replies to within 3.4 degrees.

**Start where the arm actually is.** The reply is anchored on the pose the
request carried. If the arm is parked somewhere with no line of sight to the
object, the model answers with targets around that pose and nothing moves
toward the goal. The demo therefore does not drive to a nominal rest unless
`--ready` is passed. An operator can teleoperate the arm into a sensible
pre-grasp pose, and the first inference starts from there.

**Elbow margin matters more than distance.** PiPER's `J3` sits close to its
upper bound at the nominal rest (`-0.101` of `[-2.932, -0.035]`). From there the
arm cannot extend down to a tabletop object, and the solve reports a large
residual no distance clipping can fix. A pre-grasp pose with `J2` around 1.7 and
`J3` around -0.78 leaves room on every axis and reaches the table.

**Slow links.** A synchronous round trip of several seconds is worth dozens of
20 Hz rows. The client drops the rows the round trip already spent but keeps at
least a second of live plan, and clips each target to a reachable step from the
commanded pose, so a distant model target becomes a sequence of waypoints
instead of a rejected chunk.


