Metadata-Version: 2.5
Name: griip-sdk
Version: 0.16.8
Summary: GRIIP SDK: hardware control and orchestration for bin picking
Author: VentionCo
License: Proprietary
Requires-Python: <3.11,>=3.10
Requires-Dist: cryptography<49.0,>=48.0
Requires-Dist: defusedxml<0.8.0,>=0.7.1
Requires-Dist: dynamixel-sdk<4.0,>=3.8
Requires-Dist: fastapi[standard]>=0.121.1
Requires-Dist: foxglove-schemas-protobuf<1.0,>=0.4.0
Requires-Dist: griip-core[grpc-clients]>=0.6.42,<0.7.0
Requires-Dist: grpcio>=1.78.0
Requires-Dist: httpx[http2]<0.29.0,>=0.28.1
Requires-Dist: machine-logic-sdk
Requires-Dist: mcap-protobuf-support<1.0,>=0.4.0
Requires-Dist: mcap<2.0,>=1.3.0
Requires-Dist: numpy>=1.24
Requires-Dist: omegaconf<3.0.0,>=2.3.0
Requires-Dist: opencv-python-headless<5.0.0,>=4.9.0
Requires-Dist: paho-mqtt<2.0,>=1.5
Requires-Dist: protobuf>=4.0
Requires-Dist: pydantic==2.11.1
Requires-Dist: pymodbus==3.11
Requires-Dist: pyserial<4.0,>=3.5
Requires-Dist: pyyaml<7.0,>=6.0
Requires-Dist: scipy<2.0,>=1.11.0
Requires-Dist: spatialmath-python<2.0.0,>=1.1.15
Requires-Dist: toppra<=0.6.3,>=0.6.0
Requires-Dist: trimesh<5.0,>=4.11
Requires-Dist: urchin<0.0.31,>=0.0.30
Requires-Dist: vention-grpc-py-sdk>=0.0.87
Requires-Dist: vention-sim-grpc-py-sdk==0.1.3
Description-Content-Type: text/markdown

# griip-sdk

