Skip to content

Commit

Permalink
Add robot check also to room filter
Browse files Browse the repository at this point in the history
  • Loading branch information
robin-mueller committed Dec 22, 2024
1 parent 903bbe4 commit 1958b1c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pyrobosim/pyrobosim/utils/knowledge.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,15 +332,19 @@ def resolve_to_object(
possible_objects = [
obj
for obj in possible_objects
if obj.parent.parent.parent.name == room_name
if (
# Check whether the parent is 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 (
# Check whether the parent is a robot performing further checks
# Check whether the parent is a robot before performing further checks
hasattr(obj.parent, "parent")
and (
obj.parent == location
Expand Down

0 comments on commit 1958b1c

Please sign in to comment.