133 Commits

Author SHA1 Message Date
Marco Hauswirth
f4c820c7e1 feat(ekf2): add ranging beacon fusion support
- Add Symforce-derivation
- No altitude correction
- EKF2 replay
- New params
2026-04-01 15:01:31 +02:00
bresch
074e787a91 feat(ekf2): remove zero innovation heading update
This is no longer necessary with the heading observability check
2026-03-13 17:46:31 +01:00
bresch
643c6fec24 feat(ekf2): clear heading correlation with other states when not observable 2026-03-13 17:46:31 +01:00
Balduin
e5071beaa3 fix(ekf2): fuse airspeed in both transition if above EKF2_ARSP_THR 2026-03-11 10:08:32 +01:00
Marco Hauswirth
8a9be9a8f0 ekf2: update logger, mavlink, DDS, and replay for AuxGlobalPosition
Update integrations to use the new AuxGlobalPosition message instead
of the VehicleGlobalPosition-based aux_global_position topic.
2026-02-20 17:43:45 +01:00
Balduin
6caf4f0942
ekf2: fuse airspeed & beta only in fronttransition and fixed wing (#25980)
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>
2025-11-26 16:29:19 +01:00
Jacob Dahl
6a8eea1df9
ekf: update parameter names for consistency (#25137) 2025-07-08 12:11:28 -06:00
Daniel Agar
34ee097f02 ekf2: tighten terrain validity requirements
- require valid fusion from a range finder or optical flow before
   considering terrain valid again
2024-10-04 10:31:20 +02:00
bresch
1a0f97ebbd ekf2-fake pos: add valid fake position fusion
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.
2024-08-23 11:17:21 +02:00
Daniel Agar
ac77049c47 ekf2: directly use IMU sample to find corresponding aid source sample
- I think this helps make it clear we're using a sensor sample
   corresponding with a particular IMU sample
2024-07-10 21:20:47 -04:00
Daniel Agar
f93dc61770 ekf2: use bias corrected angular velocity
- avoid unnecessarily storing _ang_rate_delayed_raw
2024-07-10 21:20:47 -04:00
bresch
9001c23926 ekf2: clean up hagl vs terrain naming
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
2024-06-26 11:05:38 +02:00
Daniel Agar
ed0d26de8a ekf2: improve attitude estimation without horizontal aiding
- 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>
2024-01-17 10:27:25 -05:00
bresch
fe7988672f ekf2: auxiliary position fusion
Co-authored-by: Daniel Agar <daniel@agar.ca>
2023-12-01 11:50:22 +01:00
Mathieu Bresciani
0d6c2c8ce9
EKF2: Error-State Kalman Filter (#22262)
* ekf derivation: change to error state formulation
* ekf2: update auto-generated code for error-state
* ekf2: adjust ekf2 code for error state formulation
* ekf2_tests: adjust unit tests for error-state EKF
* update change indicator for error-state EKF
* ekf2_derivation: allow disabling mag and wind states

---------

Co-authored-by: bresch <[brescianimathieu@gmail.com](mailto:brescianimathieu@gmail.com)>
2023-10-31 10:02:18 -04:00
Daniel Agar
27f9b1b65a ekf2: move zero gyro update to aid source class 2023-10-18 20:23:56 -04:00
Daniel Agar
e79737a38d ekf2: create simple estimator aid source base class and extract zero velocity update 2023-10-18 20:23:56 -04:00
Daniel Agar
3d238b0275
ekf2: add kconfig to disable gravity fusion (#22231) 2023-10-18 10:50:51 -04:00
Daniel Agar
d2b3e7fe16
ekf2: new kconfig to enable/disable GNSS (enabled by default) 2023-10-11 14:02:34 -04:00
Daniel Agar
5f87f3a046 ekf2: drag fusion add aid source status topic 2023-10-09 09:26:28 -04:00
Daniel Agar
153f7bbced ekf2: update all copyright headers 2023-09-15 10:02:09 -04:00
Daniel Agar
845b01a00d ekf2: add kconfig for magnetometer support (enabled by default) 2023-09-15 10:02:09 -04:00
Daniel Agar
d75bb62a65
ekf2: separate mag and mag heading control logic (#21212)
- 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>
2023-08-04 10:39:16 -04:00
Mathieu Bresciani
24de623989
EKF2: Zero gyro update (#21691)
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.
2023-06-09 21:13:18 -04:00
Daniel Agar
0784901a66 ekf2: add kconfig option to enable/disable optical flow fusion 2023-03-21 11:25:34 -04:00
Daniel Agar
4363b09421 ekf2: add kconfig option to enable/disable external vision fusion 2023-03-20 10:12:17 -04:00
Daniel Agar
d47f96f1a5 ekf2: add kconfig option to enable/disable AUX velocity fusion 2023-03-20 10:12:17 -04:00
Daniel Agar
4270a303ab ekf2: add kconfig option to enable/disable airspeed and sideslip fusion 2023-03-20 10:12:17 -04:00
Daniel Agar
fe0e3acf09 ekf2: add kconfig option to enable/disable drag fusion 2023-03-20 10:12:17 -04:00
Daniel Agar
9ec3f30ae1 ekf2: move gps buffer pop to controlGpsFusion()
- controlGpsFusion() now owns yaw estimator update
2023-02-22 09:08:33 -05:00
Daniel Agar
60856ebe62 ekf2: move range buffer pop to controlRangeHeightFusion() 2023-02-22 09:08:33 -05:00
Daniel Agar
241cee2bb7 ekf2: move airspeed buffer pop to controlAirDataFusion 2023-02-22 09:08:33 -05:00
Daniel Agar
0711a34d0e ekf2: move flow buffer pop to controlOpticalFlowFusion 2023-02-22 09:08:33 -05:00
Daniel Agar
ed8cef6cf0 ekf2: move controlAuxVelFusion control.cpp -> auxvel_fusion.cpp 2023-02-22 09:08:33 -05:00
Daniel Agar
b4e845d7c0 ekf2: move controlDragFusion control.cpp -> drag_fusion.cpp 2023-02-22 09:08:33 -05:00
Daniel Agar
c08a387c5a ekf2: move controlBetaFusion control.cpp -> sideslip_fusion.cpp 2023-02-22 09:08:33 -05:00
Daniel Agar
d61b8c21b2 ekf2: move controlAirDataFusion() control.cpp -> airspeed_fusion.cpp 2023-02-22 09:08:33 -05:00
Daniel Agar
d840f7f39f ekf2: move controlGpsYawFusion() control.cpp -> gps_control.cpp 2023-02-22 09:08:33 -05:00
Daniel Sahu
fa6fda6cce
ekf2: new gravity observation (#21038)
Signed-off-by: Daniel M. Sahu <danielmohansahu@gmail.com>
2023-02-07 13:28:58 -05:00
Daniel Agar
95300d5637
ekf2: refactor output predictor to class
- 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
2023-01-18 10:59:34 -05:00
bresch
657bd6cf72 ekf2: stop mag fusion when inhibited for too long
Also do not try to run anything if mag is inhibited
2022-12-29 12:56:36 -05:00
Daniel Agar
54a32eb2f7
ekf2: EV overhaul yaw and position fusion (#20501)
- 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
2022-12-20 10:23:56 -05:00
Daniel Agar
696eeb9a49
ekf2: update EV height state machine (small piece of EV overhaul)
- 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
2022-12-13 13:29:18 -05:00
Daniel Agar
8cf13d50a8
ekf2: EKFGSF_yaw minor cleanup (#20510)
- 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
2022-12-09 13:24:00 -05:00
bresch
b25bc1b982 ekf2: GNSS yaw, update->fuse pattern 2022-11-22 09:59:31 -05:00
Daniel Agar
da82757bf6
ekf2: accumulate multiple vel/pos/orientation reset deltas per update
- if in a single EKF update there are multiple resets we need to track the accumulated delta so the change consumed by the controllers is correct
2022-11-15 13:20:54 -05:00
Daniel Agar
639d1ddca2
ekf2: update flags (in_air, at_rest, etc) on delayed time horizon (#20576)
- 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>
2022-11-14 11:35:40 -05:00
bresch
06702da003 ekf2: add GNSS yaw max interval
yaw data usually comes at lower rate than vel/pos
2022-11-14 10:45:23 -05:00
bresch
9834c7917b ekf2: use yaw emergency estimator more aggressively
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.
2022-11-14 10:45:23 -05:00
Daniel Agar
5239993c88 ekf2: move EV vel to new state machine, introduce EKF2_EV_CTRL param 2022-11-08 11:46:41 -05:00