Hardware control and orchestration for bin picking, by [Vention](https://vention.io).

The SDK owns the robot, gripper, perception, and planning. You own the loop:
when to pick, where the part goes, and what to do on failure.

## Install

```bash
pip install griip-sdk
```

Needs a running `griip-server`. From outside the Vention monorepo, use gRPC
mode.

### Supported platforms

- Python 3.10 (machine-logic-sdk, which provides the cell's digital IO, supports only 3.10).
- Linux x86_64 and arm64 (what cells run), and macOS (tested on Apple
  Silicon). Windows is not tested.

One dependency, `toppra` (trajectory timing), ships only as source at the
version we pin, so pip compiles it during install. That needs a C compiler and
the Python headers:

- macOS: `xcode-select --install`
- Debian/Ubuntu: `sudo apt install build-essential python3-dev`

Everything else installs from prebuilt wheels.

## Quickstart

```python
from griip_sdk import build_pick_only_manager

DROP_JOINTS = [-1.5, -1.2, 1.0, -1.4, -1.5, 0.0]   # your drop pose

with build_pick_only_manager("./pick.yaml", part_id="pcb") as manager:
    pick = manager.pick(max_attempts=3)
    if pick.succeeded:
        manager.start_pick_generation()                 # perception runs while you move
        manager.collision_free_move_to_joints(DROP_JOINTS, object_in_tcp=pick.obj_in_tcp)
        manager.release()
```

Two entry points, same setup under the hood:

- `build_pick_only_manager` for single-cycle pick-only work (above).
- `build_bin_picking_manager` for a continuous bin-pick + placement loop; you
  pass a `handle_placement` callback and call `manager.run()`.

Both return a context manager that wires up hardware and tears it down on exit.

## Handling failures

`manager.pick()` always returns a `PickResult`. On failure, `failure_reasons`
holds one reason per attempt in order. `failure_reasons[-1]` is the last
attempt; more than one distinct reason means the cell is failing for shifting
reasons.

| `PickFailureReason` | Meaning | Typical response |
|---|---|---|
| `NO_PARTS_DETECTED` | Perception saw no objects. | Request refill. |
| `NO_GRASPABLE_PARTS` | Parts visible but none reachable. | Shake / reorient. |
| `GRIP_CHECK_FAILED` | Scooped but nothing in hand. | Retry next loop. |
| `MOTION_FAILED` | Collision or scoop plan/exec failure. | Alert operator. |
| `PERCEPTION_FAILED` | Picking stream died mid-call (gRPC error). | Backoff + retry, or page ops. |
| `PLACEMENT_FAILED` | Pick OK, place leg failed (placement mode). | Cell-specific. |

`pick.attempts_made` and `pick.detail` are for logs and metrics, not control
flow. Hardware faults (robot or gripper driver) don't map to a reason: they
escape as exceptions, which is your "stop the cell" signal.

A loop that acts on each reason:

```python
from griip_sdk import build_pick_only_manager, PickFailureReason

with build_pick_only_manager("./pick.yaml", part_id="pcb") as manager:
    while True:
        pick = manager.pick(max_attempts=3)

        if pick.succeeded:
            manager.start_pick_generation()
            manager.collision_free_move_to_joints(DROP_JOINTS, object_in_tcp=pick.obj_in_tcp)
            manager.release()
            continue

        if len(set(pick.failure_reasons)) > 1:
            alert_operator(f"cell unstable: {pick.failure_reasons}")
            break

        match pick.failure_reasons[-1]:
            case PickFailureReason.NO_PARTS_DETECTED:
                request_refill()
            case PickFailureReason.NO_GRASPABLE_PARTS:
                shake_the_bin()            # your cell's own hardware
            case PickFailureReason.GRIP_CHECK_FAILED:
                pass                       # SDK already retried; try again next loop
            case PickFailureReason.MOTION_FAILED | PickFailureReason.PERCEPTION_FAILED:
                alert_operator(pick.detail)
                break
```

## Manager methods

| Method | Effect |
|---|---|
| `pick(max_attempts=3)` | Pick only. Returns a `PickResult`; robot stays at the prep pose on success. |
| `pick_and_place_once(max_pick_attempts=3, target_pose=...)` | Pick, then place when `target_pose` is given. |
| `start_pick_generation()` | Move to the capture pose and run perception. The camera grab is synchronous; perception runs async. |
| `collision_free_move_to_joints(target, object_in_tcp=None, ...)` | Collision-aware joint move. Pass `object_in_tcp=pick.obj_in_tcp` while carrying a part. |
| `release()` | Open the gripper and clear `object_in_hand`. |
| `set_capture_joints(joints)` | Change where perception captures from, next capture on. |
| `set_part(part_id)` | Swap the active part mid-session. Re-sends Initialize over the existing channel; no hardware or planner re-init. |

## Poses and Euler angles

Poses are spatialmath `SE3` objects, in meters. To work in Euler angles, use
`position_euler_to_se3` and `se3_to_euler`:

```python
from griip_sdk import position_euler_to_se3, se3_to_euler

target_pose = position_euler_to_se3([0.5, 0.0, 0.3], [180.0, 0.0, 90.0])
manager.pick_and_place_once(target_pose=target_pose)

rx, ry, rz = se3_to_euler(pick.obj_in_tcp)
```

The angles are `[rx, ry, rz]` in degrees, applied as intrinsic rotations about
X, then the new Y, then the new Z. This is the same convention as MachineLogic,
so a MachineLogic pose `[x, y, z, rx, ry, rz]` converts with
`position_euler_to_se3([x / 1000, y / 1000, z / 1000], [rx, ry, rz])`
(MachineLogic positions are in millimeters). spatialmath's `SO3.RPY` uses a
different convention, so don't pass MachineLogic angles to it.

## `pick.yaml`

The cell YAML points the runner at the robot, gripper, camera, perception
backends, and the cell's collision geometry. It does not hold drop poses or
loop policy. That is your application code.

## Bring your own gripper

Both builders take an optional `gripper=`. When set, the SDK uses your client
instead of building one from the YAML.

Use the SDK's Robotiq 2F-140 directly, so a bench consumer keeps its hardware
constants out of the cell YAML:

```python
from griip_sdk import build_pick_only_manager
from griip_sdk.hardware.robotiq_2f140_gripper import Robotiq2F140Gripper

gripper = Robotiq2F140Gripper(serial_port="/tmp/ttyUR", baudrate=115200, modbus_slave_id=9, grip_force=20, release_width=800)

with build_pick_only_manager("./pick.yaml", part_id="pcb", gripper=gripper) as manager:
    ...
```

Or subclass `BaseGripper` for a gripper the SDK doesn't ship (a Modbus /
EtherNet-IP unit, or an in-memory fake for tests):

```python
from griip_sdk import BaseGripper, GripperMoveResult, build_pick_only_manager

class MyEthernetIPGripper(BaseGripper):
    def get_width(self) -> int: ...
    def get_current_draw(self) -> int: ...
    def is_in_safety_stop(self) -> bool: ...
    def reset_safety(self) -> None: ...
    def reconnect(self) -> None: ...
    def stop(self) -> None: ...
    def close_gripper(self, force_value=400, block=False, timeout=10.0) -> GripperMoveResult: ...
    def open_gripper(self, force_value=400, block=False) -> GripperMoveResult: ...
    def move_gripper(self, width_value, force_value=400, block=False, timeout=None) -> GripperMoveResult: ...

with build_pick_only_manager("./pick.yaml", part_id="pcb", gripper=MyEthernetIPGripper(...)) as manager:
    ...
```

Two things to know:

- The YAML `tool.gripper` block still drives manager state
  (`closed_gripper_width`, `expected_grip_width_range`, `grip_check_width_margin`,
  `min_grip_width_for_current_part`). Only the hardware-construction fields
  (`serial_port`, `baudrate`, `modbus_slave_id`, `force`, `release_width`) are
  ignored when you inject a gripper. The SDK logs this once at `INFO`.
- The SDK does no gripper-side teardown. If your gripper holds a connection
  (TCP or serial), close it yourself.

## Digital IO (machine-logic)

The SDK has no IO client of its own. Digital inputs and outputs come from
machine-logic-sdk's `Machine`, which your app creates (one per process) and
passes as `machine_io=`. The SDK never builds one. IO names and polarity come
from the cell's MachineApp configuration.

```python
from machinelogic import Machine

with build_bin_picking_manager("./cell.yaml", part_id="pcb", handle_placement=..., machine_io=Machine()) as manager:
    ...
```

The cell YAML names the IO it uses: `io.tower_light` (`red`, `orange`,
`green`, optional `alarm`), `io.bin_presence_sensors` (bin number to input;
a bin without one is always present), and the gripper's own names (e.g.
`suction_output_name`). Every name is looked up when the manager is built. A name missing from the MachineApp configuration, or a
cell that names IO without `machine_io`, fails the build. `mock=True` uses
in-memory IO instead.

