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

Speed up information retrieval #1098

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
7 changes: 7 additions & 0 deletions srunner/scenariomanager/carla_data_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ def get_velocity(actor):
"""
returns the absolute velocity for the given actor
"""
if actor in CarlaDataProvider._actor_velocity_map:
return CarlaDataProvider._actor_velocity_map[actor]
# Look for same actor, but stored as different python object
for key in CarlaDataProvider._actor_velocity_map:
if key.id == actor.id:
return CarlaDataProvider._actor_velocity_map[key]
Expand All @@ -174,6 +177,8 @@ def get_location(actor):
"""
returns the location for the given actor
"""
if actor in CarlaDataProvider._actor_location_map:
return CarlaDataProvider._actor_location_map[actor]
for key in CarlaDataProvider._actor_location_map:
if key.id == actor.id:
return CarlaDataProvider._actor_location_map[key]
Expand All @@ -189,6 +194,8 @@ def get_transform(actor):
"""
returns the transform for the given actor
"""
if actor in CarlaDataProvider._actor_transform_map:
return CarlaDataProvider._actor_transform_map[actor] or actor.get_transform()
for key in CarlaDataProvider._actor_transform_map:
if key.id == actor.id:
# The velocity location information is the entire behavior tree updated every tick
Expand Down
Loading