diff --git a/pylabrobot/liquid_handling/backends/hamilton/STAR.py b/pylabrobot/liquid_handling/backends/hamilton/STAR.py index 5dbe579bee..fccf7a6471 100644 --- a/pylabrobot/liquid_handling/backends/hamilton/STAR.py +++ b/pylabrobot/liquid_handling/backends/hamilton/STAR.py @@ -2892,9 +2892,13 @@ async def drop_resource( # original grip direction. Hack. # the resource still has its original orientation. if drop.direction in (GripDirection.FRONT, GripDirection.BACK): - plate_width = drop.resource.rotated(z=drop.rotation).get_absolute_size_x() + plate_width = drop.resource.rotated( + z=drop.rotation + drop.destination_absolute_rotation.z + ).get_absolute_size_x() elif drop.direction in (GripDirection.RIGHT, GripDirection.LEFT): - plate_width = drop.resource.rotated(z=drop.rotation).get_absolute_size_y() + plate_width = drop.resource.rotated( + z=drop.rotation + drop.destination_absolute_rotation.z + ).get_absolute_size_y() else: raise ValueError("Invalid grip direction") @@ -2902,7 +2906,9 @@ async def drop_resource( # The computation of the center has to be rotated so that the offset is in absolute space. center_in_absolute_space = Coordinate( *matrix_vector_multiply_3x3( - drop.resource.rotated(z=drop.rotation).get_absolute_rotation().get_rotation_matrix(), + drop.resource.rotated(z=drop.rotation + drop.destination_absolute_rotation.z) + .get_absolute_rotation() + .get_rotation_matrix(), drop.resource.center().vector(), ) ) diff --git a/pylabrobot/liquid_handling/backends/tecan/EVO_tests.py b/pylabrobot/liquid_handling/backends/tecan/EVO_tests.py index 6f48af894d..fc2afca439 100644 --- a/pylabrobot/liquid_handling/backends/tecan/EVO_tests.py +++ b/pylabrobot/liquid_handling/backends/tecan/EVO_tests.py @@ -24,6 +24,7 @@ EVO150Deck, MP_3Pos_PCR, ) +from pylabrobot.resources.rotation import Rotation class EVOTests(unittest.IsolatedAsyncioTestCase): @@ -340,6 +341,7 @@ async def test_move_resource(self): drop = ResourceDrop( resource=self.plate, destination=self.plate_carrier[0].get_absolute_location(), + destination_absolute_rotation=Rotation(0, 0, 0), offset=Coordinate.zero(), pickup_distance_from_top=13.2, direction=GripDirection.FRONT, diff --git a/pylabrobot/liquid_handling/liquid_handler.py b/pylabrobot/liquid_handling/liquid_handler.py index 6b79ce4555..6d37b6d05c 100644 --- a/pylabrobot/liquid_handling/liquid_handler.py +++ b/pylabrobot/liquid_handling/liquid_handler.py @@ -54,6 +54,7 @@ ) from pylabrobot.resources.errors import CrossContaminationError, HasTipError from pylabrobot.resources.liquid import Liquid +from pylabrobot.resources.rotation import Rotation from pylabrobot.tilting.tilter import Tilter from .backends import LiquidHandlerBackend @@ -1921,6 +1922,9 @@ async def drop_resource( drop = ResourceDrop( resource=self._resource_pickup.resource, destination=to_location, + destination_absolute_rotation=destination.get_absolute_rotation() + if isinstance(destination, Resource) + else Rotation(0, 0, 0), offset=offset, pickup_distance_from_top=self._resource_pickup.pickup_distance_from_top, direction=direction, diff --git a/pylabrobot/liquid_handling/standard.py b/pylabrobot/liquid_handling/standard.py index 7b17d9ecd9..7ad1947370 100644 --- a/pylabrobot/liquid_handling/standard.py +++ b/pylabrobot/liquid_handling/standard.py @@ -8,6 +8,7 @@ from pylabrobot.resources.coordinate import Coordinate from pylabrobot.resources.liquid import Liquid +from pylabrobot.resources.rotation import Rotation if TYPE_CHECKING: from pylabrobot.resources import ( @@ -147,6 +148,7 @@ class ResourceMove: class ResourceDrop: resource: Resource destination: Coordinate + destination_absolute_rotation: Rotation offset: Coordinate pickup_distance_from_top: float direction: GripDirection