mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2025-12-17 13:01:12 +00:00
过滤本地动作
This commit is contained in:
@@ -734,7 +734,16 @@ class Registry:
|
|||||||
device_info_copy = copy.deepcopy(device_info)
|
device_info_copy = copy.deepcopy(device_info)
|
||||||
if "class" in device_info_copy and "action_value_mappings" in device_info_copy["class"]:
|
if "class" in device_info_copy and "action_value_mappings" in device_info_copy["class"]:
|
||||||
action_mappings = device_info_copy["class"]["action_value_mappings"]
|
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"]:
|
if "schema" in action_config and action_config["schema"]:
|
||||||
schema = action_config["schema"]
|
schema = action_config["schema"]
|
||||||
# 确保schema结构存在
|
# 确保schema结构存在
|
||||||
|
|||||||
@@ -158,6 +158,18 @@ class HostNode(BaseROS2DeviceNode):
|
|||||||
"/devices/host_node/test_resource",
|
"/devices/host_node/test_resource",
|
||||||
callback_group=self.callback_group,
|
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实例
|
} # 用来存储多个ActionClient实例
|
||||||
self._action_value_mappings: Dict[str, Dict] = (
|
self._action_value_mappings: Dict[str, Dict] = (
|
||||||
{}
|
{}
|
||||||
|
|||||||
Reference in New Issue
Block a user