Hello,
as far as I understood, the PID (PID_V2) helps e.g. to move a vehicle from one position (input) to a given other one (Setpoint). The plots I have seen show an increase in e.g. speed/position/etc. (output) from zero to top speed. So the vehicle reaches the Setpoint with top speed and than it stops abruptly? The algorithm "knows" how far the setpoint is away and could reduce the speed. Am I right so far?
So my question is, how could I deal with this if I want the vehicle to stop smooth?
PID is much more general than your description. The basic idea is to set an output so that some goal is achieved, which could be an end position, final temperature or rate of fluid flow.
For getting a vehicle to a given final position and stop, you need some way to know the position at all times, as well as some way to control its speed.
The standard PID algorithm (as in the Arduino library) does not take into account vehicle mass and deceleration, so that the vehicle comes to a dead stop at precisely the correct point. It merely reduces the power input as the distance to target becomes smaller.
Additional work is needed to add a braking feature.
Thank you jremington. You are absolutely right, PID is much more general. Thank you anyways. Your answer helped me to think about another approach. For my purpose a simple linear algorithm is sufficient.