diff --git a/unilabos/devices/virtual/virtual_filter.py b/unilabos/devices/virtual/virtual_filter.py index 8c993698..ffd8f549 100644 --- a/unilabos/devices/virtual/virtual_filter.py +++ b/unilabos/devices/virtual/virtual_filter.py @@ -72,7 +72,7 @@ class VirtualFilter: """Execute filter action - 完全按照 Filter.action 参数 🌊""" vessel_id, _ = get_vessel(vessel) filtrate_vessel_id, _ = get_vessel(filtrate_vessel) if filtrate_vessel else (f"{vessel_id}_filtrate", {}) - + # 🔧 新增:温度自动调整 original_temp = temp if temp == 0.0: @@ -216,12 +216,17 @@ class VirtualFilter: def current_temp(self) -> float: """Filter.action feedback 字段 🌡️""" return self.data.get("current_temp", 25.0) - + + @property + def current_status(self) -> str: + """Filter.action feedback 字段 📋""" + return self.data.get("current_status", "") + @property def filtered_volume(self) -> float: """Filter.action feedback 字段 💧""" return self.data.get("filtered_volume", 0.0) - + @property def message(self) -> str: return self.data.get("message", "") diff --git a/unilabos/ros/nodes/presets/host_node.py b/unilabos/ros/nodes/presets/host_node.py index 07e89602..19e96743 100644 --- a/unilabos/ros/nodes/presets/host_node.py +++ b/unilabos/ros/nodes/presets/host_node.py @@ -843,6 +843,15 @@ class HostNode(BaseROS2DeviceNode): success = bool(r) 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}") return response diff --git a/unilabos/ros/nodes/presets/protocol_node.py b/unilabos/ros/nodes/presets/protocol_node.py index cb8f8d2a..ddb08451 100644 --- a/unilabos/ros/nodes/presets/protocol_node.py +++ b/unilabos/ros/nodes/presets/protocol_node.py @@ -223,9 +223,14 @@ class ROS2ProtocolNode(BaseROS2DeviceNode): self.lab_logger().info(f"Working on physical setup: {physical_setup_graph}") 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: " - 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_overall = 100