mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2026-02-06 15:05:13 +00:00
物料添加失败应该直接raise ValueError,不要等待
This commit is contained in:
@@ -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: {}
|
||||||
|
|||||||
@@ -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": {
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
@@ -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):
|
||||||
|
|||||||
Reference in New Issue
Block a user