-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
destroying actors from a list #7653
Comments
Sorry not sure why the code is formated this poorly. So in general .destroy() just sometimes crashes my environment |
You have to call at least one time tick() after the creation of vehicles in order to be able to destroying them properly. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CARLA
version: 0.9.15Platform/OS: Windows
Problem you have experienced: I'm spawning actors that run on autopilot. When spawning I add the corresponding actor to a list to later destroy that actor. But once I call the destroy method the simulation & my kernel crashes and I get no error message.
What you expected to happen: The corresponding (or all) actors to be destroyed (removed from the simulation) and the simulation still running
Steps to reproduce:
From my notebook. Everything works fine and my cars get spawned but once I run the last cell with the vehicle.destroy() method everything crashes.
``
import carla
import random
import time
client = carla.Client('localhost', 2000)
client.set_timeout(5.0)
world = client.get_world()
spawn_points = world.get_map().get_spawn_points()
spawned_cars = []
for _ in range(60):
car_blueprint = random.choice(world.get_blueprint_library().filter("vehicle"))
if car_blueprint.has_attribute('color'):
color = random.choice(car_blueprint.get_attribute('color').recommended_values)
car_blueprint.set_attribute('color', color)
car_blueprint.set_attribute('role_name', 'autopilot')
for vehicle in spawned_cars:
try:
vehicle.destroy()
except Exception as e:
print("Failed to destroy car:", e)
``
The text was updated successfully, but these errors were encountered: