Skip to content

Commit

Permalink
Engine behavior clean up and removal of unnecessary parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
CaseyBatten committed Jan 29, 2025
1 parent 1689445 commit 4e6c7c7
Show file tree
Hide file tree
Showing 17 changed files with 138 additions and 167 deletions.
7 changes: 5 additions & 2 deletions api/src/opentrons/hardware_control/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ async def move_axes(
position: Mapping[Axis, float],
speed: Optional[float] = None,
max_speeds: Optional[Dict[Axis, float]] = None,
_expect_stalls: bool = False,
expect_stalls: bool = False,
) -> None:
"""Moves the effectors of the specified axis to the specified position.
The effector of the x,y axis is the center of the carriage.
Expand Down Expand Up @@ -1249,7 +1249,10 @@ async def pick_up_tip(
await self.prepare_for_aspirate(mount)

async def tip_drop_moves(
self, mount: top_types.Mount, home_after: bool = True
self,
mount: top_types.Mount,
home_after: bool = True,
ignore_plunger: Optional[bool] = False,
) -> None:
spec, _ = self.plan_check_drop_tip(mount, home_after)

Expand Down
12 changes: 6 additions & 6 deletions api/src/opentrons/hardware_control/ot3api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@ async def move_to(
speed: Optional[float] = None,
critical_point: Optional[CriticalPoint] = None,
max_speeds: Union[None, Dict[Axis, float], OT3AxisMap[float]] = None,
_expect_stalls: bool = False,
expect_stalls: bool = False,
) -> None:
"""Move the critical point of the specified mount to a location
relative to the deck, at the specified speed."""
Expand Down Expand Up @@ -1233,15 +1233,15 @@ async def move_to(
target_position,
speed=speed,
max_speeds=checked_max,
expect_stalls=_expect_stalls,
expect_stalls=expect_stalls,
)

async def move_axes( # noqa: C901
self,
position: Mapping[Axis, float],
speed: Optional[float] = None,
max_speeds: Optional[Dict[Axis, float]] = None,
_expect_stalls: bool = False,
expect_stalls: bool = False,
) -> None:
"""Moves the effectors of the specified axis to the specified position.
The effector of the x,y axis is the center of the carriage.
Expand Down Expand Up @@ -1300,7 +1300,7 @@ async def move_axes( # noqa: C901
await self._move(
target_position=absolute_positions,
speed=speed,
expect_stalls=_expect_stalls,
expect_stalls=expect_stalls,
)

async def move_rel(
Expand All @@ -1311,7 +1311,7 @@ async def move_rel(
max_speeds: Union[None, Dict[Axis, float], OT3AxisMap[float]] = None,
check_bounds: MotionChecks = MotionChecks.NONE,
fail_on_not_homed: bool = False,
_expect_stalls: bool = False,
expect_stalls: bool = False,
) -> None:
"""Move the critical point of the specified mount by a specified
displacement in a specified direction, at the specified speed."""
Expand Down Expand Up @@ -1353,7 +1353,7 @@ async def move_rel(
speed=speed,
max_speeds=checked_max,
check_bounds=check_bounds,
expect_stalls=_expect_stalls,
expect_stalls=expect_stalls,
)

async def _cache_and_maybe_retract_mount(self, mount: OT3Mount) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ async def move_axes(
position: Mapping[Axis, float],
speed: Optional[float] = None,
max_speeds: Optional[Dict[Axis, float]] = None,
_expect_stalls: bool = False,
expect_stalls: bool = False,
) -> None:
"""Moves the effectors of the specified axis to the specified position.
The effector of the x,y axis is the center of the carriage.
Expand Down
4 changes: 3 additions & 1 deletion api/src/opentrons/legacy_commands/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,10 @@ def unseal(

def resin_tip_dispense(
instrument: InstrumentContext,
flow_rate: float,
flow_rate: float | None,
) -> command_types.PressurizeCommand:
if flow_rate is None:
flow_rate = 10 # The Protocol Engine default for Resin Tip Dispense
text = f"Pressurize pipette to dispense from resin tip at {flow_rate}uL/s."
return {
"name": command_types.PRESSURIZE,
Expand Down
8 changes: 5 additions & 3 deletions api/src/opentrons/legacy_commands/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,15 +540,17 @@ class MoveLabwareCommandPayload(TextOnlyPayload):


class SealCommandPayload(TextOnlyPayload):
pass
instrument: InstrumentContext
location: Union[None, Location, Well]


class UnsealCommandPayload(TextOnlyPayload):
pass
instrument: InstrumentContext
location: Union[None, Location, Well]


class PressurizeCommandPayload(TextOnlyPayload):
pass
instrument: InstrumentContext


class MoveLabwareCommand(TypedDict):
Expand Down
6 changes: 1 addition & 5 deletions api/src/opentrons/protocol_api/core/engine/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -701,9 +701,7 @@ def resin_tip_seal(
)
)

def resin_tip_unseal(
self, location: Location, well_core: WellCore, home_after: Optional[bool]
) -> None:
def resin_tip_unseal(self, location: Location, well_core: WellCore) -> None:
well_name = well_core.get_name()
labware_id = well_core.labware_id

Expand Down Expand Up @@ -736,7 +734,6 @@ def resin_tip_unseal(
labwareId=labware_id,
wellName=well_name,
wellLocation=well_location,
homeAfter=home_after,
)
)

Expand Down Expand Up @@ -790,7 +787,6 @@ def resin_tip_dispense(
wellLocation=well_location,
volume=volume,
flowRate=flow_rate,
pushOut=push_out,
)
)

Expand Down
1 change: 0 additions & 1 deletion api/src/opentrons/protocol_api/core/instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ def resin_tip_unseal(
self,
location: types.Location,
well_core: WellCoreType,
home_after: Optional[bool],
) -> None:
...

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ def resin_tip_unseal(
self,
location: types.Location,
well_core: WellCore,
home_after: Optional[bool],
) -> None:
raise APIVersionError(api_element="Unsealing resin tips.")

Expand All @@ -333,7 +332,7 @@ def resin_tip_dispense(
push_out: Optional[float] = None,
) -> None:
raise APIVersionError(api_element="Dispensing liquid from resin tips.")

def home(self) -> None:
"""Home the mount"""
self._protocol_interface.get_hardware().home_z(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ def resin_tip_unseal(
self,
location: types.Location,
well_core: WellCore,
home_after: Optional[bool],
) -> None:
raise APIVersionError(api_element="Unsealing resin tips.")

Expand All @@ -301,7 +300,7 @@ def resin_tip_dispense(
push_out: Optional[float] = None,
) -> None:
raise APIVersionError(api_element="Dispensing liquid from resin tips.")

def home(self) -> None:
self._protocol_interface.set_last_location(None)

Expand Down
5 changes: 1 addition & 4 deletions api/src/opentrons/protocol_api/instrument_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -1751,7 +1751,6 @@ def resin_tip_seal(
def resin_tip_unseal(
self,
location: Union[labware.Well, labware.Labware],
home_after: Optional[bool] = None,
) -> InstrumentContext:
"""Release resin tips from the pipette.
Expand Down Expand Up @@ -1784,9 +1783,7 @@ def resin_tip_unseal(
location=well,
),
):
self._core.evotip_unseal(
location=well.top(), well_core=well._core, home_after=home_after
)
self._core.resin_tip_unseal(location=well.top(), well_core=well._core)

return self

Expand Down
43 changes: 6 additions & 37 deletions api/src/opentrons/protocol_engine/commands/evotip_dispense.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ class EvotipDispenseParams(
):
"""Payload required to dispense in place."""

pushOut: Optional[float] = Field(
None,
description="Push the plunger a small amount farther than necessary for accurate low-volume dispensing",
)
pass


class EvotipDispenseResult(BaseLiquidHandlingResult):
Expand Down Expand Up @@ -110,7 +107,7 @@ async def execute(self, params: EvotipDispenseParams) -> _ExecuteReturn:
pipette_id=params.pipetteId,
volume=params.volume,
flow_rate=params.flowRate,
push_out=params.pushOut,
push_out=None,
location_if_error={
"retryLocation": (
current_position.x,
Expand All @@ -122,38 +119,10 @@ async def execute(self, params: EvotipDispenseParams) -> _ExecuteReturn:
model_utils=self._model_utils,
)

if (
isinstance(current_location, CurrentWell)
and current_location.pipette_id == params.pipetteId
):
volume_added = (
self._state_view.pipettes.get_liquid_dispensed_by_ejecting_volume(
pipette_id=params.pipetteId, volume=result.public.volume
)
)
if volume_added is not None:
volume_added *= self._state_view.geometry.get_nozzles_per_well(
current_location.labware_id,
current_location.well_name,
params.pipetteId,
)
return SuccessData(
public=EvotipDispenseResult(volume=result.public.volume),
state_update=result.state_update.set_liquid_operated(
labware_id=current_location.labware_id,
well_names=self._state_view.geometry.get_wells_covered_by_pipette_with_active_well(
current_location.labware_id,
current_location.well_name,
params.pipetteId,
),
volume_added=volume_added if volume_added is not None else CLEAR,
),
)
else:
return SuccessData(
public=EvotipDispenseResult(volume=result.public.volume),
state_update=result.state_update,
)
return SuccessData(
public=EvotipDispenseResult(volume=result.public.volume),
state_update=result.state_update,
)


class EvotipDispense(
Expand Down
Loading

0 comments on commit 4e6c7c7

Please sign in to comment.