370 Commits

Author SHA1 Message Date
bresch
b00d4a9237 mag fusion: improve on ground forced mag fusion logic
While a yaw test ration > 1 rejects the mag data in air, the fusion is
forced with a limited innovation on ground to fix gyro bias and local
magnetic effects problems pre-takeoff. However, the same logic is
applied after landing and immediately after the land detector detects
landing. In some cases, this can disturb the other EKF states which can
lead to a state change of the land detector.
To avoid such a loop, the start of this forced yaw fusion is delayed by
5 seconds after landing.
2021-02-18 10:11:51 +01:00
isidroas
0c5291d194
Heading reset to magnetometer from GPS or EV (#969) 2021-02-16 14:37:34 +01:00
Mathieu Bresciani
d4258cc66d
yaw emergency: check angle between vel observation and estimate (#975)
use thresholds based on state and obs variance

* [AUTO COMMIT] update change indication
2021-02-15 10:31:16 +01:00
Paul Riseborough
6f664abc4a EKF: Non functional changes arising from review 2021-02-09 19:55:32 +11:00
Paul Riseborough
b87778e61d EKF: Make clip detection logic easier to follow 2021-02-09 19:55:32 +11:00
Paul Riseborough
9aa8d93efc EKF: Use isRecent function 2021-02-09 19:55:32 +11:00
Paul Riseborough
e948b3505f EKF: Don't reject vertical aiding data if inertial solution is bad
Also reduce clipping count threshold
2021-02-09 19:55:32 +11:00
Paul Riseborough
c566318db5 EKF: misc improvements to handling of accel clipping 2021-02-09 19:55:32 +11:00
Paul Riseborough
9c89fa3b29 EKF: Use IMU clipping to adjudicate bad accel data check 2021-02-09 19:55:32 +11:00
Paul Riseborough
efb78deef9 EKF: Set position fusion gate option false by default 2021-01-21 20:55:42 +11:00
Paul Riseborough
556a195320 EKF: Improve handling of non position mode large position innovations
These changes fix a bug that allowed IMU gyro errors that cause large tilt errors prior to start of aiding not resulting in large innovation test ratios.
2021-01-21 20:55:42 +11:00
bresch
c212975abe rng height: reset to baro using common logic
The failsafe from rng height to baro height should occur after a reset
to baro triggered by the controlHeightSensorTimeouts function and not in
the fusion selector.

Until now, the EKF was fusing baro measurements between rng updates if
the range finder ODR was slower than the EKF update rate. This is not
the case anymore as the height reset occurs after 5 seconds.

The unit test has been extended to show this behavior.
2021-01-07 10:07:57 +01:00
Paul Riseborough
31fca9c31d EKF: Update GPS loss message 2021-01-05 21:08:28 +11:00
Daniel Agar
a8e0e82858 EKF: update mag LPF immediately 2020-12-17 10:46:04 +01:00
Mathieu Bresciani
5ccb8b457d
fakePosFusion: reset _last_known_posNE to current state when starting (#943)
* [AUTO COMMIT] update change indication
2020-12-15 10:09:01 +01:00
bresch
b0cf45e2d2 gps_alt: rename getGpsAltVar -> getGpsHeightVariance 2020-12-13 14:39:50 +11:00
bresch
02369cd415 gps_alt: extract measurement variance computation and saturation 2020-12-13 14:39:50 +11:00
Mathieu Bresciani
8f3df7a97b
flow: restructure optical flow control logic (#928)
- extract motion checks performed on ground
- move all non-timing check to controlOpticalFlowFusion. This simplifies and standardirzes the setOpticalFlowData function. Furthermore, in some cases (SITL, PX4Flow), the dt is forced to 0 when the quality is 0 (which is usual on ground) so the ekf needs to ignore those values on ground to initialize properly the flow fusion.
- add filter convergence test
- move check for dt time max in setOpticalFlowData
- in the simulator, do not update dt as this is the sensor integration
period.
2020-12-09 11:33:00 +01:00
Daniel Agar
688a054bdb EKF: controlDragFusion() add parenthesis for readability 2020-12-08 18:03:04 -05:00
Paul Riseborough
ee94980a8f EKF: Clean up wind state activation logic
Ensure wind states are deactivated in one place and always when in a non-position mode.
Activate wind states separately for each observation method.
2020-12-08 18:03:04 -05:00
Claudio Micheli
c4d162f9a0
EKF: range_finder parameterize range sensor quality hysteresis time
Signed-off-by: Claudio Micheli <claudio@auterion.com>
Co-authored-by: bresch <brescianimathieu@gmail.com>
2020-11-04 12:35:39 -05:00
Daniel Agar
a21092804a EKF: remove virtual getters from estimator_interface 2020-11-02 09:35:47 -05:00
Daniel Agar
6e99ebd928 EKF: add fault status bit for bad vertical accel data 2020-10-26 17:37:15 +01:00
Paul Riseborough
e82d0af6d2 EKF: Improve code clarity - non functional change 2020-10-06 20:50:52 +11:00
Paul Riseborough
7c81350c7a EKF: Don't yaw reset if not yaw induced nav failure 2020-10-06 20:50:52 +11:00
Daniel Agar
4c2355a638 EKF: use GPS to lookup declination from WMM before full GPS checks pass 2020-09-28 08:43:32 +02:00
kamilritz
310b989c9a refactor start of gps into separate function 2020-08-07 10:02:47 +02:00
kamilritz
960b80ee71 Do not update output filter a second time after reset to flow. 2020-08-03 09:51:59 +02:00
kritz
88c52aba5e
Refactor ev fusion start into helper functions (#872) 2020-07-27 11:42:52 +02:00
kamilritz
3651ed37fb Do not update time_last_imu outside of setGpsData 2020-07-17 11:06:36 +02:00
kamilritz
b5e1397c0f Add const modifier
const modifier


Add missing const modifier
2020-07-16 18:25:06 +02:00
kamilritz
b5765eb3b4 Move variable declaration to better place &
remove airspeed_innov_var_temp variable. setting to global variable even when fusion is aborted is okay
2020-07-16 18:25:06 +02:00
kamilritz
3d82d822ae Add const modifier 2020-07-16 18:25:06 +02:00
kamilritz
93011ed52c Use ternary operator 2020-07-16 18:25:06 +02:00
bresch
97e54df123 Gps control: add missing consts and reduce variable scope 2020-07-02 13:35:13 +02:00
bresch
b0f79caf34 GPS yaw: Extract and refactor GPS yaw control logic
- Rename GPS yaw fusion functions:
resetGpsAntYaw -> resetYawToGps
fuseGpsAntYaw -> fuseGpsYaw

- Move last fusion time in reset function
2020-07-02 13:35:13 +02:00
bresch
4b746a3fca GPS Yaw: add consts and remove fusion starting message
The fusion status is captured in the status flags; the message is
superfluous, uses flash space and can impact real-time performance
2020-06-23 08:43:48 +02:00
bresch
2bafe9df08 GPS Yaw: wait to fuse at yaw at least once before declaring it faulty
This fixes the cases where the yaw message from the GNSS receiver would
take more time than the vel/pos. The estimator should wait and not
immediately fall back to an other aiding source after 5sec.
If it never comes, it will never fall back, but this is ok since the
user wants to fly with GPS aiding an not with something else.
2020-06-23 08:43:48 +02:00
bresch
51cd63d626 GPS Yaw: fall back to other yaw aiding source in case of bad data
If the user selects GPS yaw fusion but that there is no GPS yaw data in
the GPS message or if the fusion is rejected for some time, the GPS yaw
data is declared faulty and the fusion is stopped to allow an other
source of yaw aiding to start.
2020-06-23 08:43:48 +02:00
bresch
fe2a9d3018 GPS Yaw: move isfinite checks in control.cpp 2020-06-23 08:43:48 +02:00
bresch
3c6790f5d5 GPS Yaw: Always reset Yaw when GPS Yaw fusion is starting
Also avoid fusing fake mag data when an other source of yaw aiding
is active, even if in MAG_TYPE_NONE mode.
2020-06-23 08:43:48 +02:00
Kamil Ritz
74780aa512 Refactor gps fusion commencing 2020-06-12 15:11:16 +02:00
Paul Riseborough
c91c78dcf6 EKF: Allow reset of yaw to EKF-GSF later in flight 2020-05-22 13:05:10 +03:00
kritz
716caa5168
Refactor position resets (#822) 2020-05-19 21:53:46 +02:00
Paul Riseborough
19bbea75c0
Fix GPS altitude not fused if GPS checks fail and GPS is primary height source (#813)
* EKF: Fix failure to select a height sensor

* EKF: Remove unnecessary check and improve documentation
2020-05-14 19:26:16 +10:00
kritz
24f2e60b7e
Reduce stored strings, to save flash space (#815) 2020-05-13 08:09:26 +02:00
kritz
98801ad17b
Support vision velocity expressed in body frame too (#708)
* Support vision velocity expressed in body frame

* Use switch statement for vision velocity frame

* Robustify vision velocity frame test

* Increase lower bound on vision velocity noise to 0.05 m/s
2020-05-12 16:03:35 +02:00
kritz
c3de452e8e
Remove duplicate code during vision yaw reset (#810) 2020-05-12 08:44:39 +02:00
kritz
03191847f9
Fix ev_pos_obs_var(1) entry (#809) 2020-05-11 10:44:05 +02:00
Kamil Ritz
440383f039 Increase matrix library usage and remove white line 2020-05-11 09:09:52 +02:00