205 Commits

Author SHA1 Message Date
Daniel Agar
8222cbca2c ekf2: last range sensor simple timestamp protection
- sanity check againist potential timestamp issues with incoming
distance_sensor data
2023-05-09 12:02:42 -04:00
bresch
521abecbbf ekf2: remove all remaining uses of EKF2_AID_MASK 2023-04-28 22:31:17 -04:00
bresch
2a2e43b620 ekf2: move flow fusion activation from AID_MASK to OF_CTRL 2023-04-28 22:31:17 -04:00
bresch
39c2f95669 ekf2: move drag fusion activation from AID_MASK to DRAG_CTRL 2023-04-28 22:31:17 -04:00
Silvan Fuhrer
d532578ecc EKF2: only check for EKF2_BETA_FUSION when corresponding kconfig option is set
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2023-03-22 10:05:32 +01:00
Silvan Fuhrer
98d07ad1f3 disable side slip fusion for tailsitters
The attitude frame is wrong for tailsitters doing side slip fusion for wind estimation.
It doesn't take into account that the frames is 90deg tilted in FW flight.

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2023-03-22 10:05:32 +01:00
Daniel Agar
32a5bd32ad ekf2: add kconfig option to enable/disable range finder fusion (and terrain estimator) 2023-03-21 11:25:34 -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
98ff1afc19 ekf2: add kconfig option to enable/disable GNSS yaw 2023-03-20 10:12:17 -04:00
Daniel Agar
8b2205810b ekf2: add kconfig option to enable/disable baro compensation 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
f0a95f9572 ekf2: add new kconfig option for multi-EKF
- disabled if flash constrained or memory constrained
2023-03-15 09:32:47 -04:00
Beniamino Pozzan
b79578fa55 efk2: Force external vision vertical position if EKF2_HGT_REF=VISION
Signed-off-by: Beniamino Pozzan <beniamino.pozzan@phd.unipd.it>
2023-03-06 09:19:49 -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
264a99fb77
ekf2: new EKF2_IMU_CTRL parameter and gyro bias inhibit mechanism
- EKF2_AID_MASK accel bias inhibit moves to EKF2_IMU_CTRL
2023-02-03 09:52:24 -05:00
bresch
6e30f8f5cb ekf2: use dedicated aid_src message for flow for terrain aiding 2023-01-21 15:31:19 -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
Daniel Agar
674a59e48f
ekf2: new gyro bias limit parameter EKF2_GYR_B_LIM
- default is now a more conservative 0.15 rad/s (~8.6 deg/s) instead of the previous hardcoded 20 deg/s
2023-01-14 09:15:46 -05:00
Daniel Agar
0f9bc351f1
ekf2: fix global_pos alt_reset_counter publish (#20906)
- fixes #20900
2023-01-11 14:15:07 -05:00
Daniel Agar
20a1c73cf0 ekf2: reinit baro height on sensor or calibration change
- handle reset on delayed time horizon
2022-12-29 16:37:34 -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
805ffa9d0b ekf2: push mag cal reset to delayed time horizon 2022-12-13 10:24:02 -05:00
Daniel Agar
8eb2a0a3ec ekf2: delete orientation_covariances_euler()
- usage replaced with now public calcRotVecVariances()
2022-12-07 12:41:27 -05:00
bresch
60c448ce3a ekf2: GNSS yaw, use reported yaw accuracy when available 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
Daniel Agar
5239993c88 ekf2: move EV vel to new state machine, introduce EKF2_EV_CTRL param 2022-11-08 11:46:41 -05:00
Daniel Agar
688dae1108 ekf2: add new EKF2_EV_QMIN parameter 2022-11-08 11:46:41 -05:00
Daniel Agar
298cc61e07 ekf2: push fuse beta config into backend 2022-11-02 10:09:26 -04:00
Matthias Grob
5ca28dd6dc Use isAllFinite() in all places that check finiteness on entire vectors or matrices 2022-10-19 19:09:20 +02:00
Daniel Agar
535415a537 ekf2: add OF estimator aid src status 2022-10-18 14:19:16 -04:00
Daniel Agar
2de990fd4b estimator_aid_source split GNSS pos (3d) -> pos (2d) + hgt
- per estimator air source status only keep a single set of flags and
timestamp that applies to the entire source
2022-10-13 11:28:50 -04:00
bresch
5f54f6fcda ekf2: migrate sideslip fusion to SymForce
- split fusion into update (compute innov and innov_var) and actual fusion to the state vector
- use estimator_aid_source_1d struct to group the data
2022-10-12 09:55:35 -04:00
bresch
1914053db2 ekf2: synchronize z_valid and v_z_valid
mc_pos_control doesn't handle all the cases at the moment
2022-09-29 14:16:36 -04:00
bresch
bb790c9bec ekf2: add vertical dead-reckoning timeout check for height validity 2022-09-29 14:16:36 -04:00
Daniel Agar
1f7080a710 ekf2: extend sensor bias stability requirement
- for accel/gyro/mag estimated bias only consider them stable (valid
for calibration updates) if the value isn't changing (10% of limit) over
the validity period
2022-09-28 10:40:52 -04:00
bresch
cddade2047 ekf2: use validated airspeed from airspeed sensor only
don't use synthetic measurements to prevent circular dependency
2022-09-23 09:26:47 -04:00
bresch
6bd81c0eb7 ekf2: do not store delayed baro sample in class
the sample is popped from the buffer and directly used; there is no
need to keep a local copy of it
2022-09-10 12:29:29 -04:00
bresch
a54fa7b9b1 ekf2: add fake height fusion logic
When there is no vertical aiding, fake height is started to constrain
the vertical channel of the EKF
2022-09-10 12:29:29 -04:00
bresch
aa716936bf ekf2: move synthetic_position flag to control_status.flags.fake_pos 2022-09-10 12:29:29 -04:00
bresch
090d03eea2 ekf2: publish GNSS, rng and EV height biases 2022-08-24 09:16:11 -04:00
bresch
a2a29ba0dd ekf2: verify parameter configuration for height sources 2022-08-24 09:16:11 -04:00
bresch
aba2eac0df ekf2: publish GNSS, rng and EV height biases 2022-08-24 09:16:11 -04:00
bresch
8962cf2d25 ekf2: GPS, baro and range finder control parameters
Also remove the legacy "range aid" than can be achieved by setting the
height reference to range finder and the range finder control parameter
to "conditional".

Conditional range aiding cal also be set when the height reference isn't
the range finder. This prevents the ratchetting effect due to switching
between references.
2022-08-24 09:16:11 -04:00
bresch
8fd79688c0 ekf2: enable multiple height sources fusion
Instead of having a single height source fused into the EKF and the
other ones "waiting" for a failure or the primary sensor, fuse all
sources in EKF2 at the same time. To prevent the sources from fighting against each
other, the "primary" source is set as reference and the other ones are
running a bias estimator in order to make all the secondary height
sources converge to the primary one.

If the reference isn't available, another one is automatically selected
from a priority list. This secondary reference keeps its current bias
estimate but stops updating it in order to be the new reference as close
as possible to the primary one.
2022-08-24 09:16:11 -04:00
bresch
f89044cfbe ekf2: fix replay EKF2 start when CONSTRAINED_FLASH 2022-08-23 11:14:15 -04:00