388 Commits

Author SHA1 Message Date
bresch
a4fe2b1e72 yaw_align: let the mag control logic do the alignement and resets 2021-05-12 08:33:07 +10:00
bresch
6248646bff EV yaw: move EV yaw reset out of resetMagHeading function
Also remove the unnecessary 2nd "manual reset" done in the start function
2021-05-12 08:33:07 +10:00
bresch
48722a2a92 control: inhibit EV yaw from restarting when GPS aid wants to start 2021-05-12 08:33:07 +10:00
bresch
a685987082 GNSS yaw: unset yaw_align if fusion stops before takeoff
We do not want to rely on a potentially badly initialized heading as it
could lead to a flyaway directly after takeoff

Also remove the resetMagHeading() call from the GPS fusion control logic
as this is properly handled in mag_control.
2021-05-12 08:33:07 +10:00
bresch
51197a5d82 GNSS yaw selection logic refactor 2021-05-12 08:33:07 +10:00
bresch
29243ac5cb yaw_reset: reduce minimum vector length to compute yaw error
A value of 1m/s was too conservative and the EKF takes too much time to
trigger a yaw reset. The value can be safely reduced because the
threshold is computed using the accuracy of the measurement and estimate
before being limited by this value.
2021-05-06 19:13:54 +10:00
Kabir Mohammed
aad48407c2 EKF: increase allowed difference between flow and gyro ODRs
In the normal and lowlight mode for the PAW3902/3 sensor, the ODR is 66Hz, while in super lowlight mode it is 50Hz.

The IMU ODR vs flow ODR mismatch threshold was too conservative for the 66Hz ODR, since https://github.com/PX4/PX4-ECL/pull/928. The EKF would keep waiting for the data to line up and never fuse measurements.
2021-05-03 11:08:16 +02:00
Eike
a7b8afe420
Allow rangefinder fusion in vision height mode (Fix for #994) (#999)
Co-authored-by: Daniel Agar <daniel@agar.ca>
2021-04-30 14:17:39 -04:00
Eike
5d34d7a24e
Height source vision: Fallback to rangefinder if available (#994) 2021-03-31 14:24:38 +02:00
bresch
6f2dec726a gps sacc: apply same minimum for EKF2 and yaw estimator 2021-03-25 09:54:30 +01:00
Daniel Agar
0f47cae1e1 remove ECL_{INFO,WARN,ERN}_TIMESTAMPED macros
- we already have mechanisms to print these messages timestamped
2021-03-05 19:06:59 -05:00
Paul Riseborough
9d51ab079a EKF: Remove duplicated event recording 2021-03-05 19:06:59 -05:00
Paul Riseborough
140ca3f48f EKF: Add external monitoring of warning and information events 2021-03-05 19:06:59 -05:00
Paul Riseborough
90a445ddbc EKF: upgrade some events from into to warning status 2021-03-05 19:06:59 -05:00
bresch
5d441d65e1 Accelerate tilt fine alignment by reducing obs noise when at rest
Fine tilt alignment is accomplished by fusing fake position data after
a coarse tilt leveling. The observation noise can be reduced if the
vehicle is at rest to speed up the process.
2021-03-04 19:43:01 +11:00
Daniel Agar
098d5ce5c0
EKF allow range aid without horizontal aiding
- skip range aid velocity check when horizontal aiding isn't active
2021-02-22 11:55:56 -05:00
Daniel Agar
63f64b57c1 EKF: set global origin method
EKF: add convergence after global origin reset test
2021-02-19 08:59:47 -05:00
bresch
04844a04ed ekf control: move time_last_in_air/on_ground out of GPS control logic 2021-02-18 10:11:51 +01:00
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