Skip to content

bi7/09b: Visualizer3D: a boundary is an outline with no fill - #1651

Open
cmoscy wants to merge 24 commits into
PyLabRobot:mainfrom
cmoscy:bi7/09b-boundary
Open

cmoscy wants to merge 24 commits into
PyLabRobot:mainfrom
cmoscy:bi7/09b-boundary

Conversation

@cmoscy

@cmoscy cmoscy commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add viewer category boundary: structure outline only, no fill, in free and plan views.
  • Tree dot uses the outline grey so collision boxes are not the default yellow.

Test plan

  • A resource with category="boundary" draws as an outline with no fill
  • Other categories are unchanged

… empty cache

Choosing a device by `serial_number` compared it with `dev._serial_number`, which PyUSB fills
only once something has read `dev.serial_number`. Straight after enumeration it is None, so every
device was refused as having no serial number. The serial number is now read through the
descriptor (`dev.serial_number`), and a device without one (`iSerialNumber == 0`) is still refused.
The Biomek tips (T50F, T190F, T230, T1025F, T1070), their 96-tip boxes (BC50F, BC190F, BC230,
BC1025F, BC1070), plates (Thermo96VB_PP, BCFlat96, BCDeep96Square, Thomson_24w_Square_RB, with the
lids Biomek seats on them) and reservoirs (ThermoNUNC_350CB, Reservoir, ModularReservoir),
transcribed from Biomek 5's tip and labware classes.

A tip is a `BiomekTip`, a `Tip` that also carries its cone (the radius at its end and the length
over which it widens); a well is a `BiomekWell`, a `Well` that also carries Biomek's outline of it by
height (`WellSegment`s), from which its height <-> volume table and its wall come. Biomek uses both
to place a tip near a well's wall, as `HamiltonTip` and `TecanTip` carry their instruments' data. A
tip box is a `StandingTipRack` whose tip spots sit on its top face, where the head's mandrels meet
the tips. Each resource carries Biomek's grip point (`preferred_pickup_location`). A resource
library page lists them with their part numbers.
`TipMountingShaft.serialize_state` holds the tool the shaft carries (as it serializes; None for
none), as a tip spot's state holds its tip, and `load_state` puts it back: the saved tip goes onto
the shaft (a tool of the same name held elsewhere in the tree gives way first), and a saved None
takes off the one it carries. State saved before shafts had any leaves the shaft as it is. With
it, `save_state_to_file` / `load_state_from_file` keep the tips a head carries across sessions,
which a device that cannot sense its tips needs.

Tests: a carried tip saved and read back, its own state after it; None taking a tip off; the same
tip staying; a tip of that name held elsewhere giving way.
…covery

The first part of a Beckman Coulter Biomek i7 driver that talks to the instrument's ACE boards
directly over USB (0AB5:ACE0), one board per module: the chassis and one per pod.

- `driver/framing.py`, `board.py`: length-prefixed frames packed into interrupt transfers; a board's
  replies matched to their requests by header, two-stage replies (ACCEPTED, DONE), unsolicited
  messages to subscribers.
- `driver/protocol.py`, `errors.py`: every request the Master Controller was logged sending, plus
  three reads, and nothing else; each field layout as Biomek's `ace_io` log (Log.db3) decodes it.
- `driver/master.py`, `features/chassis.py`, `features/pod.py`, `module.py`: discovery places each
  board by what it reports (Get Module ID: type and side), not by USB order or serial number, then
  reads each module's serial number, its boards with their application images and versions, and
  the names of its inputs, in the order of the Master Controller's cold start. It writes nothing
  to the boards. Unknown types or sides, two boards in one place, and no chassis are refused.
- `driver/simulator.py`, `defaults/`: boards replayed from a cold-start recording; a generic one
  ships, every serial number replaced by a placeholder.

Tests: one exact frame per command (from Biomek's `ace_io` log; three reads it never logged from
their layout), build and parse round trips, framing inverses, the replay's rules, and discovery on
the generic recording. Discovery sends the same requests as on the full driver this series comes
from.
What the boards cannot report about an instrument, declared per instrument in one JSON file
given by path (`declared_configuration_json`, now required):

