diff --git a/pylabrobot/liquid_handling/backends/hamilton/STAR_backend.py b/pylabrobot/liquid_handling/backends/hamilton/STAR_backend.py index 4a233f07a27..2bde0dc43bf 100644 --- a/pylabrobot/liquid_handling/backends/hamilton/STAR_backend.py +++ b/pylabrobot/liquid_handling/backends/hamilton/STAR_backend.py @@ -4974,6 +4974,7 @@ async def dispense_pip( @need_iswap_parked async def get_core(self, p1: int, p2: int): """Get CoRe gripper tool from wasteblock mount.""" + if not 0 <= p1 < self.num_channels: raise ValueError(f"channel_1 must be between 0 and {self.num_channels - 1}") if not 1 <= p2 <= self.num_channels: @@ -4984,23 +4985,29 @@ async def get_core(self, p1: int, p2: int): # a resource on the robot deck and use deck.get_resource().get_location_wrt(self.deck). deck_size = self.deck.get_absolute_size_x() if deck_size == STARLET_SIZE_X: - xs = 7975 # 1360-797.5 = 562.5 + xs = 7975 # 1360-797.5 = 562.5 (distance to right edge of deck) elif deck_size == STAR_SIZE_X: - xs = 13385 # 1900-1337.5 = 562.5, plus a manual adjustment of + 10 + xs = 13375 # 1900-1337.5 = 562.5 (distance to right edge of deck) else: raise ValueError(f"Deck size {deck_size} not supported") + channel_x_coord = round(xs + self.core_adjustment.x * 10) + back_channel_y_center = round(1250 + self.core_adjustment.y * 10) + front_channel_y_center = round(1070 + self.core_adjustment.y * 10) + begin_z_coord = round(2350 + self.core_adjustment.z * 10) + end_z_coord = round(2250 + self.core_adjustment.z * 10) + command_output = await self.send_command( module="C0", command="ZT", - xs=f"{xs + self.core_adjustment.x:05}", + xs=f"{channel_x_coord:05}", xd="0", - ya=f"{1240 + self.core_adjustment.y:04}", - yb=f"{1065 + self.core_adjustment.y:04}", + ya=f"{back_channel_y_center:04}", + yb=f"{front_channel_y_center:04}", pa=f"{p1:02}", pb=f"{p2:02}", - tp=f"{2350 + self.core_adjustment.z:04}", - tz=f"{2250 + self.core_adjustment.z:04}", + tp=f"{begin_z_coord:04}", + tz=f"{end_z_coord:04}", th=round(self._iswap_traversal_height * 10), tt="14", ) @@ -5010,23 +5017,32 @@ async def get_core(self, p1: int, p2: int): @need_iswap_parked async def put_core(self): """Put CoRe gripper tool at wasteblock mount.""" + assert self.deck is not None, "must have deck defined to access CoRe grippers" + deck_size = self.deck.get_absolute_size_x() if deck_size == STARLET_SIZE_X: xs = 7975 elif deck_size == STAR_SIZE_X: - xs = 13385 + xs = 13375 else: raise ValueError(f"Deck size {deck_size} not supported") + + channel_x_coord = round(xs + self.core_adjustment.x * 10) + back_channel_y_center = round(1240 + self.core_adjustment.y * 10) + front_channel_y_center = round(1065 + self.core_adjustment.y * 10) + begin_z_coord = round(2150 + self.core_adjustment.z * 10) + end_z_coord = round(2050 + self.core_adjustment.z * 10) + command_output = await self.send_command( module="C0", command="ZS", - xs=f"{xs + self.core_adjustment.x:05}", + xs=f"{channel_x_coord:05}", xd="0", - ya=f"{1240 + self.core_adjustment.y:04}", - yb=f"{1065 + self.core_adjustment.y:04}", - tp=f"{2150 + self.core_adjustment.z:04}", - tz=f"{2050 + self.core_adjustment.z:04}", + ya=f"{back_channel_y_center:04}", + yb=f"{front_channel_y_center:04}", + tp=f"{begin_z_coord:04}", + tz=f"{end_z_coord:04}", th=round(self._iswap_traversal_height * 10), te=round(self._iswap_traversal_height * 10), ) diff --git a/pylabrobot/liquid_handling/backends/hamilton/STAR_tests.py b/pylabrobot/liquid_handling/backends/hamilton/STAR_tests.py index fd2cba3b370..a2f3b5ec7a8 100644 --- a/pylabrobot/liquid_handling/backends/hamilton/STAR_tests.py +++ b/pylabrobot/liquid_handling/backends/hamilton/STAR_tests.py @@ -927,7 +927,7 @@ async def test_move_core(self): self.STAR._write_and_read_command.assert_has_calls( [ _any_write_and_read_command_call( - "C0ZTid0001xs07975xd0ya1240yb1065pa07pb08tp2350tz2250th2800tt14" + "C0ZTid0001xs07975xd0ya1250yb1070pa07pb08tp2350tz2250th2800tt14" ), _any_write_and_read_command_call( "C0ZPid0002xs03479xd0yj1142yv0050zj1876zy0500yo0885yg0825yw15" "th2800te2800"