Closed LeonardMendicantBias closed 4 months ago
The default timeout of 10 seconds might not be sufficient when using multiple cameras. Increase the timeout to give the simulator more time to process the requests
Thank you for the quick response. Unfortunately, the error persists. I modified the following.
client.set_timeout(50.0)
The simulations simply wait 50 seconds before showing the same error.
One more "anomaly", I switch the simulation to async mode and everything works. However, this would not do since I need the synchronous mode.
Hi, the "time-out" error happens if Carla didn't answered. It could be the connection, Carla crashed, Carla took too long, or everything else that could prevent a answer from the server in the timeout limit.
You can try to add some debug messages to see where the script got an error. Did the Server still run after the time-out error?
btw. the code is hard to read because of the formatting. You can use
```python
code
` ` `
to keep the format. (without space)
@PatrickPromitzer Thank you for the coding quote tips. I did not know about triple ``. The github's editing tool only shows single
. I edited the code for future reading.
The UE 4 editor is running while the script is waiting for a response! After the time-out message, I can still move around in the UE 4 editor (using WASD). However, If I start the script again, the script returns the time-out message without the initial images. I think that using 4 cameras crashes the Carla server and prevents later connections. If I close the UE 4 editor and reopen it, the script still cannot find the Carla server. Does that mean the Carla server still running and the reopened UE 4 editor started another server? Since the UE 4 editor is still "functional", I really don't know where to debug. Do you have any suggestion where should I watch for a possible bug?
p/s: I start the UE 4 editor in the folder "./Unreal/CarlaUE4/CarlaUE4.uproject" after I finished build Carla from source.
Normally, if the server crashes the unreal editor crashes, too. (maybe only on Ubuntu) You could search if an old instance is running and close everything Carla related. It is not a solution, but maybe something in the background is creating a problem.
You could look if your firewall is blocking something.
You could try making a package and test it with that package.
One thing that helps for me is adding "world.tick()" in between adding sensors or listeners.
You could try using one blueprint instance for each camera (just to be sure, even if should not make a difference)
You can watch your CPU/GPU usage, too.
For
camera_1.listen(lambda image: image.save_to_disk(f'{args.directory}/camera-1/{image.frame:06d}.png'))
you could call an custom function and log the function call.
with open("log_file.txt", "a") as f:
f.write("Function call: {0}".format(camera_name))
Maybe I come up with more ideas at a later time.
@PatrickPromitzer Thank you so much for your suggestions. My firewall has been turned off. I do have a defined function for the callback.
I don't know what I have changed, but somehow the script works. I mark this as solved but I really don't know what was the problem.
I found the problem. It is the sensor_tick. When I set the value too low (i.e., 0.02 for 50 fps), the simulator time-out while it works well with sensor_tick=1. I guess I need a better computer.
The normal tickrate is 0.1, and at some point, the documentation said you should not go below 0.05
Try which rate works for you before buying new hardware.
Yes, the document states that the simulation should not be less than 10 FPS (0.01) or the physic would get weird. But sensor_tick is the update rate of the camera, not the simulator itself.
Also, I am able to utilize sensor_tick=0.02
by adding the image into a global queue in the callback function. Then, after the world.tick()
, I save the queued images. This makes the simulations not real-time anymore, but that does not matter since I only need the synthetic data.
Dear Carla developers, contributors, and users.
I am getting familar with Carla (version 0.9.15) to generate data. In my scenario, I attach (4) cameras on static places (i.e., on a traffic light). Since I need to obtain the exact locations for the cameras, I built Carla on Windows and played around with the UE 4 editor. I am able to place the cameras at the locations I wanted. Following the instruction from Carla, I spawn cameras and save the image via the callback function. The problem is that the simulation provide data if there are at most 2 cameras. If there are 3 cameras, the simulation starts, generate a single image for each spawned cameras, and crash with the error: "time-out of 10000ms while waiting for the simulator, make sure the simulator is ready and connected to 127.0.0.1:2000". This confused me because the error is simply not true. The simulation did generate 1 image.
I attached my code for error reproduction. It is adapted from generate_traffic.py.