Skip to content

Commit

Permalink
bring in the discontinuity changes in z retract on exiting the water
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanthecoder committed Apr 3, 2024
1 parent cb1497b commit 3d56e51
Showing 1 changed file with 29 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3d56e51

Please sign in to comment.