Compare commits

...

3 Commits

Author SHA1 Message Date
Guangxin Zhang
d289c01a34 Delete unnecessary files. 2025-07-24 16:16:12 +08:00
Xuwznln
badf402457 更正注册表中的数字类型 2025-07-24 14:22:53 +08:00
Xuwznln
4d98e1c46c 物料添加失败应该直接raise ValueError,不要等待 2025-07-24 12:10:37 +08:00
7 changed files with 34 additions and 42513 deletions

21293
deck.json

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -4388,11 +4388,11 @@ liquid_handler:
deck: deck:
type: string type: string
simulator: simulator:
default: false
type: boolean type: boolean
required: required:
- backend - backend
- deck - deck
- simulator
type: object type: object
data: data:
properties: {} properties: {}

View File

@@ -2187,65 +2187,65 @@ virtual_multiway_valve:
data_source: executor data_source: executor
data_type: fluid data_type: fluid
description: 八通阀门端口1 description: 八通阀门端口1
handler_key: 1 handler_key: "1"
io_type: source io_type: source
label: 1 label: "1"
side: NORTH side: NORTH
- data_key: fluid_port_2 - data_key: fluid_port_2
data_source: executor data_source: executor
data_type: fluid data_type: fluid
description: 八通阀门端口2 description: 八通阀门端口2
handler_key: 2 handler_key: "2"
io_type: source io_type: source
label: 2 label: "2"
side: EAST side: EAST
- data_key: fluid_port_3 - data_key: fluid_port_3
data_source: executor data_source: executor
data_type: fluid data_type: fluid
description: 八通阀门端口3 description: 八通阀门端口3
handler_key: 3 handler_key: "3"
io_type: source io_type: source
label: 3 label: "3"
side: EAST side: EAST
- data_key: fluid_port_4 - data_key: fluid_port_4
data_source: executor data_source: executor
data_type: fluid data_type: fluid
description: 八通阀门端口4 description: 八通阀门端口4
handler_key: 4 handler_key: "4"
io_type: source io_type: source
label: 4 label: "4"
side: SOUTH side: SOUTH
- data_key: fluid_port_5 - data_key: fluid_port_5
data_source: executor data_source: executor
data_type: fluid data_type: fluid
description: 八通阀门端口5 description: 八通阀门端口5
handler_key: 5 handler_key: "5"
io_type: source io_type: source
label: 5 label: "5"
side: SOUTH side: SOUTH
- data_key: fluid_port_6 - data_key: fluid_port_6
data_source: executor data_source: executor
data_type: fluid data_type: fluid
description: 八通阀门端口6 description: 八通阀门端口6
handler_key: 6 handler_key: "6"
io_type: source io_type: source
label: 6 label: "6"
side: WEST side: WEST
- data_key: fluid_port_7 - data_key: fluid_port_7
data_source: executor data_source: executor
data_type: fluid data_type: fluid
description: 八通阀门端口7 description: 八通阀门端口7
handler_key: 7 handler_key: "7"
io_type: source io_type: source
label: 7 label: "7"
side: WEST side: WEST
- data_key: fluid_port_8 - data_key: fluid_port_8
data_source: executor data_source: executor
data_type: fluid data_type: fluid
description: 八通阀门端口8 description: 八通阀门端口8
handler_key: 8 handler_key: "8"
io_type: source io_type: source
label: 8 label: "8"
side: NORTH side: NORTH
icon: EightPipeline.webp icon: EightPipeline.webp
init_param_schema: init_param_schema:

View File

