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
Can not kill Carla by Python script when i set autopilot mode #7597
Comments
I even tried ego_vehicle.set_autopilot(False), but the results are same, that once i use function set_autopilot, not matter set True or False, I can not kill Carla by Python script. |
@Youngzipper which is your use case to start/exit the CARLA server in that way? I would recommend using the client to If you still need to start/exit the CARLA server within your python script I would recommend cleaning the simulation before doing that: while True
...
# Destroy all actors spawned
ego_vehicle.destroy() |
Thank you ! I have tried ego_vehicle.destroy(), but my problem still exits. |
Could you upload your whole terminal output? Your code is working fine to me. |
My terminal output:
And i'm sorry that my codes has one mistake, there is only one while True after setting autopilot:
|
Hmm I see. Probably this crash is due to the traffic manager not shutting down properly. My proposal would be getting an instance of the traffic manager and before closing the server shutting down the traffic manager. Try adding the following lines to your code: # ...
def main():
try:
# ...
client = carla.Client('localhost', 2000)
tm = client.get_trafficmanager() # get an instance of the trafficmanager
world = client.load_world("Town04")
# YOUR LOOP CODE
# clean-up the simulation
ego_vehicle.destroy()
tm.shut_down() # properly shutdown the trafficmanager
except:
pass |
I add the following lines after my while True loop:
And i got the results like :
Seems something wrong with tm.shut_down() |
Things changed when i tried again tm.shut_down(), it raised aborted core dumped in episode 2:
And the codes i get traffic manager be like:
Something wrong with client.load_world() in episode 2. |
I tried reload_world(), and here is the error message:
it happens when i load_world("Town04") once and later reload_world() once, not immediately after reloading, but after running some codes. |
if i tried reload_world() in my brief codes without SUMO cosim, error happens in episode 2:
while CARLA remains alive |
Still not able to reproduce your issue. Are you running more than one CARLA client at the same time? This can cause issues with the traffic manager and the way you are closing the server as it also works with a primary-secondary architecture. Alternatively, you cloud try using a bash script to initialize CARLA and your co-simulation scripts instead of doing all this inside the same python process. I believe this could be a safer way to proceed. |
I meet a same issue. |
@lightlefter What do you mean by the script didn't finished? What script are you running? Are you setting the simulator in sync or async mode? Please provide more information so we can give you a proper answer. |
1、It means the script is running. |
@lightlefter Maybe you can end up CARLA in task manager |
I did end up CARLA in task manager. @Youngzipper |
I am using CARLA 0.9.15 in Ubuntu 18.04
I write a python script to open carla、spawn vehicle、set autopilot、kill carla... repeatedly.
But when i kill carla for the first round, error meassage was raised: aborted (core dumped).
The weird thing is if i do not set autopilot, then the circulation can run, which is open carla、spawn vehicle、kill carla...
My brief codes is as follows:
The text was updated successfully, but these errors were encountered: