Commit Graph

19 Commits

Author SHA1 Message Date
bresch fe4a6ce8de ekf2: allow initialization without baro data when fusion is disabled 2022-09-10 12:29:29 -04:00
Daniel Agar 7bbdc220f5 ekf2: initialiseFilter() simplify mag heading init and resetQuatStateYaw
- most of resetQuatStateYaw doesn't apply to initial heading init, so
removing the special case keeps it simple
2022-09-02 08:46:10 -04:00
Daniel Agar 1948c5057a ekf2: handle all time on delayed horizon (except for newest sample checks)
- a growing number of samples come into the backend with the time
already delayed (sensor's interrupt setting timestamp sample)
 - if the incoming timestamp is already delayed then the new data checks
(relative to latest IMU) can be slightly wrong
 - handle almost all timestamps and checks on delayed time horizon,
except for explicit checks of new samples
 - isRecent() and isTimedOut() helpers use delayed time
 - add new isNewestSampleRecent() used for checking the incoming
timestamp of the incoming (adjusted) data
2022-08-31 08:52:30 -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
Daniel Agar b58f70726f ekf2: scale delta angle and delta velocity bias to particular IMU sample 2022-08-23 21:06:13 -04:00
Daniel Agar a41a0e7e80 ekf2: resetMagHeading() split out simple init case 2022-07-21 09:24:28 -04:00
mcsauder ea10eacb99 Replace EKF/common.h #defines with enums. 2022-05-18 09:25:19 -04:00
Daniel Agar a430f0ccae ekf2: add simple zero velocity update when vehicle at rest (#19149)
- further decreases initial tilt alignment time (now down to 2.5 seconds if still) and improves initial bias estimates
2022-03-12 12:56:31 -05:00
Daniel Agar b7e0f17c6a ekf2: minor position/velocity reset cleanup
- try to use avoid resetVelocity() call where possible
 - reset timeouts centrally
2022-03-08 11:16:35 -05:00
Daniel Agar c10ea97967 ekf2: fusion helpers return success/fail and set pos/vel update timestamps centrally (if healthy) 2022-03-08 11:16:35 -05:00
Daniel Agar 11f617ca9b ekf2: default to in air and not at rest
- this is a more conservative default if a vehicle isn't set (no land detector running)
 - handled horizontal preflight failures in commander when disarmed
rather than overloading xy_valid and v_xy_valid flags
 - ekf2 no longer depend on arming or standby status
2022-02-22 16:59:10 -05:00
bresch 33fd1849e0 ekf2_terr: refactor terrain estimator - rng aiding 2022-02-11 10:57:45 -05:00
Daniel Agar 88ffc177f7 ekf2: utils add getEulerYaw() that uses the best rotation sequence 2022-02-02 08:54:03 -05:00
Daniel Agar f3e2a197ad move vehicle at rest detection ekf2 -> land_detector
- move vehicle at reset detection ekf2 -> land_detector
 - ekf_unit: reduce init period
   - Fake fusion is when at rest is quite strong and makes the variance reduce rapidly. Reduce the amount of time we wait before checking if the variances are still large enough.
 - ekf_unit: reduce minimum vel/pos variance required after init
   - Fake pos fusion has a low observation noise, making the vel/pos variances reduce quickly.

Co-authored-by:: bresch <brescianimathieu@gmail.com>
2022-02-01 17:50:19 -05:00
Daniel Agar 999737ddd5 ekf2: refactor mag control
- remove class _mag_sample_delayed
 - update mag fusion call graph to use mag sample delayed functionally
 - Ekf::resetMagHeading()
   - use low pass mag directly, but check if valid (magnitude)
   - MAG_FUSE_TYPE_INDOOR treat like auto if heading required
2022-01-31 11:47:10 -05:00
Daniel Agar ae3070bbf1 ekf2: make filter update period configurable
- introduces new parameter EKF2_PREDICT_US to configure the filter
update period in microseconds
 - actual filter update period will be an integer multiple of IMU
2022-01-26 10:57:09 -05:00
Daniel Agar 92a5bbe97f ekf2: improve ring buffer sizing and dynamically allocate 2022-01-19 09:04:53 -05:00
mcsauder f34862f143 Delete redundant Ekf class member variable constructor initilizations and add missing C++ style initializers to the header file. 2021-07-17 12:24:56 -04:00
Daniel Agar 2cf66a5d8f ekf2: move EKF out of ecl 2021-07-15 10:38:24 -04:00