- `driver/configuration.py`: `DeviceConfiguration`, the motor tables (the Master Controller's
  instrument record: each axis's Configure parameters, home position and measured hysteresis, and
  the modules' serial numbers) and per pod the conversions, travel limits, geometry and settings
  from Biomek's instrument file, with the default deck's calibrated positions and layout. Each
  source's values carry a fingerprint; a file changed after import is refused at load.
  `anonymized()` makes a generic one: no serial numbers, no measured hysteresis.
- `driver/motors.py`: the axes of each arm type and the limits read from their Configure bytes.
- `units.py`: the one place PyLabRobot's units (mm, uL, mm/s) meet Biomek's (cm, its frame, the
  speed field).
- `defaults/`: the generic configuration, one instrument's physical values with every serial number
  removed.
- Discovery refuses a pod type other than the declared one, and on the instrument a configuration
  whose serial numbers are not the modules', or the generic one. Each pod gets its type's axes and
  its declared values.

Tests: conversions give the counts Biomek's logs show for the instrument file's targets, the
bridges meet where Biomek's logged moves stopped, save / load and the changed-file refusal,
anonymizing, declared against found, the serial-number check on the instrument's own path, every
speed field round-tripping on every Z and pump, and the motor tables' limits.
… checked against them

`DeviceConfiguration.from_biomek` makes an instrument's declared configuration from its two
Biomek sources, read-only, standard library only (`biomek_files/`):

- `variant_tree.py`: Biomek's variant-tree files (the instrument file, `.bif`); a file with any
  byte it cannot account for is refused, not misread.
- `instrument_file.py`: the pods (conversions, travel, geometry, settings, gripper, obstacles),
  the default deck's calibrated positions and layout; Biomek's runtime state in the same file is
  left out.
- `master_controller.py`: the Master Controller's instrument record (its database's `instrument`
  table, or a text file of it): motor tables, home positions, measured hysteresis, the modules'
  serial numbers.
- `importer.py`: the two put together and checked against each other, each source's path, kind,
  read time and fingerprint recorded; `check_sources` reads them again and lists what changed.

On the instrument, discovery now also refuses a configuration whose sources have changed since it
was imported (a re-framed position, a re-measured hysteresis), and warns where they cannot be
found. Reading the database closes its connection.

Tests: the readers on files written in the test from the generic configuration (a small
variant-tree writer and a record writer, `files_tests_support.py`): every value kind and class
body, the refusals, the round trip from configuration to files and back, inconsistent sources,
changes found by `check_sources`, and the discovery check on the instrument's own path.
`setup()` now brings the instrument up after discovery, moving nothing: the motor tables are loaded
where a board has lost them, the interlock is armed and every axis enabled, in the order Biomek's
Master Controller logs show.

- `driver/master.py`: `initialize`, `configure`, `arm_interlock`; a fault at rest is only noted, one
  under power is reset with a warning, one that does not clear trips the interlock and shows ERROR;
  per-pod skips; `stop` stops each pod's module and trips the interlock when the driver armed it;
  a motor failing on its own, or the interlock tripping under the driver, trips it and shows ERROR,
  as the Master Controller's logs show; `pause` / `resume` (a deliberate trip with PAUSED shown,
  then re-arm and enable).
- `driver/features/chassis.py`, `door.py`: the interlock's writes, the status display, the door
  (`front_cover`), which only reports.
- `driver/features/pod.py`: configure, enable, axis states, positions, homed state.
- `driver/simulator.py`: `SimulatedAceUSB`, each axis's state and the interlock, door and drive
  supply the boards of one instrument share.
- `session_log.py`: a run's log lines in a file of its own, to compare with Biomek's logs.

Tests: the simulated boards' rules; configure sends the Configure, interlock and I/O box requests
the Master Controller sent at the recorded cold start, in its order; enabling follows its order;
faults at rest, under power and stuck; the drive supply, an open door, a broken light curtain; door
reports; pause / resume; a motor failing on its own; stop; the session log.
…sion guards

Moves in counts, planned as Biomek's Master Controller plans them, with the guards from the first X
move:

