Skip to content

Commit

Permalink
add new speed for emulsifying pipette plunger
Browse files Browse the repository at this point in the history
  • Loading branch information
caila-marashaj committed Nov 20, 2024
1 parent a34f2be commit 061cf6c
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 1 deletion.
1 change: 1 addition & 0 deletions api/src/opentrons/config/defaults_ot3.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
DEFAULT_GRIPPER_MOUNT_OFFSET: Final[Offset] = (84.55, -12.75, 93.85)
DEFAULT_SAFE_HOME_DISTANCE: Final = 5
DEFAULT_CALIBRATION_AXIS_MAX_SPEED: Final = 30
DEFAULT_EMULSIFYING_PIPETTE_AXIS_MAX_SPEED: Final = 90

DEFAULT_MAX_SPEEDS: Final[ByGantryLoad[Dict[OT3AxisKind, float]]] = ByGantryLoad(
high_throughput={
Expand Down
5 changes: 5 additions & 0 deletions api/src/opentrons/hardware_control/backends/flex_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ def update_constraints_for_calibration_with_gantry_load(
) -> None:
...

def update_constraints_for_emulsifying_pipette(
self, mount: OT3Mount, gantry_load: GantryLoad
) -> None:
...

def update_constraints_for_plunger_acceleration(
self, mount: OT3Mount, acceleration: float, gantry_load: GantryLoad
) -> None:
Expand Down
13 changes: 13 additions & 0 deletions api/src/opentrons/hardware_control/backends/ot3controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
get_system_constraints,
get_system_constraints_for_calibration,
get_system_constraints_for_plunger_acceleration,
get_system_constraints_for_emulsifying_pipette,
)
from .tip_presence_manager import TipPresenceManager

Expand Down Expand Up @@ -393,6 +394,18 @@ def update_constraints_for_calibration_with_gantry_load(
f"Set system constraints for calibration: {self._move_manager.get_constraints()}"
)

def update_constraints_for_emulsifying_pipette(
self, mount: OT3Mount, gantry_load: GantryLoad
) -> None:
self._move_manager.update_constraints(
get_system_constraints_for_emulsifying_pipette(
self._configuration.motion_settings, gantry_load, mount
)
)
log.debug(
f"Set system constraints for emulsifying pipette: {self._move_manager.get_constraints()}"
)

def update_constraints_for_gantry_load(self, gantry_load: GantryLoad) -> None:
self._move_manager.update_constraints(
get_system_constraints(self._configuration.motion_settings, gantry_load)
Expand Down
5 changes: 5 additions & 0 deletions api/src/opentrons/hardware_control/backends/ot3simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ def update_constraints_for_calibration_with_gantry_load(
) -> None:
self._sim_gantry_load = gantry_load

def update_constraints_for_emulsifying_pipette(
self, mount: OT3Mount, gantry_load: GantryLoad
) -> None:
pass

def update_constraints_for_plunger_acceleration(
self, mount: OT3Mount, acceleration: float, gantry_load: GantryLoad
) -> None:
Expand Down
30 changes: 29 additions & 1 deletion api/src/opentrons/hardware_control/backends/ot3utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
from typing import Dict, Iterable, List, Set, Tuple, TypeVar, cast, Sequence, Optional
from typing_extensions import Literal
from logging import getLogger
from opentrons.config.defaults_ot3 import DEFAULT_CALIBRATION_AXIS_MAX_SPEED
from opentrons.config.defaults_ot3 import (
DEFAULT_CALIBRATION_AXIS_MAX_SPEED,
DEFAULT_EMULSIFYING_PIPETTE_AXIS_MAX_SPEED,
)
from opentrons.config.types import OT3MotionSettings, OT3CurrentSettings, GantryLoad
from opentrons.hardware_control.types import (
Axis,
Expand Down Expand Up @@ -300,6 +303,31 @@ def get_system_constraints_for_plunger_acceleration(
return new_constraints


def get_system_constraints_for_emulsifying_pipette(
config: OT3MotionSettings,
gantry_load: GantryLoad,
mount: OT3Mount,
) -> "SystemConstraints[Axis]":
old_constraints = config.by_gantry_load(gantry_load)
new_constraints = {}
axis_kinds = set([k for _, v in old_constraints.items() for k in v.keys()])
for axis_kind in axis_kinds:
for axis in Axis.of_kind(axis_kind):
if axis == Axis.of_main_tool_actuator(mount):
_max_speed = float(DEFAULT_EMULSIFYING_PIPETTE_AXIS_MAX_SPEED)
else:
_max_speed = old_constraints["max_speed"][axis_kind]
new_constraints[axis] = AxisConstraints.build(
max_acceleration=old_constraints["max_acceleration"][axis_kind],
max_speed_discont=old_constraints["max_speed_discontinuity"][axis_kind],
max_direction_change_speed_discont=old_constraints[
"direction_change_speed_discontinuity"
][axis_kind],
max_speed=_max_speed,
)
return new_constraints


def _convert_to_node_id_dict(
axis_pos: Coordinates[Axis, CoordinateValue],
) -> NodeIdMotionValues:
Expand Down
14 changes: 14 additions & 0 deletions api/src/opentrons/hardware_control/ot3api.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
)
from opentrons_shared_data.pipette import (
pipette_load_name_conversions as pipette_load_name,
pipette_definition,
)
from opentrons_shared_data.robot.types import RobotType

Expand Down Expand Up @@ -634,10 +635,23 @@ async def cache_pipette(
self._feature_flags.use_old_aspiration_functions,
)
self._pipette_handler.hardware_instruments[mount] = p
if config is not None:
self._confirm_pipette_motion_constraints(mount, instrument_config=config)
# TODO (lc 12-5-2022) Properly support backwards compatibility
# when applicable
return skipped

def _confirm_pipette_motion_constraints(
self,
mount: OT3Mount,
instrument_config: pipette_definition.PipetteConfigurations,
) -> None:
display_name = instrument_config.display_name
if display_name == "FLEX 8-Channel Emulsifying 1000 μL":
self._backend.update_constraints_for_emulsifying_pipette(
mount, self.gantry_load
)

async def cache_gripper(self, instrument_data: AttachedGripper) -> bool:
"""Set up gripper based on scanned information."""
grip_cal = load_gripper_calibration_offset(instrument_data.get("id"))
Expand Down

0 comments on commit 061cf6c

Please sign in to comment.