From f2fd88f086a0530294a8425d0138c23af7fb7312 Mon Sep 17 00:00:00 2001 From: Camillo Moschner Date: Tue, 14 Oct 2025 18:53:23 +0100 Subject: [PATCH 1/3] Fix STARBackend.get_core() & STARBackend.put_core() --- .../backends/hamilton/STAR_backend.py | 42 +++++++++++++------ 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/pylabrobot/liquid_handling/backends/hamilton/STAR_backend.py b/pylabrobot/liquid_handling/backends/hamilton/STAR_backend.py index 4a233f07a27..9b51707e54e 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 #13385 # 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_coord = round(1250+self.core_adjustment.y*10) + front_channel_y_coord = 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_coord:04}", + yb=f"{front_channel_y_coord: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_coord = round(1240+self.core_adjustment.y*10) + front_channel_y_coord = 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_coord:04}", + yb=f"{front_channel_y_coord: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), ) From b8c76cee80a2c55fa51fcd98875aad181fba7a8d Mon Sep 17 00:00:00 2001 From: Camillo Moschner Date: Tue, 14 Oct 2025 21:28:19 +0100 Subject: [PATCH 2/3] wording --- .../backends/hamilton/STAR_backend.py | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/pylabrobot/liquid_handling/backends/hamilton/STAR_backend.py b/pylabrobot/liquid_handling/backends/hamilton/STAR_backend.py index 9b51707e54e..2bde0dc43bf 100644 --- a/pylabrobot/liquid_handling/backends/hamilton/STAR_backend.py +++ b/pylabrobot/liquid_handling/backends/hamilton/STAR_backend.py @@ -4987,23 +4987,23 @@ async def get_core(self, p1: int, p2: int): if deck_size == STARLET_SIZE_X: xs = 7975 # 1360-797.5 = 562.5 (distance to right edge of deck) elif deck_size == STAR_SIZE_X: - xs = 13375 #13385 # 1900-1337.5 = 562.5 (distance to right edge of deck) + 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_coord = round(1250+self.core_adjustment.y*10) - front_channel_y_coord = 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) + 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"{channel_x_coord:05}", xd="0", - ya=f"{back_channel_y_coord:04}", - yb=f"{front_channel_y_coord: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"{begin_z_coord:04}", @@ -5028,19 +5028,19 @@ async def put_core(self): else: raise ValueError(f"Deck size {deck_size} not supported") - channel_x_coord = round(xs+self.core_adjustment.x*10) - back_channel_y_coord = round(1240+self.core_adjustment.y*10) - front_channel_y_coord = 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) + 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"{channel_x_coord:05}", xd="0", - ya=f"{back_channel_y_coord:04}", - yb=f"{front_channel_y_coord: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), From d35a5a4ccd438a5f2b95e0dad0595e04b917ede1 Mon Sep 17 00:00:00 2001 From: Camillo Moschner Date: Tue, 14 Oct 2025 22:40:37 +0100 Subject: [PATCH 3/3] only one test ... and for a STARlet? --- pylabrobot/liquid_handling/backends/hamilton/STAR_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"