Skip to content

Commit

Permalink
Slightly more informative function
Browse files Browse the repository at this point in the history
Returns bool if actor was in the pool, else otherwise
  • Loading branch information
Daraan committed Jun 26, 2024
1 parent 7758d06 commit c2f59c1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions srunner/scenariomanager/carla_data_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,11 +1003,12 @@ def remove_actor_by_id(actor_id):
Remove an actor from the pool using its ID
"""
if actor_id in CarlaDataProvider._carla_actor_pool:
CarlaDataProvider._carla_actor_pool[actor_id].destroy()
CarlaDataProvider._carla_actor_pool[actor_id] = None # type: ignore
was_destroyed = CarlaDataProvider._carla_actor_pool[actor_id].destroy()
CarlaDataProvider._carla_actor_pool[actor_id] = None
CarlaDataProvider._carla_actor_pool.pop(actor_id)
else:
print("Trying to remove a non-existing actor id {}".format(actor_id))
return was_destroyed
print("Trying to remove a non-existing actor id {}".format(actor_id))
return None

@staticmethod
def remove_actors_in_surrounding(location, distance):
Expand Down

0 comments on commit c2f59c1

Please sign in to comment.