mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2026-02-05 22:15:04 +00:00
Merge remote-tracking branch 'upstream/dev' into device_visualization
This commit is contained in:
@@ -364,7 +364,16 @@ class HostNode(BaseROS2DeviceNode):
|
||||
resources, device_ids, bind_parent_ids, bind_locations, other_calling_params
|
||||
):
|
||||
# 这里要求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"
|
||||
sclient = self.create_client(SerialCommand, srv_address)
|
||||
sclient.wait_for_service()
|
||||
|
||||
@@ -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 (
|
||||
@@ -108,6 +112,8 @@ class ROS2ProtocolNode(BaseROS2DeviceNode):
|
||||
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):
|
||||
# 处理协议类型
|
||||
if isinstance(protocol_type, str):
|
||||
|
||||
Reference in New Issue
Block a user