Skip to content

Commit

Permalink
fix(api): Speed up unnecessarily slow "prep" plunger motions (#16022)
Browse files Browse the repository at this point in the history
  • Loading branch information
andySigler authored Aug 19, 2024
1 parent 322109a commit da7918e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
27 changes: 13 additions & 14 deletions api/src/opentrons/hardware_control/ot3api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1877,12 +1877,10 @@ async def _move_to_plunger_bottom(
With wet tips, the primary concern is leftover droplets inside the tip.
These droplets ideally only move down and out of the tip, not up into the tip.
Therefore, it is preferable to use the "blow-out" speed when moving the
plunger down, and the slower "aspirate" speed when moving the plunger up.
Therefore, it is preferable to use the slower "aspirate" speed when
moving the plunger up after a blow-out.
Assume all tips are wet, because we do not differentiate between wet/dry tips.
When no tip is attached, moving at the max speed is preferable, to save time.
All other situations, moving at the max speed is preferable, to save time.
"""
checked_mount = OT3Mount.from_mount(mount)
instrument = self._pipette_handler.get_pipette(checked_mount)
Expand All @@ -1895,21 +1893,22 @@ async def _move_to_plunger_bottom(
self._current_position,
)
pip_ax = Axis.of_main_tool_actuator(checked_mount)
# speed depends on if there is a tip, and which direction to move
if instrument.has_tip_length:
# save time while moving down by using max speed
max_speeds = self.config.motion_settings.default_max_speed
speed_down = max_speeds[self.gantry_load][OT3AxisKind.P]
# upward moves can be max speed, or aspirate speed
# use the (slower) aspirate if there is a tip and we're following a blow-out
plunger_is_below_bottom_pos = (
self._current_position[pip_ax] > instrument.plunger_positions.bottom
)
if instrument.has_tip_length and plunger_is_below_bottom_pos:
# using slower aspirate flow-rate, to avoid pulling droplets up
speed_up = self._pipette_handler.plunger_speed(
instrument, instrument.aspirate_flow_rate, "aspirate"
)
# use blow-out flow-rate, so we can push droplets out
speed_down = self._pipette_handler.plunger_speed(
instrument, instrument.blow_out_flow_rate, "dispense"
)
else:
# save time by using max speed
max_speeds = self.config.motion_settings.default_max_speed
# either no tip, or plunger just homed, so tip is dry
speed_up = max_speeds[self.gantry_load][OT3AxisKind.P]
speed_down = speed_up
# IMPORTANT: Here is our backlash compensation.
# The plunger is pre-loaded in the "aspirate" direction
backlash_pos = target_pos.copy()
Expand Down
8 changes: 3 additions & 5 deletions api/tests/opentrons/hardware_control/test_ot3_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1663,13 +1663,11 @@ async def test_move_to_plunger_bottom(
backlash_pos[pip_ax] += pipette.backlash_distance

# plunger will move at different speeds, depending on if:
# - no tip attached (max speed)
# - tip attached and moving down (blowout speed)
# - tip not attached (max speed)
# - tip attached and moving down (max speed)
# - tip attached and moving up (aspirate speed)
expected_speed_no_tip = max_speeds[ot3_hardware.gantry_load][OT3AxisKind.P]
expected_speed_moving_down = ot3_hardware._pipette_handler.plunger_speed(
pipette, pipette.blow_out_flow_rate, "dispense"
)
expected_speed_moving_down = expected_speed_no_tip
expected_speed_moving_up = ot3_hardware._pipette_handler.plunger_speed(
pipette, pipette.aspirate_flow_rate, "aspirate"
)
Expand Down

0 comments on commit da7918e

Please sign in to comment.