Skip to content

feat(opentrons): Opentrons Flex liquid handler driver#1184

Open
vcjdeboer wants to merge 13 commits into
PyLabRobot:v1b1from
vcjdeboer:feat/opentrons-plain-class
Open

feat(opentrons): Opentrons Flex liquid handler driver#1184
vcjdeboer wants to merge 13 commits into
PyLabRobot:v1b1from
vcjdeboer:feat/opentrons-plain-class

Conversation

@vcjdeboer

Copy link
Copy Markdown
Contributor

Summary

Adds a driver for the Opentrons Flex liquid handler, following the plain-class device-driver architecture in docs/contributor_guide/device-driver-guide.md.

What's included

  • pylabrobot/opentrons/robot.pyOpentronsRobot, an abc.ABC base that owns the HTTP connection to the Opentrons robot server (the runs/commands API on port 31950), the run and command lifecycle, and instrument (pipette) discovery. It is shared so that additional Opentrons robots can reuse the same transport and protocol.
  • pylabrobot/opentrons/flex.pyOpentronsFlex(OpentronsRobot). Async setup() / stop() plus the liquid-handling operations pick_up_tips, drop_tips, aspirate, and dispense, using PyLabRobot's standard liquid-handling signatures (resources, vols, use_channels, …). Tip and volume state is recorded on the resource-tree trackers (TipSpot / Well), gated by the global does_tip_tracking() / does_volume_tracking() switches.
  • ResourcesFlexDeck (the Flex A1–D3 grid plus staging area, modeled as a Deck whose slots are ResourceHolder children) and the Flex 96-tip-rack definitions, under pylabrobot/resources/opentrons/.
  • Docs — a hello-world notebook at docs/user_guide/opentrons/flex/hello-world.ipynb and an API reference page (docs/api/pylabrobot.opentrons.rst).

Transport

The Flex is controlled over HTTP. As PyLabRobot has no pylabrobot.io HTTP transport, the driver holds an httpx.AsyncClient directly. This is OS-agnostic (Windows/macOS/Linux).

Not yet verified on hardware

This driver has not been checked against a physical Flex; setup() emits a warning to that effect. Behavior is exercised against a simulation of the command layer, with the resource-tree tracking verified in both the tracking-on and tracking-off states.

Scope

Included: tip pickup/drop and aspirate/dispense through the standard liquid-handling API, including drop-to-trash via the movable trash addressable area.

Future work (not in this PR): the 96-channel head, single-tip / nozzle-layout configuration, liquid probing, and modules.

Checks

  • ruff format and ruff check clean; mypy clean; 2-space indentation.

vcjdeboer and others added 13 commits July 23, 2026 10:32
…o resource trackers

Adds OpentronsFlex(OpentronsRobot): _model_setup homes the gantry;
pick_up_tips/drop_tips commit tip state to TipSpot.tracker (remove_tip/
add_tip + commit) rather than a private per-device copy. Only which
physical channel holds which tip is device-local state
(self._channel_tips). Trash drops use the addressable-area path
(moveToAddressableAreaForDropTip + dropTipInPlace) and skip the tracker
add. JIT labware loading and load-name resolution ported verbatim from
titronic plr_v4/flex/head8_backend.py.

wellName is derived via TipRack.get_child_identifier(tip_spot) — the
canonical PLR API for item->identifier — not string-splitting spot.name
(which is prefixed with the rack name, e.g. "tips_A1").
Removes narrative comments referencing source origins (titronic, plr_v4)
in favor of pure behavioral descriptions. Fixes lines 14-15 (flow-rate
comment) and 169-173 (wellLocation docstring).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…dict returns

Casts httpx JSON returns instead of leaking Any; narrows self.pipette and
TipSpot/Container.parent with explicit asserts instead of unchecked attribute
access; types _loaded_labware and _channel_tips precisely. Behavior unchanged
(harness still passes all sections).
Adds docs/user_guide/opentrons/flex/hello-world.ipynb covering setup(),
pick_up_tips, aspirate, dispense, and drop_tips on the plain-class
OpentronsFlex with a FlexDeck, a flex_96_tiprack_50ul, and a Corning 96-well
plate. Wires it into the opentrons/index toctree (opentrons/index was
already listed in the Manufacturers toctree in user_guide/index.md).
Documents OpentronsRobot/OpentronsFlex/OpentronsError/PipetteInfo in
docs/api/pylabrobot.opentrons.rst (already referenced from pylabrobot.rst).
…es from resources

Apply ruff format to standardize code layout. Remove [Capability Branch] markers
and reword docstrings that referenced PIP capability/FlexPIPBackend, replacing
with factual descriptions of what the racks and deck are (Opentrons Flex device
definitions with ot_load_name for the robot's labware system).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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