@@ -110,7 +110,7 @@ class Registry:
"placeholder_keys": { "placeholder_keys": {
"res_id": "unilabos_resources", # 将当前实验室的全部物料id作为下拉框可选择 "res_id": "unilabos_resources", # 将当前实验室的全部物料id作为下拉框可选择
"device_id": "unilabos_devices", # 将当前实验室的全部设备id作为下拉框可选择 "device_id": "unilabos_devices", # 将当前实验室的全部设备id作为下拉框可选择
"parent": "unilabos_resources", # 将当前实验室的全部物料id作为下拉框可选择 "parent": "unilabos_nodes", # 将当前实验室的设备/物料作为下拉框可选择
}, },
}, },
"test_latency": { "test_latency": {
@@ -131,7 +131,7 @@ class Registry:
"config_info": [], "config_info": [],
"icon": "icon_device.webp", "icon": "icon_device.webp",
"registry_type": "device", "registry_type": "device",
"handles": {}, "handles": [], # virtue采用了不同的handle
"init_param_schema": {}, "init_param_schema": {},
"file_path": "/", "file_path": "/",
} }
@@ -144,7 +144,7 @@ class Registry:
logger.debug(f"[UniLab Registry] Path {i+1}/{len(self.registry_paths)}: {sys_path}") logger.debug(f"[UniLab Registry] Path {i+1}/{len(self.registry_paths)}: {sys_path}")
sys.path.append(str(sys_path)) sys.path.append(str(sys_path))
self.load_device_types(path, complete_registry) self.load_device_types(path, complete_registry)
# self.load_resource_types(path, complete_registry) self.load_resource_types(path, complete_registry)
logger.info("[UniLab Registry] 注册表设置完成") logger.info("[UniLab Registry] 注册表设置完成")
# 标记setup已被调用 # 标记setup已被调用
self._setup_called = True self._setup_called = True
@@ -174,7 +174,7 @@ class Registry:
if "icon" not in resource_info: if "icon" not in resource_info:
resource_info["icon"] = "" resource_info["icon"] = ""
if "handles" not in resource_info: if "handles" not in resource_info:
resource_info["handles"] = {} resource_info["handles"] = []
if "init_param_schema" not in resource_info: if "init_param_schema" not in resource_info:
resource_info["init_param_schema"] = {} resource_info["init_param_schema"] = {}
if complete_registry: if complete_registry:
@@ -418,7 +418,7 @@ class Registry:
if "icon" not in device_config: if "icon" not in device_config:
device_config["icon"] = "" device_config["icon"] = ""
if "handles" not in device_config: if "handles" not in device_config:
device_config["handles"] = {} device_config["handles"] = []
if "init_param_schema" not in device_config: if "init_param_schema" not in device_config:
device_config["init_param_schema"] = {} device_config["init_param_schema"] = {}
if "class" in device_config: if "class" in device_config:

View File

@@ -364,7 +364,16 @@ class HostNode(BaseROS2DeviceNode):
resources, device_ids, bind_parent_ids, bind_locations, other_calling_params resources, device_ids, bind_parent_ids, bind_locations, other_calling_params
): ):
# 这里要求device_id传入必须是edge_device_id # 这里要求device_id传入必须是edge_device_id
namespace = "/devices/" + device_id if device_id not in self.devices_names:
self.lab_logger().error(f"[Host Node] Device {device_id} not found in devices_names. Create resource failed.")
raise ValueError(f"[Host Node] Device {device_id} not found in devices_names. Create resource failed.")
device_key = f"{self.devices_names[device_id]}/{device_id}"
if device_key not in self._online_devices:
self.lab_logger().error(f"[Host Node] Device {device_key} is offline. Create resource failed.")
raise ValueError(f"[Host Node] Device {device_key} is offline. Create resource failed.")
namespace = self.devices_names[device_id]
srv_address = f"/srv{namespace}/append_resource" srv_address = f"/srv{namespace}/append_resource"
sclient = self.create_client(SerialCommand, srv_address) sclient = self.create_client(SerialCommand, srv_address)
sclient.wait_for_service() sclient.wait_for_service()

View File

@@ -112,6 +112,8 @@ class ROS2ProtocolNode(BaseROS2DeviceNode):
f"添加了{write}方法(来源:{name} {communicate_hardware_info['read']})" f"添加了{write}方法(来源:{name} {communicate_hardware_info['read']})"
) )
self.lab_logger().info(f"ROS2ProtocolNode {device_id} initialized with protocols: {self.protocol_names}")
def _setup_protocol_names(self, protocol_type): def _setup_protocol_names(self, protocol_type):
# 处理协议类型 # 处理协议类型
if isinstance(protocol_type, str): if isinstance(protocol_type, str):