I have a question about velocity PID controller: https://github.com/ArduPilot/ardupilot/blob/master/libraries/AC_AttitudeControl/AC_PosControl.cpp

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?