This allows airspeed and sideslip fusion to start during VTOL front
transition, but not in backtransition or MC. This mitigates issues seen
due to going in and out of airspeed fusion in strong headwinds in MC.
Co-authored-by: bresch <brescianimathieu@gmail.com>
This is similar to fake pos but is only used when the ekf has an
external information telling it that the vehicle is not changing
position. This information can then be used to keep a valid local
position even when the vehicle isn't exactly at rest.
Terrain is the state: terrain vertical position
Hagl (height above ground level) is the vertical distance between the
vertical position and the terrain vertical position
- fake_pos only if at rest or tilt variances becomes large
- fake pos: don't run when grav fusion is enabled
- gravity fusion enabled by default
- gravity: only fuse when accel norm and lpf norm are consistent
Co-authored-by: bresch <brescianimathieu@gmail.com>
- split mag_3d into new standalone mag fusion and mag fusion allowed to update all states (full mag_3d)
- new dedicated control logic for mag/mag_3d fusion and standalone mag heading fusion
- if WMM available use for mag_I and mag_B init
- mag states reset if external yaw reset (yaw estimator, GPS yaw, etc)
- mag reset if declination changed (eliminate _mag_yaw_reset_req)
- mag fusion (but not mag_hdg or mag_3d) can be active during gps_yaw or ev_yaw (if yaw aligned north)
Co-authored-by: bresch <brescianimathieu@gmail.com>
When at rest, directly fuse the gyro data as an observation of its bias.
This allows to strongly observe the gyro biases without having to fuse a
constant heading that makes the ekf too confident about its heading.
- refactor all EKF backend output predictor pieces into new OutputPredictor class
- output states are now calculated immediately with new high rate IMU rather than after EKF update
- IMU delayed sample is passed as around as control data to avoid storing an extra copy and make the requirement clear
- move EV yaw and EV position to new state machines
- EV yaw and EV pos now configured via EKF2_EV_CTRL (migrated from EKF2_AID_MASK)
- new EV position offset estimator to enable EV position while GPS position is active (no more EV pos delta fusion)
- yaw_align now strictly means north (no more rotate external vision aid mask)
- automatic switching between EV yaw, and yaw align north based on GPS quality
- respect new EKF2_EV_CTRL parameter for VPOS usage
- EV hgt rotate EV position before usage (there's often a small offset in frames)
- EV hgt reset use proper EV velocity body frame
- try to keep EV hgt and EV vel state machines consistent
- small incremental piece of https://github.com/PX4/PX4-Autopilot/pull/19128
- don't store unnecessary IMU copy in class, pass it through where required
- remove custom pi constants
- remove unused fields from ahrs_ekf_gsf (vel_NE, fuse_gps, accel_dt)
- explicitly initialize everything in header
- apply PX4 code style
- set GPS velocity before yaw estimator update, not after
- in a lot of cases this won't really matter, although you can see it in logs (especially with things like vehicle_at_rest), but it's something we might as well do properly
Co-authored-by: Mathieu Bresciani <brescianimathieu@gmail.com>
During the whole flight, if the difference between the yaw estimate from
EKF2 and the emergency estimator is large and that the GNSS velocity
fusion is failing continuously, immediately reset to the emergency yaw
estimate.