Skip to content

Commit

Permalink
Merge branch 'main' into fix-lh-move-resource-kwargs
Browse files Browse the repository at this point in the history
  • Loading branch information
rickwierenga authored Jan 15, 2025
2 parents f904f9a + 6718951 commit a903759
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pylabrobot/liquid_handling/backends/hamilton/STAR.py
Original file line number Diff line number Diff line change
Expand Up @@ -2892,17 +2892,23 @@ 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")

# Get center of source plate in absolute space.
# 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(),
)
)
Expand Down
2 changes: 2 additions & 0 deletions pylabrobot/liquid_handling/backends/tecan/EVO_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
EVO150Deck,
MP_3Pos_PCR,
)
from pylabrobot.resources.rotation import Rotation


class EVOTests(unittest.IsolatedAsyncioTestCase):
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions pylabrobot/liquid_handling/liquid_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1938,6 +1939,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,
Expand Down
2 changes: 2 additions & 0 deletions pylabrobot/liquid_handling/standard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a903759

Please sign in to comment.