Skip to content

Commit

Permalink
Fix error when resolving possible objects to pick while some are carr…
Browse files Browse the repository at this point in the history
…ied by other robots (#313)
  • Loading branch information
robin-mueller authored Dec 22, 2024
1 parent 54286f5 commit c36d198
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions pyrobosim/pyrobosim/utils/knowledge.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,20 +332,28 @@ def resolve_to_object(
possible_objects = [
obj
for obj in possible_objects
if obj.parent.parent.parent.name == room_name
if (
# Verify the object's parent is not a robot before performing further checks
hasattr(obj.parent, "parent")
and obj.parent.parent.parent.name == room_name
)
]

if location is not None:
possible_objects = [
obj
for obj in possible_objects
if (
obj.parent == location
or obj.parent.name == location
or obj.parent.parent == location
or obj.parent.parent.name == location
or obj.parent.category == location
or obj.parent.parent.category == location
# Verify the object's parent is not a robot before performing further checks
hasattr(obj.parent, "parent")
and (
obj.parent == location
or obj.parent.name == location
or obj.parent.parent == location
or obj.parent.parent.name == location
or obj.parent.category == location
or obj.parent.parent.category == location
)
)
]

Expand Down

0 comments on commit c36d198

Please sign in to comment.