Skip to content

PreciseFlex: the configuration as data - cameras counted, saved, recorded and declared - #1503

Open
BioCam wants to merge 7 commits into
mainfrom
pf-stack-3-configuration
Open

BioCam wants to merge 7 commits into
mainfrom
pf-stack-3-configuration

Conversation

@BioCam

@BioCam BioCam commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator

The Problem

What an arm reports at setup lives only for the session. It cannot be written down, compared with another session, or handed to code that runs without the arm, and a caller who knows which arm they expect has no way to say so: setup adopts whatever answers.

is_vision_gripper is read from the last letter of the model name. A name says what was ordered, not what is fitted: an arm named without a V can carry a camera gripper, and one named with it may not.

The controller takes one connection and matches a reply to its command only by order. Nothing stops two callers from writing before either reads, and each would then take the other's reply with no error to show it.

Solution

  • _locked_exchange holds a lock around each write and its reply; send_command goes through it, and the reply check is split out as _ensure_successful so a reply in another grammar can be read through the same exchange. The interrupt halt bypasses the lock.
  • Discovery counts the cameras through the controller (VToolProperty System CameraCount) when its IntelliGuide module is loaded. camera_count is on the configuration, has_vision_gripper is true when it is above 0, and is_vision_gripper warns and answers has_vision_gripper.
  • save_configuration(path) writes the configuration as JSON in the STAR's shape: the device's own under device, and each fitted feature's beside it under its name (arm, gripper, rail). read_configuration(path) reads the sections back into the dataclasses, with axes by name and ranges as tuples. Live state is not written, and a field or feature the driver does not know is left out.
  • driver/recordings/pf400_extended_400mm.json is what an extended-reach PF400 with 400 mm of Z travel and a two-camera gripper answered, saved by the driver at setup on the arm, with its serial blanked.
  • declared_configuration_json names a file save_configuration wrote, read into declared when the driver is built, as the STAR reads its own. Discovery raises, naming each difference, when it does not describe the device that answers: what is fitted, its link and tool lengths, its soft limits. Identity is not compared, so a declaration taken off one arm stands for another of the same build.

The one change on the wire is the camera count: setup reads VToolProperty System CameraCount after version on an arm with IntelliGuide, answered in the tests as the arm answered it (2).

🤖 Generated with Claude Code

@BioCam
BioCam changed the base branch from pf-stack-2-v1-layout to main October 17, 2026 13:11
@BioCam
BioCam force-pushed the pf-stack-3-configuration branch 3 times, most recently from 1282588 to 204997e Compare October 18, 2026 02:25
@BioCam
BioCam marked this pull request as ready for review October 18, 2026 02:25
@BioCam
BioCam requested a review from a team as a code owner October 18, 2026 02:25
BioCam and others added 6 commits October 19, 2026 22:53
The controller takes one connection (port 10100 refuses a second) and matches a reply to its
command only by order. Two callers writing before either reads would each take the other's reply,
with no error to show it.

- `_locked_exchange` holds a lock around each write and its reply; the interrupt halt bypasses it
- `send_command` goes through it, with the reply check split out as `_ensure_successful`, so a
  reply in another grammar can be read through the same exchange

Wire: unchanged.

Tests: precise_flex_tests - concurrent commands keep their write and read paired; a failed
exchange releases the lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s cameras, not a letter in a name

`is_vision_gripper` was read from the model name's suffix. A name says what was ordered, not what
is fitted: an arm named without a V can carry a camera gripper, and one named with it may not.

- discovery counts the cameras through the controller (`VToolProperty System CameraCount`) when its
  IntelliGuide module is loaded; an arm that will not say has none
- `camera_count` on the configuration; `has_vision_gripper` is true when it is above 0
- `is_vision_gripper` warns and answers `has_vision_gripper`

Wire: setup reads `VToolProperty System CameraCount` after `version` on an arm with IntelliGuide.

Tests: configuration_tests - the count decides, not the name; wire_tests - the read in setup,
answered as the arm answered it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…orted to a file

What an arm reported at setup was held only for the session, so nothing could be compared across
sessions or handed to code that runs without the arm.

- `save_configuration(path)` writes the configuration as JSON, shaped as the STAR's: the device's
  own under `device`, and each fitted feature's beside it under its name (`arm`, `gripper`,
  `rail`); it refuses before setup
- `read_configuration(path)` reads the sections back into the dataclasses: axes by name, ranges as
  tuples, a field or feature the driver does not know left out; live state is not written

Tests: configuration_tests - a configuration reads back as it was written, each feature beside the
device.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was no real configuration to test against or to declare from.

- `driver/recordings/pf400_extended_400mm.json`: what an extended-reach PF400 with 400 mm of Z
  travel and a two-camera gripper answered, saved by the driver at setup; its serial is blanked
- `driver/recordings/README.md`: what it is and how one is written

Tests: configuration_tests - it is the arm it is named for, and exactly what the driver writes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…heck it at discovery

A caller who knows which arm they expect had no way to say so, and nothing noticed when setup met
a different one.

- `declared_configuration_json`: a file `save_configuration` wrote, read into `declared` when the
  driver is built, as the STAR reads its own (`{}` when nothing is declared)
- discovery raises, naming each difference, when the declaration does not describe the device that
  answers: what is fitted, its link and tool lengths, its soft limits; identity is not compared,
  so a declaration taken off one arm stands for another of the same build

Tests: configuration_tests - the same build passes, each difference is named, a refused
declaration adopts nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The table still named `PreciseFlex`, the deprecated name, as what emits the PreciseFlex events.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BioCam
BioCam force-pushed the pf-stack-3-configuration branch from 204997e to 8c38a98 Compare October 19, 2026 21:55

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant