PX4/Firmware — pull request #1074 by t0ni0 (2014-06-24 18:59:11+00:00)
Title: INAV: Reset XY velocities when we can't estimate them

This PR aims to address an issue where when using PX4FLOW as only means of positioning, velocity estimates don't get updated when the FLOW.Q factor goes under the valid threshold. Two unexpected behaviours can be observed:

- The velocity estimates get stuck at latest values when landing in mid to low light conditions. When taking off again and switching to POSCTL soon after, even though the FLOW.Q is valid, estimates might not have had enough time to be corrected to represent actual speed. This causes an over compensation by the copter to correct the velocity it believes it has when it actually might be almost still.

- The PX4FLOW loses track and FLOW.Q goes down when flying too fast in POSCTL. The copter can no longer estimate or correct the XY velocity as expected, but when manually compensating to regain stability, FLOW.Q goes back up then POSCTL "locks" back in and we have a problem because we still have the high velocity estimates from right before the FLOW.Q went down. The copter over compensates again.

The suggested solution is to reset XY velocity when landed so we dont carry estimates from one flight to another and to gradually reset the XY velocity estimates when in flight as to not assume we are immediately still as soon as we lose the velocity lock. This may slow the response when we regain POSCTL, but we usually are going slower when locking back in. It is mostly to prevent violent corrections which often result in crashes in my experience.