Skip to content

Commit

Permalink
move offsets into labware definition and further test fixture adjustm…
Browse files Browse the repository at this point in the history
…ents
  • Loading branch information
CaseyBatten committed Oct 30, 2024
1 parent 1b3340c commit 4a7f694
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 7 deletions.
31 changes: 25 additions & 6 deletions api/src/opentrons/protocol_engine/commands/move_labware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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."
Expand Down
2 changes: 1 addition & 1 deletion api/tests/opentrons/protocol_api/test_protocol_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
}

0 comments on commit 4a7f694

Please sign in to comment.