## Bring your own camera (vision ABC)

Both builders take an optional `vision_backend=`. The SDK camera path talks to
the `vention.vision.v1` Image/Source service ABCs, so the same `CameraManager`
drives the legacy Luxonis camera and the native gRPC cameras (vvis, Leopard)
behind one interface. When `vision_backend` is omitted (or in `mock` mode) the
SDK builds whichever backend the cell YAML `camera.backend` field selects.

The easiest route is config-only — pick the backend in the cell YAML:

```yaml
camera:
  backend: "grpc"              # "mmai" (default, legacy Luxonis HTTP) or "grpc"
  target: "127.0.0.1:41051"    # vention.vision gRPC service
  sensor: "full_frame_left"    # primary source id reported by ListSources
  right_source_id: "full_frame_right"
  source_metadata: # only keys the service omits; service values always win
    camera_vendor: "leopard"
    mx_id: "LI-123456"
```

or build it in code with the same dispatch:

```python
from griip_sdk import build_bin_picking_manager
from griip_sdk.hardware.grpc_vision_backend import build_vision_backend

vision_backend = build_vision_backend("./cell.yaml")  # Mmai or gRPC per camera.backend
with build_bin_picking_manager("./cell.yaml", part_id="pcb", handle_placement=..., vision_backend=vision_backend) as manager:
    ...
```

