From 0c55147ee4d69b9afe62cdf3427a0ddf82c07727 Mon Sep 17 00:00:00 2001 From: Xuwznln <18435084+Xuwznln@users.noreply.github.com> Date: Thu, 13 Nov 2025 17:30:21 +0800 Subject: [PATCH] prcxi example --- .../devices/liquid_handling/prcxi/prcxi.py | 54 ++++++++++++++++++- .../liquid_handling/prcxi/prcxi_materials.py | 21 ++++++++ .../registry/resources/prcxi/tip_racks.yaml | 14 +++++ unilabos/resources/container.py | 1 + 4 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 unilabos/devices/liquid_handling/prcxi/prcxi_materials.py diff --git a/unilabos/devices/liquid_handling/prcxi/prcxi.py b/unilabos/devices/liquid_handling/prcxi/prcxi.py index a8677f49..1f938ae0 100644 --- a/unilabos/devices/liquid_handling/prcxi/prcxi.py +++ b/unilabos/devices/liquid_handling/prcxi/prcxi.py @@ -145,6 +145,7 @@ class PRCXI9300Handler(LiquidHandlerAbstract): setup=True, debug=False, simulator=False, + step_mode=False, matrix_id="", is_9320=False, ): @@ -158,6 +159,11 @@ class PRCXI9300Handler(LiquidHandlerAbstract): ) if is_9320: print("当前设备是9320") + if step_mode: + if is_9320: + self.step_mode = step_mode + else: + print("9300设备不支持 单点动作模式") self._unilabos_backend = PRCXI9300Backend( tablets_info, host, port, timeout, channel_num, axis, setup, debug, matrix_id, is_9320 ) @@ -344,6 +350,10 @@ class PRCXI9300Handler(LiquidHandlerAbstract): offsets: Optional[List[Coordinate]] = None, **backend_kwargs, ): + if self.step_mode: + await self.create_protocol(f"单点动作{time.time()}") + await super().pick_up_tips(tip_spots, use_channels, offsets, **backend_kwargs) + await self.run_protocol() return await super().pick_up_tips(tip_spots, use_channels, offsets, **backend_kwargs) async def aspirate( @@ -1694,7 +1704,43 @@ if __name__ == "__main__": A = tree_to_list([resource_plr_to_ulab(deck)]) with open("deck.json", "w", encoding="utf-8") as f: - json.dump(A, f, indent=4, ensure_ascii=False) + A.insert(0, { + "id": "PRCXI", + "name": "PRCXI", + "parent": None, + "type": "device", + "class": "liquid_handler.prcxi", + "position": { + "x": 0, + "y": 0, + "z": 0 + }, + "config": { + "deck": { + "_resource_child_name": "PRCXI_Deck", + "_resource_type": "unilabos.devices.liquid_handling.prcxi.prcxi:PRCXI9300Deck" + }, + "host": "192.168.0.121", + "port": 9999, + "timeout": 10.0, + "axis": "Right", + "channel_num": 1, + "setup": False, + "debug": True, + "simulator": True, + "matrix_id": "5de524d0-3f95-406c-86dd-f83626ebc7cb", + "is_9320": True + }, + "data": {}, + "children": [ + "PRCXI_Deck" + ] + }) + A[1]["parent"] = "PRCXI" + json.dump({ + "nodes": A, + "links": [] + }, f, indent=4, ensure_ascii=False) handler = PRCXI9300Handler( deck=deck, @@ -1735,6 +1781,12 @@ if __name__ == "__main__": asyncio.run(handler.run_protocol()) time.sleep(5) os._exit(0) + + + prcxi_api = PRCXI9300Api(host="192.168.0.121", port=9999) + prcxi_api.list_matrices() + prcxi_api.get_all_materials() + # 第一种情景:一个孔往多个孔加液 # plate_2_liquids = handler.set_group("water", [plate2.children[0]], [300]) # plate5_liquids = handler.set_group("master_mix", plate5.children[:23], [100]*23) diff --git a/unilabos/devices/liquid_handling/prcxi/prcxi_materials.py b/unilabos/devices/liquid_handling/prcxi/prcxi_materials.py new file mode 100644 index 00000000..097ee0a1 --- /dev/null +++ b/unilabos/devices/liquid_handling/prcxi/prcxi_materials.py @@ -0,0 +1,21 @@ +import collections +import json +from pathlib import Path + +from unilabos.devices.liquid_handling.prcxi.prcxi import PRCXI9300Container + + +prcxi_materials_path = str(Path(__file__).parent / "prcxi_material.json") +with open(prcxi_materials_path, mode="r", encoding="utf-8") as f: + prcxi_materials = json.loads(f.read()) + + +def tip_adaptor_1250ul(name="Tip头适配器 1250uL") -> PRCXI9300Container: # 必须传入一个name参数,是plr的规范要求 + # tip_rack = PRCXI9300Container(name, prcxi_materials["name"]["Height"]) + tip_rack = PRCXI9300Container(name, 1000,400,800, "tip_rack", collections.OrderedDict()) + tip_rack.load_state({ + "Materials": {"uuid": "7960f49ddfe9448abadda89bd1556936", "materialEnum": "0"} + }) + return tip_rack + + diff --git a/unilabos/registry/resources/prcxi/tip_racks.yaml b/unilabos/registry/resources/prcxi/tip_racks.yaml index e74c17ad..7caff53d 100644 --- a/unilabos/registry/resources/prcxi/tip_racks.yaml +++ b/unilabos/registry/resources/prcxi/tip_racks.yaml @@ -10,3 +10,17 @@ prcxi_opentrons_96_tiprack_10ul: init_param_schema: {} registry_type: resource version: 1.0.0 + + +tip_adaptor_1250ul_2: + category: + - prcxi + class: + module: unilabos.devices.liquid_handling.prcxi.prcxi_materials:tip_adaptor_1250ul + type: pylabrobot + description: Tip头适配器 1250uL + handles: [ ] + icon: '' + init_param_schema: { } + registry_type: resource + version: 1.0.0 \ No newline at end of file diff --git a/unilabos/resources/container.py b/unilabos/resources/container.py index 150d2a3a..d7a0e799 100644 --- a/unilabos/resources/container.py +++ b/unilabos/resources/container.py @@ -9,6 +9,7 @@ from unilabos.ros.msgs.message_converter import convert_from_ros_msg class RegularContainer(Container): def __init__(self, *args, **kwargs): + pose = kwargs.pop("pose", None) if "size_x" not in kwargs: kwargs["size_x"] = 0 if "size_y" not in kwargs: