From 7c6c14c8c2720211e1c877fd6a9ddb09000880f2 Mon Sep 17 00:00:00 2001 From: Jonas Dech Date: Fri, 30 Aug 2024 16:46:27 +0200 Subject: [PATCH] [WorldObject] Added function which returns links to which something is attached --- src/pycram/world_concepts/world_object.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pycram/world_concepts/world_object.py b/src/pycram/world_concepts/world_object.py index 3db7c19f3..986a26ebd 100644 --- a/src/pycram/world_concepts/world_object.py +++ b/src/pycram/world_concepts/world_object.py @@ -1017,6 +1017,15 @@ def copy_to_prospection(self) -> Object: obj.current_state = self.current_state return obj + def get_link_for_attached_objects(self) -> Dict[Object, ObjectDescription.Link]: + """ + Returns a dictionary which maps attached object to the link of this object to which the given object is attached. + + :return: The link of this object to which the given object is attached. + """ + return {obj: attachment.parent_link for obj, attachment in self.attachments.items()} + + def __copy__(self) -> Object: """ Returns a copy of this object. The copy will have the same name, type, path, description, pose, world and color.