Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error when resolving possible objects to pick while some are carried by other robots #313

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading