diff --git a/test/experiments/comprehensive_protocol/comprehensive_slim.json b/test/experiments/comprehensive_protocol/comprehensive_slim.json index f533d22b..83e15679 100644 --- a/test/experiments/comprehensive_protocol/comprehensive_slim.json +++ b/test/experiments/comprehensive_protocol/comprehensive_slim.json @@ -41,7 +41,7 @@ "HydrogenateProtocol", "RecrystallizeProtocol" ], - "station_resource": { + "deck": { "data": { "_resource_child_name": "deck", "_resource_type": "pylabrobot.resources.opentrons.deck:OTDeck" diff --git a/unilabos/devices/workstation/coin_cell_assembly/button_battery_station.py b/unilabos/devices/workstation/coin_cell_assembly/button_battery_station.py index 676141aa..ffce04be 100644 --- a/unilabos/devices/workstation/coin_cell_assembly/button_battery_station.py +++ b/unilabos/devices/workstation/coin_cell_assembly/button_battery_station.py @@ -1283,7 +1283,7 @@ if __name__ == "__main__": # 检查序列化后的资源 - json.dump({"nodes": resources, "links": []}, open("button_battery_station_resources_unilab.json", "w"), indent=2) + json.dump({"nodes": resources, "links": []}, open("button_battery_decks_unilab.json", "w"), indent=2) #print(resources) diff --git a/unilabos/devices/workstation/coin_cell_assembly/coin_cell_assembly.py b/unilabos/devices/workstation/coin_cell_assembly/coin_cell_assembly.py index 1fefd8ce..4b8ba73d 100644 --- a/unilabos/devices/workstation/coin_cell_assembly/coin_cell_assembly.py +++ b/unilabos/devices/workstation/coin_cell_assembly/coin_cell_assembly.py @@ -21,7 +21,7 @@ from unilabos.ros.nodes.presets.workstation import ROS2WorkstationNode class CoinCellAssemblyWorkstation(WorkstationBase): def __init__( self, - station_resource: CoincellDeck, + deck: CoincellDeck, address: str = "192.168.1.20", port: str = "502", debug_mode: bool = True, @@ -30,12 +30,12 @@ class CoinCellAssemblyWorkstation(WorkstationBase): ): super().__init__( #桌子 - station_resource=station_resource, + deck=deck, *args, **kwargs, ) self.debug_mode = debug_mode - self.station_resource = station_resource + self.deck = deck """ 连接初始化 """ modbus_client = TCPClient(addr=address, port=port) print("modbus_client", modbus_client) @@ -74,7 +74,7 @@ class CoinCellAssemblyWorkstation(WorkstationBase): self._ros_node = ros_node #self.deck = create_a_coin_cell_deck() ROS2DeviceNode.run_async_func(self._ros_node.update_resource, True, **{ - "resources": [self.station_resource] + "resources": [self.deck] }) # 批量操作在这里写 @@ -84,7 +84,7 @@ class CoinCellAssemblyWorkstation(WorkstationBase): async def fill_plate(self): - plate_1: MaterialPlate = self.station_resource.children[0].children[0] + plate_1: MaterialPlate = self.deck.children[0].children[0] #plate_1 return await self._ros_node.update_resource(plate_1) @@ -341,7 +341,7 @@ class CoinCellAssemblyWorkstation(WorkstationBase): def modify_deck_name(self, resource_name: str): # figure_res = self._ros_node.resource_tracker.figure_resource({"name": resource_name}) # print(f"!!! figure_res: {type(figure_res)}") - self.station_resource.children[1] + self.deck.children[1] return @property @@ -814,8 +814,8 @@ class CoinCellAssemblyWorkstation(WorkstationBase): #这里定义物料系统 # TODO:读完再将电池数加一还是进入循环就将电池数加一需要考虑 - liaopan1 = self.station_resource.get_resource("liaopan1") - liaopan4 = self.station_resource.get_resource("liaopan4") + liaopan1 = self.deck.get_resource("liaopan1") + liaopan4 = self.deck.get_resource("liaopan4") jipian1 = liaopan1.children[coin_num_N].children[0] jipian4 = liaopan4.children[coin_num_N].children[0] #print(jipian1) @@ -828,7 +828,7 @@ class CoinCellAssemblyWorkstation(WorkstationBase): battery.assign_child_resource(jipian1, location=None) battery.assign_child_resource(jipian4, location=None) - zidanjia6 = self.station_resource.get_resource("zi_dan_jia6") + zidanjia6 = self.deck.get_resource("zi_dan_jia6") zidanjia6.children[0].assign_child_resource(battery, location=None) @@ -878,11 +878,11 @@ class CoinCellAssemblyWorkstation(WorkstationBase): def fun_wuliao_test(self) -> bool: #找到data_init中构建的2个物料盘 - #liaopan1 = self.station_resource.get_resource("liaopan1") - #liaopan4 = self.station_resource.get_resource("liaopan4") + #liaopan1 = self.deck.get_resource("liaopan1") + #liaopan4 = self.deck.get_resource("liaopan4") #for coin_num_N in range(16): - # liaopan1 = self.station_resource.get_resource("liaopan1") - # liaopan4 = self.station_resource.get_resource("liaopan4") + # liaopan1 = self.deck.get_resource("liaopan1") + # liaopan4 = self.deck.get_resource("liaopan4") # jipian1 = liaopan1.children[coin_num_N].children[0] # jipian4 = liaopan4.children[coin_num_N].children[0] # #print(jipian1) @@ -895,10 +895,10 @@ class CoinCellAssemblyWorkstation(WorkstationBase): # battery.assign_child_resource(jipian1, location=None) # battery.assign_child_resource(jipian4, location=None) # - # zidanjia6 = self.station_resource.get_resource("zi_dan_jia6") + # zidanjia6 = self.deck.get_resource("zi_dan_jia6") # zidanjia6.children[0].assign_child_resource(battery, location=None) # ROS2DeviceNode.run_async_func(self._ros_node.update_resource, True, **{ - # "resources": [self.station_resource] + # "resources": [self.deck] # }) # time.sleep(2) for i in range(20): @@ -1133,7 +1133,7 @@ if __name__ == "__main__": ##print(jipian2.parent) from unilabos.resources.graphio import resource_ulab_to_plr, convert_resources_to_type - with open("./button_battery_station_resources_unilab.json", "r", encoding="utf-8") as f: + with open("./button_battery_decks_unilab.json", "r", encoding="utf-8") as f: bioyond_resources_unilab = json.load(f) print(f"成功读取 JSON 文件,包含 {len(bioyond_resources_unilab)} 个资源") ulab_resources = convert_resources_to_type(bioyond_resources_unilab, List[PLRResource]) diff --git a/unilabos/devices/workstation/coin_cell_assembly/new_cellconfig4.json b/unilabos/devices/workstation/coin_cell_assembly/new_cellconfig4.json index 0ba79b72..7e371327 100644 --- a/unilabos/devices/workstation/coin_cell_assembly/new_cellconfig4.json +++ b/unilabos/devices/workstation/coin_cell_assembly/new_cellconfig4.json @@ -16,9 +16,9 @@ }, "config": { "debug_mode": false, - "_comment": "protocol_type接外部工站固定写法字段,一般为空,station_resource写法也固定", + "_comment": "protocol_type接外部工站固定写法字段,一般为空,deck写法也固定", "protocol_type": [], - "station_resource": { + "deck": { "data": { "_resource_child_name": "coin_cell_deck", "_resource_type": "unilabos.devices.workstation.coin_cell_assembly.button_battery_station:CoincellDeck" diff --git a/unilabos/devices/workstation/workstation_base.py b/unilabos/devices/workstation/workstation_base.py index f8cea028..62b5e657 100644 --- a/unilabos/devices/workstation/workstation_base.py +++ b/unilabos/devices/workstation/workstation_base.py @@ -147,13 +147,13 @@ class WorkstationBase(ABC): def __init__( self, - station_resource: PLRResource, + deck: PLRResource, *args, **kwargs, # 必须有kwargs ): # 基本配置 - print(station_resource) - self.deck_config = station_resource + print(deck) + self.deck_config = deck # PLR 物料系统 self.deck: Optional[Deck] = None @@ -391,5 +391,5 @@ class WorkstationBase(ABC): class ProtocolNode(WorkstationBase): - def __init__(self, station_resource: Optional[PLRResource], *args, **kwargs): - super().__init__(station_resource, *args, **kwargs) + def __init__(self, deck: Optional[PLRResource], *args, **kwargs): + super().__init__(deck, *args, **kwargs) diff --git a/unilabos/registry/devices/work_station.yaml b/unilabos/registry/devices/work_station.yaml index c5e7fced..74987ee0 100644 --- a/unilabos/registry/devices/work_station.yaml +++ b/unilabos/registry/devices/work_station.yaml @@ -6034,10 +6034,10 @@ workstation: init_param_schema: config: properties: - station_resource: + deck: type: string required: - - station_resource + - deck type: object data: properties: {} diff --git a/unilabos/ros/utils/driver_creator.py b/unilabos/ros/utils/driver_creator.py index 76c6f776..f0fdddd0 100644 --- a/unilabos/ros/utils/driver_creator.py +++ b/unilabos/ros/utils/driver_creator.py @@ -296,14 +296,14 @@ class WorkstationNodeCreator(DeviceClassCreator[T]): try: # 创建实例,额外补充一个给protocol node的字段,后面考虑取消 data["children"] = self.children - station_resource_dict = data.get("station_resource") - if station_resource_dict: + deck_dict = data.get("deck") + if deck_dict: from pylabrobot.resources import Deck, Resource plrc = PyLabRobotCreator(Deck, self.children, self.resource_tracker) - station_resource = plrc.create_instance(station_resource_dict) - data["station_resource"] = station_resource + deck = plrc.create_instance(deck_dict) + data["deck"] = deck else: - data["station_resource"] = None + data["deck"] = None self.device_instance = super(WorkstationNodeCreator, self).create_instance(data) self.post_create() return self.device_instance