diff --git a/api/src/opentrons/protocol_api/core/engine/instrument.py b/api/src/opentrons/protocol_api/core/engine/instrument.py index abb5f3862ce..ece3d74ada0 100644 --- a/api/src/opentrons/protocol_api/core/engine/instrument.py +++ b/api/src/opentrons/protocol_api/core/engine/instrument.py @@ -310,10 +310,12 @@ def blow_out( well_name = well_core.get_name() labware_id = well_core.labware_id - well_location = self._engine_client.state.geometry.get_relative_liquid_handling_well_location( - labware_id=labware_id, - well_name=well_name, - absolute_point=location.point, + well_location = ( + self._engine_client.state.geometry.get_relative_well_location( + labware_id=labware_id, + well_name=well_name, + absolute_point=location.point, + ) ) pipette_movement_conflict.check_safe_for_pipette_movement( engine_state=self._engine_client.state, diff --git a/api/src/opentrons/protocol_engine/__init__.py b/api/src/opentrons/protocol_engine/__init__.py index 2c8171a0e83..25599189916 100644 --- a/api/src/opentrons/protocol_engine/__init__.py +++ b/api/src/opentrons/protocol_engine/__init__.py @@ -52,6 +52,7 @@ DropTipWellLocation, WellOrigin, DropTipWellOrigin, + PickUpTipWellOrigin, WellOffset, ModuleModel, ModuleDefinition, @@ -116,6 +117,7 @@ "DropTipWellLocation", "WellOrigin", "DropTipWellOrigin", + "PickUpTipWellOrigin", "WellOffset", "ModuleModel", "ModuleDefinition", diff --git a/api/src/opentrons/protocol_engine/commands/blow_out.py b/api/src/opentrons/protocol_engine/commands/blow_out.py index 0ded626da62..9954ef07cfa 100644 --- a/api/src/opentrons/protocol_engine/commands/blow_out.py +++ b/api/src/opentrons/protocol_engine/commands/blow_out.py @@ -9,7 +9,7 @@ from .pipetting_common import ( PipetteIdMixin, FlowRateMixin, - LiquidHandlingWellLocationMixin, + WellLocationMixin, DestinationPositionResult, ) from .command import AbstractCommandImpl, BaseCommand, BaseCommandCreate, SuccessData @@ -25,7 +25,7 @@ BlowOutCommandType = Literal["blowout"] -class BlowOutParams(PipetteIdMixin, FlowRateMixin, LiquidHandlingWellLocationMixin): +class BlowOutParams(PipetteIdMixin, FlowRateMixin, WellLocationMixin): """Payload required to blow-out a specific well.""" pass diff --git a/api/src/opentrons/protocol_engine/state/geometry.py b/api/src/opentrons/protocol_engine/state/geometry.py index 7740b622a5f..42ef50d110b 100644 --- a/api/src/opentrons/protocol_engine/state/geometry.py +++ b/api/src/opentrons/protocol_engine/state/geometry.py @@ -675,7 +675,9 @@ def convert_pick_up_tip_well_location( self, well_location: PickUpTipWellLocation ) -> WellLocation: """Convert PickUpTipWellLocation to WellLocation.""" - return WellLocation(origin=well_location.origin, offset=well_location.offset) + return WellLocation( + origin=WellOrigin(well_location.origin.value), offset=well_location.offset + ) # TODO(jbl 11-30-2023) fold this function into get_ancestor_slot_name see RSS-411 def _get_staging_slot_name(self, labware_id: str) -> str: diff --git a/api/src/opentrons/protocol_engine/types.py b/api/src/opentrons/protocol_engine/types.py index 1994a67a190..72daafd3a52 100644 --- a/api/src/opentrons/protocol_engine/types.py +++ b/api/src/opentrons/protocol_engine/types.py @@ -205,6 +205,7 @@ class WellOrigin(str, Enum): TOP: the top-center of the well BOTTOM: the bottom-center of the well CENTER: the middle-center of the well + MENISCUS: the meniscus-center of the well """ TOP = "top" @@ -213,6 +214,20 @@ class WellOrigin(str, Enum): MENISCUS = "meniscus" +class PickUpTipWellOrigin(str, Enum): + """The origin of a PickUpTipWellLocation offset. + + Props: + TOP: the top-center of the well + BOTTOM: the bottom-center of the well + CENTER: the middle-center of the well + """ + + TOP = "top" + BOTTOM = "bottom" + CENTER = "center" + + class DropTipWellOrigin(str, Enum): """The origin of a DropTipWellLocation offset. @@ -260,7 +275,7 @@ class LiquidHandlingWellLocation(BaseModel): offset: WellOffset = Field(default_factory=WellOffset) volumeOffset: Union[float, Literal["operationVolume"]] = Field( default=0.0, - description="""A volume of liquid, in µL, to offset the z-axis offset. When "operationVolume" is specified, this volume is pulled from the volume command parameter.""", + description="""A volume of liquid, in µL, to offset the z-axis offset. When "operationVolume" is specified, this volume is pulled from the command volume parameter.""", ) @@ -270,7 +285,7 @@ class PickUpTipWellLocation(BaseModel): To be used for picking up tips. """ - origin: WellOrigin = WellOrigin.TOP + origin: PickUpTipWellOrigin = PickUpTipWellOrigin.TOP offset: WellOffset = Field(default_factory=WellOffset) diff --git a/api/tests/opentrons/protocol_api/core/engine/test_instrument_core.py b/api/tests/opentrons/protocol_api/core/engine/test_instrument_core.py index b7c1b82d5be..3883d150067 100644 --- a/api/tests/opentrons/protocol_api/core/engine/test_instrument_core.py +++ b/api/tests/opentrons/protocol_api/core/engine/test_instrument_core.py @@ -20,6 +20,7 @@ PickUpTipWellLocation, WellOffset, WellOrigin, + PickUpTipWellOrigin, DropTipWellLocation, DropTipWellOrigin, ) @@ -266,7 +267,9 @@ def test_pick_up_tip( absolute_point=Point(1, 2, 3), ) ).then_return( - PickUpTipWellLocation(origin=WellOrigin.TOP, offset=WellOffset(x=3, y=2, z=1)) + PickUpTipWellLocation( + origin=PickUpTipWellOrigin.TOP, offset=WellOffset(x=3, y=2, z=1) + ) ) subject.pick_up_tip( @@ -288,7 +291,7 @@ def test_pick_up_tip( labware_id="labware-id", well_name="well-name", well_location=PickUpTipWellLocation( - origin=WellOrigin.TOP, offset=WellOffset(x=3, y=2, z=1) + origin=PickUpTipWellOrigin.TOP, offset=WellOffset(x=3, y=2, z=1) ), ), mock_engine_client.execute_command( @@ -297,7 +300,7 @@ def test_pick_up_tip( labwareId="labware-id", wellName="well-name", wellLocation=PickUpTipWellLocation( - origin=WellOrigin.TOP, offset=WellOffset(x=3, y=2, z=1) + origin=PickUpTipWellOrigin.TOP, offset=WellOffset(x=3, y=2, z=1) ), ) ), @@ -620,14 +623,10 @@ def test_blow_out_to_well( ) decoy.when( - mock_engine_client.state.geometry.get_relative_liquid_handling_well_location( + mock_engine_client.state.geometry.get_relative_well_location( labware_id="123abc", well_name="my cool well", absolute_point=Point(1, 2, 3) ) - ).then_return( - LiquidHandlingWellLocation( - origin=WellOrigin.TOP, offset=WellOffset(x=3, y=2, z=1) - ) - ) + ).then_return(WellLocation(origin=WellOrigin.TOP, offset=WellOffset(x=3, y=2, z=1))) subject.blow_out(location=location, well_core=well_core, in_place=False) @@ -646,7 +645,7 @@ def test_blow_out_to_well( pipetteId="abc123", labwareId="123abc", wellName="my cool well", - wellLocation=LiquidHandlingWellLocation( + wellLocation=WellLocation( origin=WellOrigin.TOP, offset=WellOffset(x=3, y=2, z=1) ), flowRate=6.7, diff --git a/api/tests/opentrons/protocol_engine/commands/test_blow_out.py b/api/tests/opentrons/protocol_engine/commands/test_blow_out.py index 8ceb4ab17c3..72eeee1532b 100644 --- a/api/tests/opentrons/protocol_engine/commands/test_blow_out.py +++ b/api/tests/opentrons/protocol_engine/commands/test_blow_out.py @@ -3,7 +3,7 @@ from opentrons.types import Point from opentrons.protocol_engine import ( - LiquidHandlingWellLocation, + WellLocation, WellOrigin, WellOffset, DeckPoint, @@ -38,9 +38,7 @@ async def test_blow_out_implementation( pipetting=pipetting, ) - location = LiquidHandlingWellLocation( - origin=WellOrigin.BOTTOM, offset=WellOffset(x=0, y=0, z=1) - ) + location = WellLocation(origin=WellOrigin.BOTTOM, offset=WellOffset(x=0, y=0, z=1)) data = BlowOutParams( pipetteId="pipette-id", diff --git a/api/tests/opentrons/protocol_engine/state/command_fixtures.py b/api/tests/opentrons/protocol_engine/state/command_fixtures.py index ab864d8f3d5..9c4665d31a2 100644 --- a/api/tests/opentrons/protocol_engine/state/command_fixtures.py +++ b/api/tests/opentrons/protocol_engine/state/command_fixtures.py @@ -512,7 +512,7 @@ def create_blow_out_command( flow_rate: float, labware_id: str = "labware-id", well_name: str = "A1", - well_location: Optional[LiquidHandlingWellLocation] = None, + well_location: Optional[WellLocation] = None, destination: DeckPoint = DeckPoint(x=0, y=0, z=0), ) -> cmd.BlowOut: """Get a completed BlowOut command.""" @@ -520,7 +520,7 @@ def create_blow_out_command( pipetteId=pipette_id, labwareId=labware_id, wellName=well_name, - wellLocation=well_location or LiquidHandlingWellLocation(), + wellLocation=well_location or WellLocation(), flowRate=flow_rate, ) result = cmd.BlowOutResult(position=destination) diff --git a/api/tests/opentrons/protocol_runner/test_json_translator.py b/api/tests/opentrons/protocol_runner/test_json_translator.py index d2d37772a5e..e2735e4cdbc 100644 --- a/api/tests/opentrons/protocol_runner/test_json_translator.py +++ b/api/tests/opentrons/protocol_runner/test_json_translator.py @@ -441,7 +441,7 @@ pipetteId="pipette-id-1", labwareId="labware-id-2", wellName="A1", - wellLocation=LiquidHandlingWellLocation( + wellLocation=WellLocation( origin=WellOrigin.BOTTOM, offset=WellOffset(x=0, y=0, z=7.89), ), diff --git a/shared-data/command/schemas/10.json b/shared-data/command/schemas/10.json index b6bdd71046d..6508269ac62 100644 --- a/shared-data/command/schemas/10.json +++ b/shared-data/command/schemas/10.json @@ -300,7 +300,7 @@ "definitions": { "WellOrigin": { "title": "WellOrigin", - "description": "Origin of WellLocation offset.\n\nProps:\n TOP: the top-center of the well\n BOTTOM: the bottom-center of the well\n CENTER: the middle-center of the well", + "description": "Origin of WellLocation offset.\n\nProps:\n TOP: the top-center of the well\n BOTTOM: the bottom-center of the well\n CENTER: the middle-center of the well\n MENISCUS: the meniscus-center of the well", "enum": ["top", "bottom", "center", "meniscus"], "type": "string" }, @@ -344,7 +344,7 @@ }, "volumeOffset": { "title": "Volumeoffset", - "description": "A volume of liquid, in \u00b5L, to offset the z-axis offset. When \"operationVolume\" is specified, this volume is pulled from the volume command parameter.", + "description": "A volume of liquid, in \u00b5L, to offset the z-axis offset. When \"operationVolume\" is specified, this volume is pulled from the command volume parameter.", "default": 0.0, "anyOf": [ { @@ -933,6 +933,30 @@ }, "required": ["params"] }, + "WellLocation": { + "title": "WellLocation", + "description": "A relative location in reference to a well's location.", + "type": "object", + "properties": { + "origin": { + "default": "top", + "allOf": [ + { + "$ref": "#/definitions/WellOrigin" + } + ] + }, + "offset": { + "$ref": "#/definitions/WellOffset" + }, + "volumeOffset": { + "title": "Volumeoffset", + "description": "A volume of liquid, in \u00b5L, to offset the z-axis offset.", + "default": 0.0, + "type": "number" + } + } + }, "BlowOutParams": { "title": "BlowOutParams", "description": "Payload required to blow-out a specific well.", @@ -953,7 +977,7 @@ "description": "Relative well location at which to perform the operation", "allOf": [ { - "$ref": "#/definitions/LiquidHandlingWellLocation" + "$ref": "#/definitions/WellLocation" } ] }, @@ -2019,30 +2043,6 @@ }, "required": ["params"] }, - "WellLocation": { - "title": "WellLocation", - "description": "A relative location in reference to a well's location.", - "type": "object", - "properties": { - "origin": { - "default": "top", - "allOf": [ - { - "$ref": "#/definitions/WellOrigin" - } - ] - }, - "offset": { - "$ref": "#/definitions/WellOffset" - }, - "volumeOffset": { - "title": "Volumeoffset", - "description": "A volume of liquid, in \u00b5L, to offset the z-axis offset.", - "default": 0.0, - "type": "number" - } - } - }, "MoveToWellParams": { "title": "MoveToWellParams", "description": "Payload required to move a pipette to a specific well.", @@ -2448,6 +2448,12 @@ }, "required": ["params"] }, + "PickUpTipWellOrigin": { + "title": "PickUpTipWellOrigin", + "description": "The origin of a PickUpTipWellLocation offset.\n\nProps:\n TOP: the top-center of the well\n BOTTOM: the bottom-center of the well\n CENTER: the middle-center of the well", + "enum": ["top", "bottom", "center"], + "type": "string" + }, "PickUpTipWellLocation": { "title": "PickUpTipWellLocation", "description": "A relative location in reference to a well's location.\n\nTo be used for picking up tips.", @@ -2457,7 +2463,7 @@ "default": "top", "allOf": [ { - "$ref": "#/definitions/WellOrigin" + "$ref": "#/definitions/PickUpTipWellOrigin" } ] },