From d7165c762c3bb97a3ec97cd62a09f8b170d61e39 Mon Sep 17 00:00:00 2001 From: Ryan howard Date: Tue, 2 Apr 2024 15:05:03 -0400 Subject: [PATCH] bring back z discontinuity speed changes --- .../gravimetric/liquid_class/pipetting.py | 36 +++++++++++++++---- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/hardware-testing/hardware_testing/gravimetric/liquid_class/pipetting.py b/hardware-testing/hardware_testing/gravimetric/liquid_class/pipetting.py index 0e4d79430213..9f059559f133 100644 --- a/hardware-testing/hardware_testing/gravimetric/liquid_class/pipetting.py +++ b/hardware-testing/hardware_testing/gravimetric/liquid_class/pipetting.py @@ -2,9 +2,11 @@ from dataclasses import dataclass from typing import Optional, Callable, Tuple +from opentrons.config.defaults_ot3 import DEFAULT_MAX_SPEED_DISCONTINUITY from opentrons.protocol_api import InstrumentContext, ProtocolContext from opentrons.protocol_api.labware import Well +from hardware_testing.opentrons_api.types import OT3AxisKind from hardware_testing.gravimetric import config from hardware_testing.gravimetric.workarounds import get_sync_hw_api from hardware_testing.gravimetric.liquid_height.height import LiquidTracker @@ -127,10 +129,33 @@ def _retract( channel_offset: Point, mm_above_well_bottom: float, speed: float, + z_discontinuity: float, ) -> None: + # change discontinuity per the liquid-class settings + hw_api = ctx._core.get_hardware() + if pipette.channels == 96: + hw_api.config.motion_settings.max_speed_discontinuity.high_throughput[ + OT3AxisKind.Z + ] = z_discontinuity + else: + hw_api.config.motion_settings.max_speed_discontinuity.low_throughput[ + OT3AxisKind.Z + ] = z_discontinuity + # NOTE: re-setting the gantry-load will reset the move-manager's per-axis constraints + hw_api.set_gantry_load(hw_api.gantry_load) # retract out of the liquid (not out of the well) pipette.move_to(well.bottom(mm_above_well_bottom).move(channel_offset), speed=speed) + # reset discontinuity back to default + if pipette.channels == 96: + hw_api.config.motion_settings.max_speed_discontinuity.high_throughput[ + OT3AxisKind.Z + ] = DEFAULT_MAX_SPEED_DISCONTINUITY.high_throughput[OT3AxisKind.Z] + else: + hw_api.config.motion_settings.max_speed_discontinuity.low_throughput[ + OT3AxisKind.Z + ] = DEFAULT_MAX_SPEED_DISCONTINUITY.low_throughput[OT3AxisKind.Z] # NOTE: re-setting the gantry-load will reset the move-manager's per-axis constraints + hw_api.set_gantry_load(hw_api.gantry_load) def _pipette_with_liquid_settings( # noqa: C901 @@ -186,9 +211,11 @@ def _get_max_blow_out_ul() -> float: if aspirate or mix: submerge_speed = config.TIP_SPEED_WHILE_SUBMERGING_ASPIRATE retract_speed = config.TIP_SPEED_WHILE_RETRACTING_ASPIRATE + _z_disc = liquid_class.aspirate.z_retract_discontinuity else: submerge_speed = config.TIP_SPEED_WHILE_SUBMERGING_DISPENSE retract_speed = config.TIP_SPEED_WHILE_RETRACTING_DISPENSE + _z_disc = liquid_class.dispense.z_retract_discontinuity # CREATE CALLBACKS FOR EACH PHASE def _aspirate_on_approach() -> None: @@ -229,12 +256,7 @@ def _aspirate_on_mix() -> None: ctx.delay(liquid_class.dispense.delay) # don't go all the way up to retract position, but instead just above liquid _retract( - ctx, - pipette, - well, - channel_offset, - approach_mm, - retract_speed, + ctx, pipette, well, channel_offset, approach_mm, retract_speed, _z_disc ) pipette.blow_out() pipette.prepare_to_aspirate() @@ -306,7 +328,7 @@ def _dispense_on_retract() -> None: # PHASE 3: RETRACT callbacks.on_retracting() - _retract(ctx, pipette, well, channel_offset, retract_mm, retract_speed) + _retract(ctx, pipette, well, channel_offset, retract_mm, retract_speed, _z_disc) _aspirate_on_retract() if aspirate else _dispense_on_retract() # EXIT