`GrpcVisionServiceBackend` composes the wheel's `create_source_service_backend`
/ `create_image_service_backend` gRPC backends so one object satisfies both
ABC seams. They are two addresses: the camera's SourceService at `camera.target`,
and the image store behind the cell's Envoy (`perception.services.envoy`), where
the SDK reads and writes every image, so a camera that only uploads its captures
there (griip-sim) works like one that serves the store itself. `build_mmai_vision_backend` still builds the Luxonis adapter
explicitly. Intrinsics, resolution, and stereo baseline are resolved from the
backend's `list_sources`, so each camera reports its own calibration through
the same seam — native services own their calibration (no calibio upload), and
`source_metadata` must carry `baseline` / `camera_vendor` / `mx_id` (from the
service or the YAML overlay) or calibration resolution fails loudly.

> The camera layer imports the `vention.vision.v1` protos and `vision_service_abc`
> ABCs, so it needs `vention-firmware-grpc-client>=1.3.0`.

## Your own perception steps

griip-server finds parts in steps: segmentation finds a mask for each part, a
size filter and ranking choose which masks to try and in what order, then pose
estimation and grasp planning run on each one. Both builders take
`perception_hooks=` to run your own code at three of those points:

| Hook | Gets | Returns |
|---|---|---|
| `post_segment(context, segments)` | The segments the segmentation service found. | The segments to use instead. It can merge, split, drop or edit them. |
| `pre_rank(context, segments)` | Every segment. | Indices of the segments to try, best first, or `None` to run the built-in size filter and ranking. |
| `pre_pose(context, segment)` | One ranked segment. | The part's pose in the camera frame, or `None` to have the server estimate it (FoundationPose). |

Use them when the built-in steps don't fit the job, for example when the tool
picks several parts at once, or parts must come out in a fixed order.
`pre_rank` replaces the size filter too, because the size limits in the cell
YAML are for one part and a merged group would fail them.

`context` holds what the server was given for this image: `image_id`,
`color_bgr`, `depth_mm`, `camera_intrinsics`, `camera_pose_in_world`,
`tcp_pose_at_capture`, `roi` and `bin_walls`. A `Segment` has a boolean `mask`
the size of the whole image (even with an ROI), a `bbox` (x_min, y_min, x_max,
y_max, max exclusive) and a `score`. The `PostSegmentHook`, `PreRankHook` and
`PrePoseHook` types give the three signatures.

Example: a tool that picks the five parts in one column of a tray, columns in
order from the left.

