Skip to content

Commit c0c2f74

Browse files
authored
fix(api): Limit how far up the gripper moves on the Z when opening/closing the plate reader lid. (#19118)
1 parent 08a7eef commit c0c2f74

File tree

7 files changed

+26
-7
lines changed

7 files changed

+26
-7
lines changed

analyses-snapshot-testing/tests/__snapshots__/analyses_snapshot_test/test_analysis_snapshot[34f32336bc][Flex_X_v2_21_plate_reader_wrong_plate2].json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2437,7 +2437,7 @@
24372437
"createdAt": "TIMESTAMP",
24382438
"error": {
24392439
"createdAt": "TIMESTAMP",
2440-
"detail": "Cannot move 'thermoscientificnunc_96_wellplate_2000ul' into plate reader because the maximum allowed labware height is 16mm.",
2440+
"detail": "Cannot move 'thermoscientificnunc_96_wellplate_2000ul' into plate reader because the maximum allowed labware height is 16.0mm.",
24412441
"errorCode": "4000",
24422442
"errorInfo": {},
24432443
"errorType": "LabwareMovementNotAllowedError",
@@ -2477,7 +2477,7 @@
24772477
"errors": [
24782478
{
24792479
"createdAt": "TIMESTAMP",
2480-
"detail": "ProtocolCommandFailedError [line 23]: Error 4000 GENERAL_ERROR (ProtocolCommandFailedError): LabwareMovementNotAllowedError: Cannot move 'thermoscientificnunc_96_wellplate_2000ul' into plate reader because the maximum allowed labware height is 16mm.",
2480+
"detail": "ProtocolCommandFailedError [line 23]: Error 4000 GENERAL_ERROR (ProtocolCommandFailedError): LabwareMovementNotAllowedError: Cannot move 'thermoscientificnunc_96_wellplate_2000ul' into plate reader because the maximum allowed labware height is 16.0mm.",
24812481
"errorCode": "4000",
24822482
"errorInfo": {},
24832483
"errorType": "ExceptionInProtocolError",
@@ -2486,7 +2486,7 @@
24862486
"wrappedErrors": [
24872487
{
24882488
"createdAt": "TIMESTAMP",
2489-
"detail": "LabwareMovementNotAllowedError: Cannot move 'thermoscientificnunc_96_wellplate_2000ul' into plate reader because the maximum allowed labware height is 16mm.",
2489+
"detail": "LabwareMovementNotAllowedError: Cannot move 'thermoscientificnunc_96_wellplate_2000ul' into plate reader because the maximum allowed labware height is 16.0mm.",
24902490
"errorCode": "4000",
24912491
"errorInfo": {},
24922492
"errorType": "ProtocolCommandFailedError",
@@ -2495,7 +2495,7 @@
24952495
"wrappedErrors": [
24962496
{
24972497
"createdAt": "TIMESTAMP",
2498-
"detail": "Cannot move 'thermoscientificnunc_96_wellplate_2000ul' into plate reader because the maximum allowed labware height is 16mm.",
2498+
"detail": "Cannot move 'thermoscientificnunc_96_wellplate_2000ul' into plate reader because the maximum allowed labware height is 16.0mm.",
24992499
"errorCode": "4000",
25002500
"errorInfo": {},
25012501
"errorType": "LabwareMovementNotAllowedError",

api/src/opentrons/motion_planning/waypoints.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ def get_gripper_labware_movement_waypoints(
127127
gripper_home_z: float,
128128
offset_data: LabwareMovementOffsetData,
129129
post_drop_slide_offset: Optional[Point],
130+
gripper_home_z_offset: Optional[float] = None,
130131
) -> List[GripperMovementWaypointsWithJawStatus]:
131132
"""Get waypoints for moving labware using a gripper."""
132133
pick_up_offset = offset_data.pickUpOffset
@@ -139,6 +140,8 @@ def get_gripper_labware_movement_waypoints(
139140
drop_offset.x, drop_offset.y, drop_offset.z
140141
)
141142

143+
gripper_max_z_home = gripper_home_z - (gripper_home_z_offset or 0)
144+
142145
post_drop_home_pos = Point(drop_location.x, drop_location.y, gripper_home_z)
143146

144147
waypoints_with_jaw_status = [
@@ -152,12 +155,12 @@ def get_gripper_labware_movement_waypoints(
152155
),
153156
# Gripper grips the labware here
154157
GripperMovementWaypointsWithJawStatus(
155-
position=Point(pick_up_location.x, pick_up_location.y, gripper_home_z),
158+
position=Point(pick_up_location.x, pick_up_location.y, gripper_max_z_home),
156159
jaw_open=False,
157160
dropping=False,
158161
),
159162
GripperMovementWaypointsWithJawStatus(
160-
position=Point(drop_location.x, drop_location.y, gripper_home_z),
163+
position=Point(drop_location.x, drop_location.y, gripper_max_z_home),
161164
jaw_open=False,
162165
dropping=False,
163166
),

api/src/opentrons/protocol_engine/commands/absorbance_reader/close_lid.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@
1212

1313
from ...state.update_types import StateUpdate
1414

15+
from .common import LID_Z_CLEARANCE
16+
1517
from opentrons.types import Point
1618

1719
from opentrons.drivers.types import AbsorbanceReaderLidStatus
1820

21+
1922
if TYPE_CHECKING:
2023
from opentrons.protocol_engine.state.state import StateView
2124
from opentrons.protocol_engine.execution import (
@@ -119,6 +122,7 @@ async def execute(self, params: CloseLidParams) -> SuccessData[CloseLidResult]:
119122
),
120123
user_drop_offset=Point.from_xyz_attrs(lid_gripper_offsets.dropOffset),
121124
post_drop_slide_offset=None,
125+
gripper_z_offset=LID_Z_CLEARANCE,
122126
)
123127
state_update.set_absorbance_reader_lid(
124128
module_id=mod_substate.module_id,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"""Common absorbance reader defines."""
2+
3+
# This needs to be re-defined because of circular imports
4+
_PLATE_READER_MAX_LABWARE_Z_MM = 16.0
5+
# Distance to home the gripper when moving the plate reader lid to/from the dock.
6+
LID_Z_CLEARANCE = _PLATE_READER_MAX_LABWARE_Z_MM + 40.0

api/src/opentrons/protocol_engine/commands/absorbance_reader/open_lid.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
from opentrons.drivers.types import AbsorbanceReaderLidStatus
1616

17+
from .common import LID_Z_CLEARANCE
18+
1719
from ...state.update_types import StateUpdate
1820

1921

@@ -121,6 +123,7 @@ async def execute(self, params: OpenLidParams) -> SuccessData[OpenLidResult]:
121123
),
122124
user_drop_offset=Point.from_xyz_attrs(lid_gripper_offsets.dropOffset),
123125
post_drop_slide_offset=None,
126+
gripper_z_offset=LID_Z_CLEARANCE,
124127
)
125128
state_update.set_absorbance_reader_lid(
126129
module_id=mod_substate.module_id, is_lid_on=False

api/src/opentrons/protocol_engine/execution/labware_movement.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ async def move_labware_with_gripper(
111111
user_pick_up_offset: Point,
112112
user_drop_offset: Point,
113113
post_drop_slide_offset: Optional[Point],
114+
gripper_z_offset: Optional[float],
114115
) -> None:
115116
...
116117

@@ -124,6 +125,7 @@ async def move_labware_with_gripper( # noqa: C901
124125
user_pick_up_offset: Point,
125126
user_drop_offset: Point,
126127
post_drop_slide_offset: Optional[Point],
128+
gripper_z_offset: Optional[float] = None,
127129
) -> None:
128130
"""Physically move a labware from one location to another using the gripper.
129131
@@ -206,6 +208,7 @@ async def move_labware_with_gripper( # noqa: C901
206208
gripper_home_z=gripper_homed_position.z,
207209
offset_data=final_offsets,
208210
post_drop_slide_offset=post_drop_slide_offset,
211+
gripper_home_z_offset=gripper_z_offset,
209212
)
210213
labware_grip_force = self._state_store.labware.get_grip_force(
211214
labware_definition

api/src/opentrons/protocol_engine/state/labware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393

9494

9595
# The max height of the labware that can fit in a plate reader
96-
_PLATE_READER_MAX_LABWARE_Z_MM = 16
96+
_PLATE_READER_MAX_LABWARE_Z_MM = 16.0
9797

9898

9999
_WellDefinition = WellDefinition2 | WellDefinition3

0 commit comments

Comments
 (0)