We do not want to rely on a potentially badly initialized heading as it
could lead to a flyaway directly after takeoff
Also remove the resetMagHeading() call from the GPS fusion control logic
as this is properly handled in mag_control.
A value of 1m/s was too conservative and the EKF takes too much time to
trigger a yaw reset. The value can be safely reduced because the
threshold is computed using the accuracy of the measurement and estimate
before being limited by this value.
In the normal and lowlight mode for the PAW3902/3 sensor, the ODR is 66Hz, while in super lowlight mode it is 50Hz.
The IMU ODR vs flow ODR mismatch threshold was too conservative for the 66Hz ODR, since https://github.com/PX4/PX4-ECL/pull/928. The EKF would keep waiting for the data to line up and never fuse measurements.
Fine tilt alignment is accomplished by fusing fake position data after
a coarse tilt leveling. The observation noise can be reduced if the
vehicle is at rest to speed up the process.
While a yaw test ration > 1 rejects the mag data in air, the fusion is
forced with a limited innovation on ground to fix gyro bias and local
magnetic effects problems pre-takeoff. However, the same logic is
applied after landing and immediately after the land detector detects
landing. In some cases, this can disturb the other EKF states which can
lead to a state change of the land detector.
To avoid such a loop, the start of this forced yaw fusion is delayed by
5 seconds after landing.
These changes fix a bug that allowed IMU gyro errors that cause large tilt errors prior to start of aiding not resulting in large innovation test ratios.
The failsafe from rng height to baro height should occur after a reset
to baro triggered by the controlHeightSensorTimeouts function and not in
the fusion selector.
Until now, the EKF was fusing baro measurements between rng updates if
the range finder ODR was slower than the EKF update rate. This is not
the case anymore as the height reset occurs after 5 seconds.
The unit test has been extended to show this behavior.
- extract motion checks performed on ground
- move all non-timing check to controlOpticalFlowFusion. This simplifies and standardirzes the setOpticalFlowData function. Furthermore, in some cases (SITL, PX4Flow), the dt is forced to 0 when the quality is 0 (which is usual on ground) so the ekf needs to ignore those values on ground to initialize properly the flow fusion.
- add filter convergence test
- move check for dt time max in setOpticalFlowData
- in the simulator, do not update dt as this is the sensor integration
period.