What is the correct rate for the client to call the apply_control() in the asych mode?

Hi all, I have a question on the apply_control() function. It says that the function would apply a control command (e.g. throttle/brake) on the next tick. I’m assuming it would only apply for a single next tick, right? Then it’s important to know the tick step length. Let’s say, if every tick is 0.005s, then the control object would only be applied in 0.005s. In real life, we press the pedal, the throttle/brake would be continuing in a few seconds. To guarantee continuity, I think the client should know the tick delta_t, so as it remains the loop with the same rate. If the client calls the apply_control() with a slower rate, e.g. 0.01s, I guess we would have the discontinuity due to the different time steps. Is it a real concern here?

I asked this question because I feel the throttle command is not strong enough to speed up the vehicle. I’m using the default asynch mode, and repeat my apply_control(throttle) every 0.01s. It usually requires very large value, like 0.6~0.8 throttle to really accelerate the car. Since I’m using a PID velocity controller designed for realistic cars, 0.2~0.5 gas are normal but they seem too mild for cars in Carla. Now I’m concerned about the frequency of control commands in my implementation. For the default asynch mode, is it ok to call the apply_control(throttle) every 0.01s? Can anyone share some comments?

Hello Hao,
Thank you for your question.
In principle is a bit more complicated. By default, the Carla Vehicle class uses the PhyX Vehicle engine. When you call the apply_control(throttle) the value is set inside the engine and be used inside the engine to simulate the physics of the vehicle. This means that will not apply only or during 0.005s but continuously until you set it differently.

According to the values, have you check all the values present in the physics of the car? https://carla.readthedocs.io/en/latest/tuto_G_control_vehicle_physics/
Maybe there are some parameters like the clutch_strength that need to be adjusted for getting more realistic results.

Thanks Daniel, good to know the throttle is continuously applied. For the acceleration performance, I found the defualt Tesla Model 3 requires unrealistically high throttle value, for example, it requires 0.8 to maintain a high speed above 30 m/s. But other default gasoline cars are better at this. So you are right, it would largely depend on the physics parameters for the car. Also we’d bettern use automatic transmission if we don’t want to change gear manually in code.