```python
import numpy as np
from griip_sdk import PerceptionContext, PerceptionHooks, Segment, build_bin_picking_manager

PARTS_PER_COLUMN = 5
COLUMN_WIDTH_PX = 80


def merge_into_columns(context: PerceptionContext, segments: list[Segment]) -> list[Segment]:
    columns: dict[int, list[Segment]] = {}
    for segment in segments:
        x_center = (segment.bbox[0] + segment.bbox[2]) / 2
        columns.setdefault(int(x_center // COLUMN_WIDTH_PX), []).append(segment)

    groups = []
    for parts in columns.values():
        if len(parts) != PARTS_PER_COLUMN:
            continue  # the tool needs a full column
        mask = np.logical_or.reduce([part.mask for part in parts])
        rows, cols = np.nonzero(mask)
        bbox = (int(cols.min()), int(rows.min()), int(cols.max()) + 1, int(rows.max()) + 1)
        groups.append(Segment(mask=mask, bbox=bbox, score=min(part.score for part in parts)))
    return groups


def leftmost_first(context: PerceptionContext, segments: list[Segment]) -> list[int]:
    return sorted(range(len(segments)), key=lambda index: segments[index].bbox[0])


hooks = PerceptionHooks(post_segment=merge_into_columns, pre_rank=leftmost_first)
with build_bin_picking_manager("./cell.yaml", part_id="tray_column", handle_placement=place, perception_hooks=hooks) as manager:
    manager.run()
```

The part (`tray_column` here) is then the whole group: its mesh, grasps and
size are those of five parts together, since pose estimation and grasp
planning run on the merged mask.

### Your own pose estimation

`pre_pose` replaces FoundationPose. The server calls it for each ranked
segment in turn, until it has accepted as many parts as the request allows
(`max_detections`), so one capture can call it several times. Return `None`
for a segment and the server estimates that pose itself.

The pose you return must be:

- **in the camera frame**: the pose of the part relative to the camera that
  took the capture, not the robot base. `context.camera_pose_in_world` converts
  between the two;
- **in metres**;
- **the pose of the part mesh's frame**: the same origin and axes as the mesh
  in the cell's part definition, because grasps are placed relative to it.

The server uses that pose as it is. A pose from FoundationPose is only kept if
the mesh drawn at that pose covers the segment's mask (the mask IoU check);
yours isn't checked at all. A pose in the wrong frame, in millimetres, or for a
mesh with a different origin gives grasps that miss, with no error. What the
server still does: it folds the pose of a symmetric part onto the part's
nominal orientation, as it does for FoundationPose.

Example: a pose estimator of your own that returns poses in the robot base
frame.

```python
from typing import Optional

from spatialmath import SE3
from griip_sdk import PerceptionContext, PerceptionHooks, Segment, build_bin_picking_manager

estimator = MyPoseEstimator("./part.stl")  # same mesh as the cell's part; load it once, up front


def my_pose(context: PerceptionContext, segment: Segment) -> Optional[SE3]:
    part_in_base = estimator.estimate(context.color_bgr, context.depth_mm, context.camera_intrinsics, segment.mask)
    if part_in_base is None:
        return None  # let FoundationPose try this segment
    return context.camera_pose_in_world.inv() @ part_in_base


hooks = PerceptionHooks(pre_pose=my_pose)
with build_bin_picking_manager("./cell.yaml", part_id="bracket", handle_placement=place, perception_hooks=hooks) as manager:
    manager.run()
```

Each call is one round trip to your code and one mask sent over, so a few
milliseconds plus your estimator's own time, once per segment tried.

Things to know:

- **Hooks need the AI-services perception path.** The legacy SAM server
  segments, ranks and estimates poses in one call, so there's nowhere to run
  your code in between. On such a cell, and with `mock=True`, every run that
  registers hooks fails with `PERCEPTION_FAILED`.
- **A hook that fails, fails the run.** If it raises, or returns nothing within
  the timeout, the pick reports `PERCEPTION_FAILED` and `pick.detail` names
  the hook and your exception. The server doesn't fall back to its own step,
  so a broken hook shows up at once instead of quietly picking the wrong parts.
- **The timeout is 10 s per call.** A first call that loads a model can take
  longer. Load it before the first run, or set
  `PerceptionHooks(timeout_seconds=...)`.
- **Hooks run on SDK worker threads, not on yours.** Two can run at once, for
  example when a run is cancelled while its hook is still working and the next
  run's hook starts. Guard any state they share with a lock.
