Skip to content

Commit

Permalink
Dead actor cleaning in CDP._actor_*_maps
Browse files Browse the repository at this point in the history
  • Loading branch information
Daraan committed Jun 26, 2024
1 parent 966cc11 commit 7b935b7
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions srunner/scenariomanager/carla_data_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,18 +137,24 @@ def on_carla_tick():
Callback from CARLA
"""
with CarlaDataProvider._lock:
for actor in CarlaDataProvider._actor_velocity_map:
for actor in CarlaDataProvider._actor_velocity_map.copy():
if actor is not None and actor.is_alive:
CarlaDataProvider._actor_velocity_map[actor] = calculate_velocity(actor)
else:
del CarlaDataProvider._actor_velocity_map[actor]

for actor in CarlaDataProvider._actor_location_map:
for actor in CarlaDataProvider._actor_location_map.copy():
if actor is not None and actor.is_alive:
CarlaDataProvider._actor_location_map[actor] = actor.get_location()
else:
del CarlaDataProvider._actor_location_map[actor]

for actor in CarlaDataProvider._actor_transform_map:
for actor in CarlaDataProvider._actor_transform_map.copy():
if actor is not None and actor.is_alive:
CarlaDataProvider._actor_transform_map[actor] = actor.get_transform()

else:
del CarlaDataProvider._actor_transform_map[actor]

world = CarlaDataProvider._world
if world is None:
print("WARNING: CarlaDataProvider couldn't find the world")
Expand Down

0 comments on commit 7b935b7

Please sign in to comment.