Daniel Agar
0f9bc351f1
ekf2: fix global_pos alt_reset_counter publish ( #20906 )
...
- fixes #20900
2023-01-11 14:15:07 -05:00
bresch
49f8bcfc69
ekf2: purge old ekf2 derivation
2023-01-06 18:35:19 -05:00
bresch
26122886ae
ekf2: drag fusion - improve parameter description
...
The user should refer to the online documentation for tuning guidelines
and not the parameter description.
2023-01-05 12:03:24 -05:00
bresch
06ef39d05e
ekf2: MC drag fusion - interpolate between X an Y "b" coefficients
...
Use the current sideslip angle to generate a drag coefficient that is a
mixture of X and Y coefficients, creating an elliptic distribution.
2023-01-05 12:03:24 -05:00
bresch
420f5ef2b7
ekf2: migrate drag fusion derivation to SymForce
2023-01-05 12:03:24 -05:00
bresch
04f76c932e
ekf2: decompose drag vector into x-y components
...
The drag force is a vector.
drag_x = drag.norm() * vx / v.norm()
2023-01-05 12:03:24 -05:00
Paul Riseborough
1a9c358858
ekf2: Add unit tests for drag fusion
2023-01-05 12:03:24 -05:00
bresch
0509f612dd
ekf2: fix drag data downsampling
...
setDragData needs the imu data at full speed to downsample it without
skipping samples.
2023-01-05 12:03:24 -05:00
bresch
28d664aed5
EKF2: purge outdated matlab scripts
...
Those files are no longer maintained and will just confuse new users
2022-12-30 13:01:58 -05:00
dagar
618ce9a865
[AUTO COMMIT] update change indication
2022-12-29 16:37:34 -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
bresch
3e4e5c991c
ekf2: add mag unit tests
2022-12-29 12:56:36 -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
bresch
c75a9058a5
EKF2: only fuse zero innovation if yaw var is large
2022-12-29 12:56:36 -05:00
bresch
86a3d2459a
ekf2: remove old yaw estimator generated code
2022-12-23 10:28:19 -05:00
bresch
0388c161e7
ekf2: compare yaw estimator sympy vs symforce
2022-12-23 10:28:19 -05:00
bresch
7c33019510
EKF2: move yaw estimator to symforce
2022-12-23 10:28:19 -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
bresch
41abf695a8
ekf2: use more efficient covariance update computation
...
KSK' is faster to compute than KHP and is mathematically equivalent
2022-12-12 12:31:54 -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
Daniel Agar
f3884d5835
Update world_magnetic_model to latest Fri Dec 9 11:14:09 UTC 2022
...
Co-authored-by: PX4 BuildBot <bot@px4.io >
2022-12-09 11:40:30 -05:00
Daniel Agar
8eb2a0a3ec
ekf2: delete orientation_covariances_euler()
...
- usage replaced with now public calcRotVecVariances()
2022-12-07 12:41:27 -05:00
Mathieu Bresciani
a187bb3b80
ekf2: predict covariance before predicting state ( #20715 )
...
* To predict the covariance, the jacobian from the previous to the current state is required.
2022-12-07 09:34:19 -05:00
bresch
5155346d60
ekf2: do not use gnss data when no lock
2022-11-30 08:50:34 -05:00
bresch
5d7faefa84
ekf2: don't add invalid GNSS samples to the buffer
2022-11-30 00:22:15 -05:00
bresch
60c448ce3a
ekf2: GNSS yaw, use reported yaw accuracy when available
2022-11-22 09:59:31 -05:00
bresch
b25bc1b982
ekf2: GNSS yaw, update->fuse pattern
2022-11-22 09:59:31 -05:00
bresch
4cb327fba3
ekf2: remove old GPS yaw autogenerated code
2022-11-22 09:59:31 -05:00
bresch
16a3fee54f
ekf2_test: check behavior of GNSS yaw fusion at singularities
2022-11-22 09:59:31 -05:00
bresch
4116de31ad
ekf2: compare GNSS yaw fusion sympy vs symforce
2022-11-22 09:59:31 -05:00
bresch
eff2c6adcf
ekf2: migrate GNSS yaw fusion to SymForce
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
bresch
22420a7bf1
ekf2: do not fuse ZVU if other velocity source is active
2022-11-15 11:17:07 -05:00
bresch
c67f03f383
ekf2: update change indicator
2022-11-14 11:51:32 -05:00
bresch
f319cc528b
ekf2: remove old flow fusion generated code
2022-11-14 11:51:32 -05:00
bresch
2a83dbf81d
ekf2_test: compare flow fusion sympy vs symforce
2022-11-14 11:51:32 -05:00
bresch
93564baccf
ekf2_flow: recalculate innovation after fusing 1st axis
...
The state changed so we need to recalculate the innovation of the 2nd
axis after fusing the 1st one
2022-11-14 11:51:32 -05:00
bresch
4dbdf23346
ekf2: update _R_to_earth when the state quat changed through fusion
2022-11-14 11:51:32 -05:00
bresch
28458340e6
ekf2_flow: check innov variance health after fusing 1st axis
2022-11-14 11:51:32 -05:00
bresch
73a8c388e8
ekf2: fuse by looping through axes
2022-11-14 11:51:32 -05:00
bresch
b54a4417fa
ekf2: migrate flow fusion to SymForce
2022-11-14 11:51:32 -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
7d1f1d0f84
ekf2: replace macro constants by typed constexpr
2022-11-14 10:45:23 -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
bd5bc9d207
ekf2: cleanup terrain estimator init (shouldn't be valid by default)
...
- with Ekf::initialiseFilter() resetting _time_last_hagl_fuse the terrain estimate was technically valid regardless of any range or flow data availability and as a result optical flow fusion is able to start and stay active
- only consider terrain estimate valid based on control status flags and recent fusion
2022-11-14 09:29:46 -05:00
Daniel Agar
84d1435880
ekf2: ensure minimum output buffer sizing
...
- buffer at least 2 samples for the IMU output predictor buffers
- dropping below 2 becomes problematic for the minimum observation
interval calculation and the vertical output buffer trapezoidal
integration
2022-11-09 09:49:35 -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