Skip to content
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

Applying VehicleControl(throttle=1.0) for the first time has a delay #1640

Closed
DanielsJusts opened this issue May 14, 2019 · 11 comments
Closed
Labels
stale Issue has not had recent activity

Comments

@DanielsJusts
Copy link

Hello!

What I noticed is that using vehicle.apply_control(VehicleControl(throttle=1.0)) for the first time has quite a delay. Afterwards, the delay is not noticeable and the commands are immediate. This is causing me issues as I'm processing the sensor data and then sending back the necessary vehicle control signals. The delay could even be observed when running manual_control.py and trying to accelerate for the first time. As you can see, the vehicle is not reacting for a few seconds and then it runs as it should. The interesting part is that when I'm applying steering command alongside the throttle command (vehicle.apply_control(VehicleControl(throttle=1.0, steer=1.0))), it can be observed that the wheels turn immediately, but the throttle is applied with a delay.

What could be causing this delay?

Also, if there is no workaround for this delay, maybe there is some way that I can get feedback as to when the throttle is going to be applied as the commands are received and vehicle.get_control() returns that the throttle is applied, but in the server physically the vehicle is not yet moving. I know that an alternative could be to use synchronous mode, but I'm just wondering if there are other options.

If it is of any concern, I am using Carla 0.9.5 on Ubuntu 16.10.

@oldtopos
Copy link

oldtopos commented May 17, 2019

I am seeing this as well with 0.9.5 on Ubuntu 18.04. I plotted output through the ROS bridge with rqt_plot and the delay is obvious. The delay happens once with every vehicle after spawning.

0.9.4 seems to have this behavior as well

FirstThrottle
SecondThrottle

@marcgpuig
Copy link
Contributor

This delay is caused by Unreal car's system, where they somehow simulate the time that the driver will spend starting the car engine or changing a new gear. I think one solution is to spawn a car, change the gear system to manual, put the first gear, and then set the gear system to automatic again.

@oldtopos
Copy link

Marc is this documented somewhere in UE4 ? I am getting zero Google hits ...

@oldtopos
Copy link

I created the simple vehicle project directly in UE4. I sense no delay in vehicle movement using the UE4 player directly with the sample project

@DanielsJusts
Copy link
Author

Hello, @oldtopos and @marcgpuig and thank you both for your input!
@marcgpuig, I played around in Carla and your workaround seems to work.

@DongChen06
Copy link

@DanielsJusts, can you explain how to avoid the delay in details?

@DanielsJusts
Copy link
Author

Hello @Derekabc!
I think @marcgpuig stated this pretty well in his comment:

I think one solution is to spawn a car, change the gear system to manual, put the first gear, and then set the gear system to automatic again.

Basically, after spawning a car you need to switch from automatic transmission to manual transmission and put the car in the first gear (vehicle.apply_control(VehicleControl(manual_gear_shift=True, gear=1))) and then you switch back to automatic transmission (vehicle.apply_control(VehicleControl(manual_gear_shift=False))). Then, as much as tested, there is no delay when applying throttle for the first time.

@linxigjs
Copy link

hi, if i use throttle to control vehicle's velocity, what's the function relationship between throttle and velocity? Where is the code? And what's the difference between throttle and acceleration? Acctually, i want to use acceleration to control the velocity in carla. Thanks.

@stale
Copy link

stale bot commented Sep 10, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Issue has not had recent activity label Sep 10, 2019
@stale stale bot closed this as completed Sep 17, 2019
@YenTran32
Copy link

In Windows, the method of switching between automatic and manual gear worked. However, the delay about 2 seconds (and depending on the amount of applied throttle) still existed in Ubuntu 18.04 and Carla 0.9.10 or 0.9.11. If manual gear (e.g., 1) is used, there's no delay. But the delay always appeared if using automatic gear (for the first time of any run). Does anyone have a solution for this?

@sinamoradi1989
Copy link

Guys anyone knows how to relate throttle to acceleration in Carla? I just know it varies between [0 1].
I'm developing NMPC control and I have figured out the lateral dynamics. Yet, I don't know about the longitudinal and how the throttle adjustment affects the vehicle.
Once I saw someone saying it has 3 default settings i.e. 0,0.5,1 which are neutral, for maintaining speed, and full throttle, respectively. This is very weird to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Issue has not had recent activity
Projects
None yet
Development

No branches or pull requests

7 participants