Skip to content

Commit

Permalink
Update Protocol Engine to only change hardware state only if the tip …
Browse files Browse the repository at this point in the history
…drop succeeds.

This is, finally, the part that makes the actual behavioral change and fixes the actual bug.

Having split up drop_tip(), we can now do the hardware API's state updates only after we've verified that the tip drop has physically  succeeded. This mirrors what Protocol Engine does for its own state after tip drop errors--see TipPhysicallyAttachedError.
  • Loading branch information
SyntaxColoring committed Oct 17, 2024
1 parent c65dc75 commit 02965ad
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion api/src/opentrons/protocol_engine/execution/tip_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ async def pick_up_tip(
await self._hardware_api.tip_pickup_moves(
mount=hw_mount, presses=None, increment=None
)
# Allow TipNotAttachedError to propagate.
await self.verify_tip_presence(pipette_id, TipPresenceStatus.PRESENT)

self._hardware_api.cache_tip(hw_mount, actual_tip_length)
Expand All @@ -248,6 +249,9 @@ async def pick_up_tip(
tiprack_diameter=nominal_tip_geometry.diameter,
)

# todo(mm, 2024-10-15): The hardware API's original pick_up_tip() implementation
# seems to set the *current* volume to 0, not the working volume.
# Investigate that discrepancy.
self._hardware_api.set_working_volume(
mount=hw_mount,
tip_volume=nominal_tip_geometry.volume,
Expand All @@ -270,9 +274,14 @@ async def drop_tip(self, pipette_id: str, home_after: Optional[bool]) -> None:
else:
kwargs = {}

await self._hardware_api.drop_tip(mount=hw_mount, **kwargs)
await self._hardware_api.drop_tip_moves(mount=hw_mount, **kwargs)

# Allow TipNotAttachedError to propagate.
await self.verify_tip_presence(pipette_id, TipPresenceStatus.ABSENT)

await self._hardware_api.remove_tip(hw_mount)
self._hardware_api.set_current_tiprack_diameter(hw_mount, 0)

async def add_tip(self, pipette_id: str, tip: TipGeometry) -> None:
"""See documentation on abstract base class."""
hw_mount = self._state_view.pipettes.get_mount(pipette_id).to_hw_mount()
Expand Down

0 comments on commit 02965ad

Please sign in to comment.