From ad21644db0692dbe922e218e9ebdbf745a32c554 Mon Sep 17 00:00:00 2001 From: ZiWei <131428629+ZiWei09@users.noreply.github.com> Date: Wed, 14 Jan 2026 18:42:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20WareHouse=20=E7=9A=84=E4=B8=8D=E5=8F=AF?= =?UTF-8?q?=E5=93=88=E5=B8=8C=E7=B1=BB=E5=9E=8B=E9=94=99=E8=AF=AF=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=88=B6=E8=8A=82=E7=82=B9=E5=8E=BB=E9=87=8D?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- unilabos/ros/nodes/base_device_node.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/unilabos/ros/nodes/base_device_node.py b/unilabos/ros/nodes/base_device_node.py index efe287d..c248882 100644 --- a/unilabos/ros/nodes/base_device_node.py +++ b/unilabos/ros/nodes/base_device_node.py @@ -923,7 +923,14 @@ class BaseROS2DeviceNode(Node, Generic[T]): plr_resources = tree_set.to_plr_resources() result, parents = _handle_add(plr_resources, tree_set, additional_add_params) parents: List[Optional["ResourcePLR"]] = [i for i in parents if i is not None] - de_dupe_parents = list(set(parents)) + # de_dupe_parents = list(set(parents)) + # Fix unhashable type error for WareHouse + de_dupe_parents = [] + _seen_ids = set() + for p in parents: + if id(p) not in _seen_ids: + _seen_ids.add(id(p)) + de_dupe_parents.append(p) new_tree_set = ResourceTreeSet.from_plr_resources(de_dupe_parents) # 去重 for tree in new_tree_set.trees: if tree.root_node.res_content.uuid_parent is None and self.node_name != "host_node": @@ -1568,16 +1575,16 @@ class BaseROS2DeviceNode(Node, Generic[T]): def _convert_resources_sync(self, *uuids: str) -> List["ResourcePLR"]: """同步转换资源 UUID 为实例 - + Args: *uuids: 一个或多个资源 UUID - + Returns: 单个 UUID 时返回单个资源实例,多个 UUID 时返回资源实例列表 """ if not uuids: raise ValueError("至少需要提供一个 UUID") - + uuids_list = list(uuids) future = self._resource_clients["c2s_update_resource_tree"].call_async(SerialCommand.Request( command=json.dumps(