- **A hook can keep running after its run is cancelled.** The manager cancels
  a run when it captures a new image, and the result of the old hook is then
  dropped. So don't move hardware or count parts in a hook; return a result
  and do that in your own loop.
- **Masks cost time with many segments.** Each mask goes between the server
  and the SDK at full image size, compressed as COCO run-length encoding.
  Encoding and decoding one takes about 2.5 ms at 1920×1080, so a call with
  75 segments spends about 0.2 s on its masks, each way.
- **Upgrade griip-server and the SDK together.** `GeneratePicks` became a
  two-way stream so the server can call your hooks, and an SDK from before
  that change can't talk to a server after it, or the other way round, even
  without hooks.

## Swapping parts mid-session

```python
with build_pick_only_manager("./pick.yaml", part_id="pcb_rev_a") as manager:
    for _ in range(5):
        manager.pick(max_attempts=3)

    manager.set_part("pcb_rev_b")     # ValueError if part_id isn't in pick.yaml

    for _ in range(5):
        manager.pick(max_attempts=3)
```

Only works if both parts use the same gripper. If they don't, build a fresh
manager for each.

## Manual lifecycle (without `with`)

The `with` form is crash-safe and recommended. For a long-running daemon that
needs a global-style handle, drive the lifecycle yourself:

```python
_ctx = build_pick_only_manager("./pick.yaml", part_id="pcb")
manager = _ctx.__enter__()
try:
    manager.pick(max_attempts=3)
    # manager is usable anywhere in the process
finally:
    _ctx.__exit__(None, None, None)   # required: closes gRPC + hardware
```

This is an escape hatch. Skip `__exit__` and you leak the gRPC channel and
hardware connections.

## Calibration

The SDK exposes the two calibration primitives — hand-eye and
operator-driven environment scanning. The cell YAML is the source of
truth for the calibration starting pose
(`positions.calibration_joints`); commissioning authors it, the SDK
reads it, and the operator app never edits it at runtime.

The simplest hand-eye run — build the app, call the verb:

```python
from griip_sdk import build_calibration_app

with build_calibration_app("cell.yaml") as cal:
    x_cam_flg = cal.run_hand_eye_calibration()
```

The SDK plans to `cell.positions.calibration_joints`, runs the hand-eye
routine, checks the result from fresh views of the board, returns the robot to
that start pose, and persists the result. The
fuller form below adds progress reporting and the operator-driven scan session:

```python
from pathlib import Path

from griip_sdk import build_calibration_app

with build_calibration_app(Path("cell.yaml")) as cal:
    # Hand-eye: the SDK plans to cell.positions.calibration_joints, runs the
    # routine, then returns the robot to the start pose.
    x_cam_flg = cal.run_hand_eye_calibration(
        on_progress=lambda pct, status, msg: print(pct, status, msg),
        is_cancelled=lambda: False,
    )
    cal.last_hand_eye_calibration_timestamp()       # datetime | None

    # Environment scanning: operator-driven session. start_environment_session
    # switches the robot into freedrive; take_environment_image grabs one
    # frame at the current pose; end_environment_session restores normal
    # operation and persists the entry.
    cal.start_environment_session()
    for _ in range(num_frames_the_app_wants):
        # operator manually repositions the robot between captures
        cal.take_environment_image()
    sequence_dir = cal.end_environment_session()
    cal.last_environment_scan_timestamp()           # datetime | None
```

If `cell.positions.calibration_joints` is unset, `run_hand_eye_calibration`
raises `griip_sdk.ConfigError` with a message naming the missing field and
the config file. Surface this to the operator so commissioning can fix the
YAML.

Override the VAMP planner's world cuboids at build time when they live
outside the cell YAML:

```python
with build_calibration_app(Path("cell.yaml"), cuboids_path=Path("custom.json")) as cal:
    ...
```

After a camera swap, before the new MxId has calibio intrinsics in the
store, opt into the live-defaults fallback so calibration verbs still
run:

