Skip to content

Commit

Permalink
fix plunger command calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Laura-Danielle committed Nov 1, 2024
1 parent 12d7673 commit e69917f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
13 changes: 7 additions & 6 deletions api/src/opentrons/protocol_api/core/engine/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,12 @@ 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, function_version
self, pipette_settings, ul: float, action: PipetteActionTypes, function_version: str
) -> float:
if action == "aspirate":
sequence = pipette_settings.aspirate.default[function_version]
elif action == "blowout":
if action == PipetteActionTypes.ASPIRATE_ACTION:
sequence = pipette_settings.aspirate.default.get(function_version, )
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]
Expand All @@ -72,15 +73,15 @@ def get_pipette_type_from_engine(self, mount: Union[Mount, str]) -> Optional[str
return maybe_pipette.pipetteName if maybe_pipette else None

def get_plunger_position_from_name(
self, mount: Mount, position_name: PipetteActionTypes
self, mount: Mount, position_name: PlungerPositionTypes
) -> float:
maybe_pipette_state = self._sync_hardware_api.get_attached_instrument(mount)
if not maybe_pipette_state:
return 0.0
return maybe_pipette_state["plunger_positions"][position_name.value]

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:
maybe_pipette_state = self._sync_hardware_api.get_attached_instrument(mount)
if not maybe_pipette_state:
Expand Down
6 changes: 2 additions & 4 deletions api/src/opentrons/protocol_api/robot_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,12 @@ def plunger_coordinates_for_volume(
"""
pipette_name = self._core.get_pipette_type_from_engine(mount)
mount = validation.ensure_mount_for_pipette(mount, pipette_name)
mount_axis = AxisType.axis_for_mount(mount)
pipette_axis = AxisType.plunger_axis_for_mount(mount)

pipette_position = self._core.get_plunger_position_from_volume(
mount, volume, action, self._protocol_core.robot_type
)
return {mount_axis: 0.0, pipette_axis: pipette_position}
return {pipette_axis: pipette_position}

def plunger_coordinates_for_named_position(
self, mount: Union[Mount, str], position_name: PipetteActionTypes
Expand All @@ -227,12 +226,11 @@ def plunger_coordinates_for_named_position(
pipette_name = self._core.get_pipette_type_from_engine(mount)

mount = validation.ensure_mount_for_pipette(mount, pipette_name)
mount_axis = AxisType.axis_for_mount(mount)
pipette_axis = AxisType.plunger_axis_for_mount(mount)
pipette_position = self._core.get_plunger_position_from_name(
mount, position_name
)
return {mount_axis: 0.0, pipette_axis: pipette_position}
return {pipette_axis: pipette_position}

def build_axis_map(self, axis_map: StringAxisMap) -> AxisMapType:
"""Take in a :py:class:`.types.StringAxisMap` and output a :py:class:`.types.AxisMapType`.
Expand Down

0 comments on commit e69917f

Please sign in to comment.