Skip to content

Commit

Permalink
actually fix plunger movement
Browse files Browse the repository at this point in the history
  • Loading branch information
Laura-Danielle committed Nov 3, 2024
1 parent 886a895 commit 7829886
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
1 change: 0 additions & 1 deletion api/src/opentrons/hardware_control/dev_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
PipetteConfigurations,
SupportedTipsDefinition,
PipetteBoundingBoxOffsetDefinition,
PlungerPositions,
)
from opentrons_shared_data.gripper import (
GripperModel,
Expand Down
20 changes: 9 additions & 11 deletions api/src/opentrons/protocol_api/core/engine/robot.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Optional, Dict, Union
from opentrons.hardware_control import SyncHardwareAPI
from opentrons_shared_data.pipette.pipette_definition import SupportedTipsDefinition

from opentrons.types import Mount, MountType, Point, AxisType, AxisMapType
from opentrons_shared_data.pipette import types as pip_types
Expand Down Expand Up @@ -49,15 +50,17 @@ def _convert_to_engine_mount(self, axis_map: AxisMapType) -> Dict[MotorAxis, flo
return {_AXIS_TYPE_TO_MOTOR_AXIS[ax]: dist for ax, dist in axis_map.items()}

def _ul_per_mm_conversion(
self, pipette_settings, ul: float, action: PipetteActionTypes, function_version: str
self, pipette_settings: SupportedTipsDefinition, ul: float, action: PipetteActionTypes
) -> float:
if action == PipetteActionTypes.ASPIRATE_ACTION:
sequence = pipette_settings.aspirate.default.get(function_version, )
fallback = pipette_settings.aspirate.default[PIPETTING_FUNCTION_FALLBACK_VERSION]
sequence = pipette_settings.aspirate.default.get(PIPETTING_FUNCTION_LATEST_VERSION, fallback)
elif action == PipetteActionTypes.BLOWOUT_ACTION:
# TODO in followup work we should support handling blow out actions for volume.
return 1.0
else:
sequence = pipette_settings.dispense.default[function_version]
fallback = pipette_settings.aspirate.default[PIPETTING_FUNCTION_FALLBACK_VERSION]
sequence = pipette_settings.dispense.default.get(PIPETTING_FUNCTION_LATEST_VERSION, fallback)
return piecewise_volume_conversion(ul, sequence)

def get_pipette_type_from_engine(self, mount: Union[Mount, str]) -> Optional[str]:
Expand Down Expand Up @@ -91,17 +94,12 @@ def get_plunger_position_from_volume(
)
tip_settings = maybe_pipette_state["supported_tips"][converted_working_volume]
plunger_bottom = maybe_pipette_state["plunger_positions"]["bottom"]

convert_volume = self._ul_per_mm_conversion(tip_settings, volume, action)
mm = volume / convert_volume
if robot_type == "OT-2 Standard":
convert_volume = self._ul_per_mm_conversion(
tip_settings, volume, action, PIPETTING_FUNCTION_FALLBACK_VERSION
)
mm = volume / convert_volume
position = plunger_bottom + mm
else:
convert_volume = self._ul_per_mm_conversion(
tip_settings, volume, action, PIPETTING_FUNCTION_LATEST_VERSION
)
mm = volume / convert_volume
position = plunger_bottom - mm
return round(position, 6)

Expand Down
4 changes: 2 additions & 2 deletions api/src/opentrons/protocol_api/core/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ def get_pipette_type_from_engine(self, mount: Union[Mount, str]) -> Optional[str

@abstractmethod
def get_plunger_position_from_volume(
self, mount: Mount, volume: float, action: PlungerPositionTypes, robot_type: str
self, mount: Mount, volume: float, action: PipetteActionTypes, robot_type: str
) -> float:
...

@abstractmethod
def get_plunger_position_from_name(
self, mount: Mount, position_name: PipetteActionTypes
self, mount: Mount, position_name: PlungerPositionTypes
) -> float:
...

Expand Down

0 comments on commit 7829886

Please sign in to comment.