From 4a7f69470ae528c442d24f81b2e30011252fbcb7 Mon Sep 17 00:00:00 2001 From: CaseyBatten Date: Wed, 30 Oct 2024 15:15:42 -0400 Subject: [PATCH] move offsets into labware definition and further test fixture adjustments --- .../protocol_engine/commands/move_labware.py | 31 +++++++++++++++---- .../protocol_api/test_protocol_context.py | 2 +- .../1.json | 12 +++++++ 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/api/src/opentrons/protocol_engine/commands/move_labware.py b/api/src/opentrons/protocol_engine/commands/move_labware.py index b95efa902b2..59c87f89fe4 100644 --- a/api/src/opentrons/protocol_engine/commands/move_labware.py +++ b/api/src/opentrons/protocol_engine/commands/move_labware.py @@ -22,7 +22,11 @@ LabwareOffsetVector, LabwareMovementOffsetData, ) -from ..errors import LabwareMovementNotAllowedError, NotSupportedOnRobotType +from ..errors import ( + LabwareMovementNotAllowedError, + NotSupportedOnRobotType, + LabwareOffsetDoesNotExistError, +) from ..resources import labware_validation, fixture_validation from .command import ( AbstractCommandImpl, @@ -171,11 +175,26 @@ async def execute(self, params: MoveLabwareParams) -> _ExecuteReturn: # noqa: C if labware_validation.validate_definition_is_lid( self._state_view.labware.get_definition(params.labwareId) ): - trash_lid_drop_offset = LabwareOffsetVector( - x=0, - y=10.0, - z=50.0, - ) + self._state_view.labware.get_labware_gripper_offsets + if ( + "lidDisposalOffsets" + in current_labware_definition.gripperOffsets.keys() + ): + trash_lid_drop_offset = LabwareOffsetVector( + x=current_labware_definition.gripperOffsets[ + "lidDisposalOffsets" + ].dropOffset.x, + y=current_labware_definition.gripperOffsets[ + "lidDisposalOffsets" + ].dropOffset.y, + z=current_labware_definition.gripperOffsets[ + "lidDisposalOffsets" + ].dropOffset.z, + ) + else: + raise LabwareOffsetDoesNotExistError( + f"Labware Definition {current_labware.loadName} does not contain required field 'lidDisposalOffsets' of 'gripperOffsets'." + ) else: raise LabwareMovementNotAllowedError( "Can only move labware with allowed role 'Lid' to a Trash Bin." diff --git a/api/tests/opentrons/protocol_api/test_protocol_context.py b/api/tests/opentrons/protocol_api/test_protocol_context.py index 7a67ac0ea7f..5e516a5b274 100644 --- a/api/tests/opentrons/protocol_api/test_protocol_context.py +++ b/api/tests/opentrons/protocol_api/test_protocol_context.py @@ -1012,7 +1012,7 @@ def test_move_lid_to_trash_passes( mock_core.move_labware( labware_core=mock_labware_core, new_location=trash_location, - use_gripper=True, + use_gripper=False, pause_for_manual_move=True, pick_up_offset=None, drop_offset=None, diff --git a/shared-data/labware/definitions/2/opentrons_tough_pcr_auto_sealing_lid/1.json b/shared-data/labware/definitions/2/opentrons_tough_pcr_auto_sealing_lid/1.json index d5d56101e7f..f872649a027 100644 --- a/shared-data/labware/definitions/2/opentrons_tough_pcr_auto_sealing_lid/1.json +++ b/shared-data/labware/definitions/2/opentrons_tough_pcr_auto_sealing_lid/1.json @@ -98,6 +98,18 @@ "y": 0, "z": -1 } + }, + "lidDisposalOffsets": { + "pickUpOffset": { + "x": 0, + "y": 0, + "z": 0 + }, + "dropOffset": { + "x": 0, + "y": 5.0, + "z": 50.0 + } } } }