mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2025-12-17 13:01:12 +00:00
fix protocol node
This commit is contained in:
@@ -72,7 +72,7 @@ class VirtualFilter:
|
|||||||
"""Execute filter action - 完全按照 Filter.action 参数 🌊"""
|
"""Execute filter action - 完全按照 Filter.action 参数 🌊"""
|
||||||
vessel_id, _ = get_vessel(vessel)
|
vessel_id, _ = get_vessel(vessel)
|
||||||
filtrate_vessel_id, _ = get_vessel(filtrate_vessel) if filtrate_vessel else (f"{vessel_id}_filtrate", {})
|
filtrate_vessel_id, _ = get_vessel(filtrate_vessel) if filtrate_vessel else (f"{vessel_id}_filtrate", {})
|
||||||
|
|
||||||
# 🔧 新增:温度自动调整
|
# 🔧 新增:温度自动调整
|
||||||
original_temp = temp
|
original_temp = temp
|
||||||
if temp == 0.0:
|
if temp == 0.0:
|
||||||
@@ -216,12 +216,17 @@ class VirtualFilter:
|
|||||||
def current_temp(self) -> float:
|
def current_temp(self) -> float:
|
||||||
"""Filter.action feedback 字段 🌡️"""
|
"""Filter.action feedback 字段 🌡️"""
|
||||||
return self.data.get("current_temp", 25.0)
|
return self.data.get("current_temp", 25.0)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def current_status(self) -> str:
|
||||||
|
"""Filter.action feedback 字段 📋"""
|
||||||
|
return self.data.get("current_status", "")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def filtered_volume(self) -> float:
|
def filtered_volume(self) -> float:
|
||||||
"""Filter.action feedback 字段 💧"""
|
"""Filter.action feedback 字段 💧"""
|
||||||
return self.data.get("filtered_volume", 0.0)
|
return self.data.get("filtered_volume", 0.0)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def message(self) -> str:
|
def message(self) -> str:
|
||||||
return self.data.get("message", "")
|
return self.data.get("message", "")
|
||||||
|
|||||||
@@ -843,6 +843,15 @@ class HostNode(BaseROS2DeviceNode):
|
|||||||
success = bool(r)
|
success = bool(r)
|
||||||
|
|
||||||
response.success = success
|
response.success = success
|
||||||
|
|
||||||
|
if success:
|
||||||
|
from unilabos.resources.graphio import physical_setup_graph
|
||||||
|
for resource in resources:
|
||||||
|
if resource.get("id") not in physical_setup_graph.nodes:
|
||||||
|
physical_setup_graph.add_node(resource["id"], **resource)
|
||||||
|
else:
|
||||||
|
physical_setup_graph.nodes[resource["id"]]["data"].update(resource["data"])
|
||||||
|
|
||||||
self.lab_logger().info(f"[Host Node-Resource] Add request completed, success: {success}")
|
self.lab_logger().info(f"[Host Node-Resource] Add request completed, success: {success}")
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|||||||
@@ -223,9 +223,14 @@ class ROS2ProtocolNode(BaseROS2DeviceNode):
|
|||||||
|
|
||||||
self.lab_logger().info(f"Working on physical setup: {physical_setup_graph}")
|
self.lab_logger().info(f"Working on physical setup: {physical_setup_graph}")
|
||||||
protocol_steps = protocol_steps_generator(G=physical_setup_graph, **protocol_kwargs)
|
protocol_steps = protocol_steps_generator(G=physical_setup_graph, **protocol_kwargs)
|
||||||
|
logs = []
|
||||||
|
for step in protocol_steps:
|
||||||
|
if isinstance(step, dict) and "log_message" in step.get("action_kwargs", {}):
|
||||||
|
logs.append(step)
|
||||||
|
elif isinstance(step, list):
|
||||||
|
logs.append(step)
|
||||||
self.lab_logger().info(f"Goal received: {protocol_kwargs}, running steps: "
|
self.lab_logger().info(f"Goal received: {protocol_kwargs}, running steps: "
|
||||||
f"{json.dumps([step for step in protocol_steps if 'log_message' not in step['action_kwargs']], indent=4)}")
|
f"{json.dumps(logs, indent=4, ensure_ascii=False)}")
|
||||||
|
|
||||||
time_start = time.time()
|
time_start = time.time()
|
||||||
time_overall = 100
|
time_overall = 100
|
||||||
|
|||||||
Reference in New Issue
Block a user