diff --git a/unilabos/registry/registry.py b/unilabos/registry/registry.py index 97018d4e..6df35a9a 100644 --- a/unilabos/registry/registry.py +++ b/unilabos/registry/registry.py @@ -734,7 +734,16 @@ class Registry: device_info_copy = copy.deepcopy(device_info) if "class" in device_info_copy and "action_value_mappings" in device_info_copy["class"]: action_mappings = device_info_copy["class"]["action_value_mappings"] - for action_name, action_config in action_mappings.items(): + # 过滤掉内置的驱动命令动作 + builtin_actions = ["_execute_driver_command", "_execute_driver_command_async"] + filtered_action_mappings = { + action_name: action_config + for action_name, action_config in action_mappings.items() + if action_name not in builtin_actions + } + device_info_copy["class"]["action_value_mappings"] = filtered_action_mappings + + for action_name, action_config in filtered_action_mappings.items(): if "schema" in action_config and action_config["schema"]: schema = action_config["schema"] # 确保schema结构存在 diff --git a/unilabos/ros/nodes/presets/host_node.py b/unilabos/ros/nodes/presets/host_node.py index 0bf86bce..e28c2930 100644 --- a/unilabos/ros/nodes/presets/host_node.py +++ b/unilabos/ros/nodes/presets/host_node.py @@ -158,6 +158,18 @@ class HostNode(BaseROS2DeviceNode): "/devices/host_node/test_resource", callback_group=self.callback_group, ), + "/devices/host_node/_execute_driver_command": ActionClient( + self, + lab_registry.EmptyIn, + "/devices/host_node/_execute_driver_command", + callback_group=self.callback_group, + ), + "/devices/host_node/_execute_driver_command_async": ActionClient( + self, + lab_registry.EmptyIn, + "/devices/host_node/_execute_driver_command_async", + callback_group=self.callback_group, + ), } # 用来存储多个ActionClient实例 self._action_value_mappings: Dict[str, Dict] = ( {}