Servers by jDrones

Overshot in velocity PID controller

(Aleksandr) #1

I have a question about velocity PID controller:

In AC_PosControl::rate_to_accel_xy() velocity error comes into target acceleration.
According to source code, we will get the following at decceleration from 5 m/s to 0 m/s:
“I” component will accumulate till we hit 0 (or “I” limit), so at velocity > 0 (e.g. 0.0001 m/s) target acceleration will be far away from zero.
So at velocity equal to 0, we will get non-zero (negative) target acceleration according with “I” component, thus we will get negative velocity for sometime after passing 0.
Am I right?

@Leonardthall can you help me with understanding?

(Leonard Hall) #2

Hi Aleksandr,

Thanks for posting this here.

You are almost right. If you set the desired velocity of the PID to zero after it has been set to a positive value, the aircraft will slow down until it reaches zero velocity where the P term will be zero but there will be some I term built up depending on how long it took to decelerate. So this will result in the aircraft continuing to move zero and have a negative velocity.

The bit you missed is that this will cause a negative position error and the position P term will then ask for a small positive velocity to bring it back to the point. So now you have a small positive velocity that will make the velocity error times P equal to the I term build up. This then discharges the I term.

So the final outcome of the situation I described is you get a small position error when you stop and the aircraft moves back to a zero position and velocity error quiet quickly. Normally these errors are smaller than the normal deviation of the aircraft.

We also use feed forward in our controllers that keeps the PID loops near zero unless there is an external disturbance. So this also ensures the situation we are looking at here stays small.

I have a video that goes into detail that you may be interested in.