I donâ€™t know about where the velocity setpoint comes from, but I can tell you why it improves the performance.

Imagine that you want to track a position setpoint such as a linear ramp.

A linear ramp is just a linearly increasing position setpoint which can then be tracked with a constant velocity:

Linear ramp expression (on the position along the x axis for example)

p_x,d = v_x,d * t + p_x0,d

The first term is the desired position you want to track, the second the desired constant velocity that achieve such position, the third I just time and lastly the fourth is an arbitrary offset.

Now, the position controller applies a simple P control, and itâ€™s outputs is the drone velocity.

So, the drone velocity is

v_x = P*(p_x,d - p_x)

With the first term the commanded drone velocity, the second the P Gain and the last two the desired position and the actual position, respectively.

If you see the formula of the ramp, the drone needs a constant NON ZERO velocity. Therefore, looking at the second formula, the only way to have a non zero v_x is tho have a discrepancy between the desired position and the actual one!

Conclusion? As it is, the velocity is kept constant at the cost of a non perfect tracking of the position. Because the drone moves only if there is a position error (this is a property of the P controller)

Solution? If you know the desired velocity v_x,d, then just add it to the P controller. Feed forward it!

v_x = P*(p_x,d - p_x) + v_x,d

The desired velocity is now imposed by the feed forward while the P control zeros the position error.