feat(opentrons): Opentrons Flex liquid handler driver#1184
Open
vcjdeboer wants to merge 13 commits into
Open
Conversation
…rotocol + discovery)
…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").
…ure, volume trackers
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>
…tive, note httpx transport
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.py—OpentronsRobot, anabc.ABCbase 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.py—OpentronsFlex(OpentronsRobot). Asyncsetup()/stop()plus the liquid-handling operationspick_up_tips,drop_tips,aspirate, anddispense, 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 globaldoes_tip_tracking()/does_volume_tracking()switches.FlexDeck(the Flex A1–D3 grid plus staging area, modeled as aDeckwhose slots areResourceHolderchildren) and the Flex 96-tip-rack definitions, underpylabrobot/resources/opentrons/.docs/user_guide/opentrons/flex/hello-world.ipynband an API reference page (docs/api/pylabrobot.opentrons.rst).Transport
The Flex is controlled over HTTP. As PyLabRobot has no
pylabrobot.ioHTTP transport, the driver holds anhttpx.AsyncClientdirectly. 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 formatandruff checkclean;mypyclean; 2-space indentation.