Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move to rotated resource #358

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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,
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
Loading