- `driver/motion.py`: the `AM` plan (each axis's speeds so all arrive together, jerk-corrected
  S-curves, the Move All timeout), the position record (position, adjusted) and the Span-8 Z
  channels' hysteresis, the order of the per-axis requests; checked against Biomek's logged moves.
- `driver/recipes/homing.py`: Home All per arm type, every request as Biomek's logs show it, homed
  axes kept or homed again (`force`).
- `driver/features/pod.py`: `move_axes` (positions read where unknown, force limits, sensor
  stops), `home`, `park`, `move_aside`, travel at a traverse height (`move_over`,
  `lift_channels`).
- `driver/x_rail.py`, `driver/pod_geometry.py`: the shared X rail; a move into the other pod's
  range is refused before anything is sent, one crossing only its running move's path waits.
- `driver/pod_collision.py`: the gripper (and what it holds) against its own pod's pipettor.
- `driver/master.py`: `home`, homing in `initialize` and `setup`, a pod left out whose X is not
  homed refuses moves beside it, `move_axes` for both pods together, `resume` moving the pods back;
  positions forgotten on a trip, a failed move, `stop` and `pause`.
- `driver/simulator.py`: positions, moves, homes and linked homes, force and sensor stops, and
  moves taking the instrument's time (`time_scale`).

Tests: a cold Home All sends, on each pod's board, the requests the Master Controller sent at the
cold start the generic recording was made from, first sent in its order; a forced Home All of a
homed instrument as Biomek's logs show it; logged `AM` moves inline; the rail and self-collision
guards; moves, homing, park, the position record; faults and positions.
A PyLabRobot deck and the instrument as a resource, in both modes, as the STAR's:

- `deck.py`: the deck in Biomek's pin grid and frame, ALPs placed by Biomek's own `column` and
  `row`, the declared configuration's layout (`BiomekI7Deck.from_configuration`).
- `resource_model/`: Biomek's ALPs and their positions (the tip-loading position's adaptor plate,
  trash disposal offsets), the bridges and pods with their heads, probes and grippers from each
  pod's declared geometry, with 3D models; Biomek's labware classes by name (`labware.py`: the
  definitions in `pylabrobot.resources.beckman_coulter`) and Biomek's touch-off distance. A pod's
  body is of category `pod`, an ordinary child of its bridge.
- `targeting.py`: from a resource on the deck to where a pod's first channel goes, with the pod's
  calibration of the deck position; `layouts.py`: a method's Instrument Setup on the deck.
- `device.py`: `BiomekI7Device` and `BiomekI7(...)`, the instrument or `simulation=True` (the
  generic instrument when given no files); the pods' models drawn from the declared configuration
  before setup and following each pod's axes after; `setup` (home, then park), `park`, `pause`,
  `resume`, `home_all`, `stop`, the deck's traverse clearance; `state_json`, the tree's state
  (`save_state_to_file`: the tips on the heads' shafts), restored when the device is built and
  carried over to the models rebuilt at setup.
- `Pod.resource`, `driver.deck`.

Tests: on the generic configuration's own deck: positions where Biomek's instrument file has them,
the models taking up the X the rail guard counts and following each axis, targets against Biomek's
logged moves, travel at the traverse height and the deck's clearance, Biomek's labware by class
name and its touch-off distance, the device in both modes.
The Span-8 pod's eight channels as a feature (`pod.pipettes`, `driver.pipettes`,
`biomek.pipettes`), STAR's `Pipettes` signatures, built as Biomek's logs show its operations:

- `driver/features/pipettes.py`: the pumps' valves (`VI` `VO` `VB` `VE`), cutoff velocity (`CV`)
  and the sensors' sensitivity (`SS`); the tip sensor (`GT`, `VT`); picking up tips in Biomek's
  press groups and discarding them by the stripper at the top of travel; priming over the wash
  station (start, stop, a set number of strokes); aspirate and dispense with mixes, conditioning,
  blowout and trailing air, tip touch; the probes' tips recorded and shown on their shafts (the
  device saves and restores them); parking over the wash station.
- `driver/liquid.py`: Biomek's pipetting templates as a plan (heights from the bottom, top or
  liquid, following the liquid, the mix, the touch-off), with any PyLabRobot container's shape.