```python
with build_calibration_app(Path("cell.yaml"), strict_intrinsics=False) as cal:
    cal.run_hand_eye_calibration(...)        # uses camera defaults; logs warning
```

### Transport (direct vs gRPC)

`build_calibration_app` honors `griip_api.mode` in the cell YAML:

- `mode: direct` (default) — wires the in-process `PlanningApi` and
  `PerceptionApi` from `griip_server`. Pulls the dev-only
  `griip_server` package as a transitive runtime dep at the call site.
- `mode: grpc` — dials the gRPC server at `griip_api.url` (defaults to
  `localhost:50052`) using the SDK's own generated stubs. No
  `griip_server` dep needed; the published SDK wheel is enough.

The gRPC channel is closed for you on context-manager exit.

### BYO stubs (advanced)

`CalibrationApp.__init__` is keyword-only and accepts the planning and
perception stubs as injected dependencies. When the cell-app needs a
non-standard transport (custom interceptors, an alternate server,
test fixtures), construct it directly and skip the factory:

```python
import grpc
from griip_sdk import CalibrationApp
from griip_sdk.calibration.config_store import CalibrationConfigStore
from griip_core.generated import griip_pb2_grpc
from griip_sdk.hardware.mmai_vision_backend import MmaiVisionServiceBackend

channel = grpc.insecure_channel("custom-host:50051")

# vision_backend is the same vention.vision.v1 ABC used everywhere else in the
# SDK (CameraManager, teleop, ...); MmaiVisionServiceBackend adapts an already
# started MmaiVisionClient to it. See "Vision ABC" above for the interface.
vision_backend = MmaiVisionServiceBackend(camera_client, left_source_id="left", right_source_id="right")

cal = CalibrationApp(
    cell=cell,
    config_path=cell_yaml_path,
    robot_client=robot_client,
    vision_backend=vision_backend,
    cam_name="luxonis",
    camera_mxid="...",
    sensor="left",
    store=CalibrationConfigStore(),
    calib_data_root="/data/vention/calib_data",
    planning_stub=griip_pb2_grpc.PlanningServiceStub(channel),
    perception_stub=griip_pb2_grpc.PerceptionServiceStub(channel),
)

# ...drive the verbs as normal, then close `channel` and unregister the
# robot when done (the BYO path skips the factory's cleanup).
```

### Verbs on `CalibrationApp`

| Verb | Effect |
|---|---|
| `cal.run_hand_eye_calibration(on_progress=None, is_cancelled=None, on_capture=None, ...)` | Plan to `cell.positions.calibration_joints`, run hand-eye, then return the robot to that start pose. `on_capture` gets each picture the routine takes. Persists `X_cam_flg__{cam}__{mxid}__{sensor}`. Returns the camera-to-flange `SE3`. Raises `ConfigError` when the YAML field is missing. |
| `cal.last_hand_eye_calibration_timestamp()` | `datetime` (UTC) of the latest hand-eye, or `None`. |
| `cal.start_environment_session(save_dir=None)` | Open an operator-driven scan session. Creates the sequence dir, persists post-crop intrinsics, switches robot to freedrive. Returns the sequence dir. |
| `cal.take_environment_image()` | Capture one frame in the active session (stereo, depth, pose). Robot stays in freedrive. Returns the frame index. |
| `cal.end_environment_session()` | Restore the robot to normal operation, persist `env_scan__{cam}__{mxid}` pointing at the sequence dir. Returns the sequence dir. |
| `cal.last_environment_scan_timestamp()` | `datetime` (UTC) of the latest completed scan session, or `None`. |

## Release notes

Releases publish to PyPI from `master` through the monorepo `nx release`
pipeline. The [PyPI release history](https://pypi.org/project/griip-sdk/#history)
lists every published version. Each page freezes the README and CHANGELOG as of
that release.
