diff --git a/unilabos/resources/graphio.py b/unilabos/resources/graphio.py index 3e3ece3..30c2128 100644 --- a/unilabos/resources/graphio.py +++ b/unilabos/resources/graphio.py @@ -84,7 +84,7 @@ def canonicalize_links_ports(data: dict) -> dict: # 第一遍处理:将字符串类型的port转换为字典格式 for link in data.get("links", []): port = link.get("port") - if link["type"] == "physical": + if link.get("type", "physical") == "physical": link["type"] = "fluid" if isinstance(port, int): port = str(port) diff --git a/unilabos/ros/nodes/presets/protocol_node.py b/unilabos/ros/nodes/presets/protocol_node.py index 72e3d65..33fa0d7 100644 --- a/unilabos/ros/nodes/presets/protocol_node.py +++ b/unilabos/ros/nodes/presets/protocol_node.py @@ -84,7 +84,11 @@ class ROS2ProtocolNode(BaseROS2DeviceNode): self.communication_node_id_to_instance[device_id] = d continue + for device_id, device_config in self.children.items(): + if device_config.get("type", "device") != "device": + continue # 设置硬件接口代理 + d = self.sub_devices[device_id] if d: hardware_interface = d.ros_node_instance._hardware_interface if (