- `techniques.py`: the argument types the features take (`Conditioning`, `TipTouch`,
  `MixHeights`, `HeightFrom`).
- The device: `setup` takes off tips the Span-8's sensor finds (`discard_tips`) and skips the
  Span-8's pod on `skip_pipettes`; the simulator's tip sensor reports the probes' recorded tips.

Tests: a full load and discard of tips, a prime, a transfer and a mix send the moves Biomek's logs
show for the same operations; press groups, partial loads with tip tracking, the tip check, travel
below the stripper; the template's mix, touch-off and heights; setup's tip discard.
The Multichannel pod's head as a feature (`pod.head96`, `driver.head96`, `biomek.head96`), as
Biomek's logs show its operations:

- `driver/features/head96.py`: tips picked up with the Master Controller's force-limited `LT`
  (only on a tip-loading position, a partial load counting the tips under the head), put back or
  discarded (the D-axis shuck over the trash); aspirate and dispense of a 96-well plate or one
  container through the same templates as the Span-8 (mix, conditioning, blowout, trailing air,
  tip touch); the tips recorded and shown on the head's shafts, which the device saves and
  restores (the head cannot sense tips).
- `driver/recipes/tip_load.py`: `LT` as Biomek sends it, its arguments from the pod's instrument
  file settings; the settle ends early when the interlock trips, as the Master Controller's does.
- `driver/recipes/homing.py`: the plunger's `HD`, run after the pod's `HM` in a Home All.
- The device: `setup` discards what the 96-head may carry (it has no tip sensor: the tips it
  records, and by default an eject over its trash as if the longest tip were on;
  `precautionary_discard`), and skips the head's pod on `skip_head96`.

Tests: `LT` and the head's pick-up, return and discard send what Biomek's logs show; a transfer
and a mix as logged; a forced Home All with the plunger's `HD` as logged; a trip ending the `LT`
settle; setup's discards.
Each pod's gripper as a feature (`pod.gripper`, where the declared configuration describes one;
`driver.gripper` and `biomek.gripper` on an instrument with one), STAR's iSWAP / core gripper
signatures, built as Biomek's logs show its grips:

- `driver/features/gripper.py`: pick up, place, move and return a resource: travel with the
  gripper turned to the grip direction at the highest height clear of the pod's own pipettor, open,
  down, a force-limited close that stops on the labware, lift clear, carry at the labware's speed,
  place; the grip checked by the control effort (`AU`, `AG`) as each pod's `SensorEnabled` says;
  what it holds counted by the rail and the pod's own collision check.
- Biomek's grip widths as the gripper's defaults (`Y_CLEARANCE`, `SQUEEZE_MM`: its labware classes
  open and close by the same margins around the labware's width), and a method step's grip side as
  a direction (`biomek_grip_direction`).
- The device hangs what the gripper holds from it in the resource tree; the simulator stops a
  close on the labware between the fingers and reads the control effort a held grip reads.

Tests: lid and plate grips on both pods send what Biomek's logs show, with and without checks; a
close on nothing is refused; Biomek's grip widths and sides; what each pod carries and the
shortcuts to it; the held stack's footprint.
`techniques.py` reads Biomek's techniques and liquid types as plain records (Biomek's field names,
as its project database stores them) and turns them into the keyword arguments the pipetting
features take (`aspirate_arguments`, `dispense_arguments`, `method_step_arguments` for a method's
step with its template's offset and approach, `for_channels` for the Span-8's per-channel lists),
which a caller splats and overrides. A technique that needs what the features do not take yet
(prewet, liquid-level sensing, clot detection, a volume calibration, a mix given as a method
variable or with two speeds) is refused rather than run without it.

Tests: a method's logged steps give the arguments `liquid_tests` checks against the logged moves;
the liquid type unless the technique overrides it; the Span-8's own values; refusals.
@cmoscy cmoscy changed the title Visualizer3D: a boundary is an outline with no fill bi7/09b: Visualizer3D: a boundary is an outline with no fill Nov 17, 2026
@cmoscy
cmoscy marked this pull request as ready for review November 17, 2026 03:49
@cmoscy
cmoscy requested a review from a team as a code owner November 17, 2026 03:49

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