Commit Graph

275 Commits

Author SHA1 Message Date
kamilritz dae8c2f8dc Group velocity and position as a 3d vector 2019-12-05 20:09:34 +11:00
kamilritz 5c038a3b43 Add stop*Fusion function 2019-12-05 20:09:34 +11:00
kamilritz 86b9079bdc Refactoring velPos fusion 2019-12-05 20:09:34 +11:00
Mathieu Bresciani c7bdf25663
[ekf] controlMagFusion refactor and mag field strength check (#662)
* ekf_control: Inhibit mag fusion when field magnitude is large
Move mag inhibition check in separate function

* ekf_control: pull out of functionalities out of controlMagFusion
- yaw abd mag bias observability checks
- mag 3D conditions
- load mag covariances
- set and clear mag control modes

* ekf_control: refactor mag heading/3D start/stop.
Move mag declination, mag 3d and mag heading fusion out of the main function

* ekf_control: extract mag yaw reset and mag declination fusion requirements

* ekf_control: use WMM in isStronMagneticField for mag fusion inhibition
- Correct units of WMM strength table

* ekf_control: extract mag_state_only functionality of AUTOFW (VTOL custom)
Also split inAirYawReset from onGroundYawReset

* ekf_control: extract mag automatic selection
- transform if-else into switch-case for parameter fusion type selection

* ekf_control: extract run3DMagAndDeclFusion, reorganize functions, fix
flag naming in Test script

* ekf_control: do not run mag fusion if tilt is not aligned.
Reset some variables on ground even if mag fusion is not running yet. It
could be that it runs later so we need to make sure that those variables
are properly set.

* ekf_control: move controlMagFusion and related functions to mag_control.cpp

* ekf control: check for validity of mag strength from WMM and falls back
to average earth mag field with larger gate if not valid

* ekf control: remove evyaw check for mag inhibition

* ekf control: change nested ternary operator into if-else if

* Ekf: create AlphaFilter template class for simple low-pass filtering
0.1/0.9 type low-pass filters are commonly used to smooth data, this
class is meant to abstract the computation of this filter

* ekf control: reset heading using mag_lpf data to avoid resetting on an outlier
fixes ecl issue #525

* ekf control: replace mag_states_only flag with mag_field_disturbed and
add parameter to enable or disable mag field strength check

* ekf control: remove AUTOFW mag fusion type as not needed This was implemented for VTOL but did not solve the problem and should not be used anymore

* ekf control: use start/stop mag functions everywhere instead of setting the flag

* ekf control: Run mag fusion depending on yaw_align instead of tilt_align
as there is no reason to fuse mag when the ekf isn't aligned

* AlphaFilter: add test for float and Vector3f
2019-11-08 16:02:59 +01:00
RomanBapst 16d1e15b51 addressed review comments
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2019-10-24 07:55:37 +11:00
RomanBapst 00f49e62c2 cleanup checks of range finder data
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2019-10-24 07:55:37 +11:00
bresch b38458c2ab Terrain estimator: formatting and remove redundant comments 2019-10-22 20:19:56 +11:00
bresch e09e3e17a1 control: rename _range_aid_enabled to _is_range_aid_suitable
rename rangeAidConditionsMet to checkRangeAidSuitability
2019-10-15 11:10:36 +02:00
bresch fac69d07a3 control: refactor rangeAidConditionsMet function 2019-10-15 11:10:36 +02:00
Paul Riseborough eae6e8f19c EKF: Fix on ground yaw drift when using EKF2_MAG_TYPE = 4 2019-10-08 20:08:42 +11:00
RomanBapst 4e946d5bcb implemented synthesized magnetometer Z measurement
- calculate a theoretical value based on the knowledge of the direction
and strength of the magnetic field vector and X/Y sensor measurements
- needs knowledge about location on earth to work
2019-10-08 20:02:16 +11:00
kritz 4a38f5a2f6 Add timestamp to ECL print statements, (#644)
which is helpful for EKF replay debugging.
2019-09-25 11:24:42 +02:00
kamilritz 83eb326076 Missing posNED 2019-09-24 07:48:46 +10:00
kamilritz 4f6ca3a74c Replace rest of spaces with tabs 2019-09-24 07:48:46 +10:00
kamilritz 4511b9ff5e Add missing checks for flags.ev_vel 2019-09-24 07:48:46 +10:00
kamilritz e7d927c899 Stop using bad GPS when we have vision velocity 2019-09-24 07:48:46 +10:00
kamilritz 4b30de587f Make vel_pos innov gate variable name clearer 2019-09-24 07:48:46 +10:00
kamilritz 4237d7ccd7 Improve external vision position fusion 2019-09-24 07:48:46 +10:00
kamilritz 3e8139ff9f Enable vision velocity fusion 2019-09-24 07:48:46 +10:00
Andreas Antener 4f19d457c4 ekf, control: make sure mag fusion doesn't start anymore when we have GPS heading fusion active 2019-09-18 09:27:24 +10:00
Jan Brehmer 93eb1266f6 EKF: reset position when stopping GPS use and EV is active 2019-09-18 08:33:40 +10:00
Nico van Duijn 933189eac0 EKF: fix rng_faulty flag when sensor is stuck 2019-09-12 17:45:37 +10:00
Nico van Duijn a12186c285 terrain_estimator: introduce quality metric in rng
This commit introduces a quality measure in the range data. It is
used to properly decide whether to initialize the HAGL estimate on
 sensor data or MIN_HGT parameter, as well as in the decision of
whether a 'fake' measurement should be published on the ground to
allow for optical flow take-offs.
2019-09-12 17:45:37 +10:00
bresch 3b32ee4166 Flow aiding - Reset state when flow is enabled only if it is the only
position/velocity aiding sensor.
Until now, it was alway resetting if the vehicle does not have gps or
external vision. This caused a reset/glitch at every stop (when range data gets
valid)
2019-09-03 09:58:33 +02:00
kamilritz 933c32c921 Enable local frame alignment also without using it 2019-08-29 08:34:10 +10:00
Paul Riseborough a036cf82cc EKF: Remove use of of quaternion self product operator and fix delta rotation sign 2019-06-17 19:24:55 +10:00
Paul Riseborough 7612fa40ed EKF: Don't start using GPS for height until all validity checks have passed
Consolidate intermittent data checks, improve variable and clarify usage.
2019-06-13 19:36:37 +10:00
Roman c085d7295d addressed review comments 2019-05-15 17:16:36 +10:00
Roman fbb51147b7 implemented use of optical flow for terrain estimation
Signed-off-by: Roman <bapstroman@gmail.com>
2019-05-15 17:16:36 +10:00
Mohammed Kabir 3f691891c4 EKF: control: stop vision yaw fusion on timeout 2019-04-22 12:56:24 +10:00
Martina c4492b17c1 do not reset yaw if vehicle on ground 2019-04-09 20:50:37 +10:00
Paul Riseborough f97f0b6ea3 EKF: Remove unnecessary code
_flt_mag_align_start_time is set on initial alignment and will always be >0 before this check can run
2019-04-08 06:57:17 +10:00
Paul Riseborough 43b5e26fe4 EKF: Fix bug causing continual yaw reset when EKF2_MAG_TYPE = 2 2019-04-08 06:57:17 +10:00
Roman f95cd4b358 ground effect: removed dependency on local position
Signed-off-by: Roman <bapstroman@gmail.com>
2019-03-19 13:14:57 +11:00
CarlOlsson 938c8ad9ad EKF: use hagl estimate if valid for when to trigger yaw reset on takeoff 2019-03-19 13:04:54 +11:00
Carl Olsson f0889c1760 EKF: fixed some comment typos
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-03-18 10:20:33 -04:00
CarlOlsson 2b17ced405 EKF: Clean up use of magnetometer declination. Before the innovation was not zero in fuseDeclination()
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-03-13 08:14:23 +11:00
Paul Riseborough dd58e69549 EKF: Ensure FW yaw alignment method is used on first in-air reset 2019-01-31 09:53:57 -05:00
Paul Riseborough fe378fd761 EKF: Prevent unwanted declination fusion when re-starting 3-axis fusion 2019-01-31 09:53:57 -05:00
Paul Riseborough bd1647a7fb EKF: Rework use of fuseDeclination()
Simplify calling so that it is only called in two ways:
1) Immediately before 3-axis mag fusion if not called since the last earth field covariance reset so that the earth field declination information can be formed.
2) Immediately after 3-axis mag fusion otherwise.
2019-01-31 09:53:57 -05:00
Paul Riseborough d52f53635b EKF: Save mag field covariance data before reset 2019-01-31 09:53:57 -05:00
Paul Riseborough 708c79eb8f EKF: Ensure mag field state covariance data is always available for re-use
Prevents use of  _saved_mag_ef_covmat and _saved_mag_bf_variance before being initialised or when stale.
2019-01-31 09:53:57 -05:00
Paul Riseborough 8839e4e1f4 EKF: Don't discard declination certainty information when resuming 3-axis fusion.
In the case where the EKF is switching between 3-axis and heading fusion, off-diagonal elements containing the correlation between N,E  components of the earth field were being lost on each switch event. These elements contained information about the declination uncertainty and should be preserved.
2019-01-31 09:53:57 -05:00
Paul Riseborough 25148e1b45 EKF: Prevent rapid changes in declination estimate after a reset
Ensures that each time the earth field covariance and variance data is reset, that the off-diagonal elements containing earth field declination angle certainty is restored.
2019-01-31 09:53:57 -05:00
Paul Riseborough 4b3140e5f7 EKF: Fix rebase error 2019-01-31 09:53:57 -05:00
Paul Riseborough a0b9cb002e EKF: Use consistent method for recording completion of in-flight yaw alignment 2019-01-31 09:53:57 -05:00
Paul Riseborough ef5a87c1d4 EKF: Rework quaternion yaw reset.
Use a new method that preserves the roll and pitch information and adds the uncertainty for yaw only.
Ensure that correlation information to non-quaternion states is removed when a reset occurs to prevent fusion of subsequent observations (e.g. GPS) causing incorrect yaw.
2019-01-31 09:53:57 -05:00
Daniel Agar a5e6191ba7 EKF add clarity brackets to avoid potential confusion
- fixes https://github.com/PX4/ecl/issues/555
2019-01-30 09:15:53 -05:00
Anna Dai 44200e9649 add GPS drop out case to GPS fusion logic
EKF waits 10s after GPS signal is lost before setting GPS control status flag to false. As the position information given by the alternative position sources drifts from the last GPS position, the controller over corrects.
With this update, the time horizon until GPS control flag set to false is reduced and only alternative position source is used for estimation.

tested with optical flow as position souce

log from as is https://review.px4.io/plot_app?log=d624af5e-dde4-40ab-ba5b-a693a49f5a36

log with update https://review.px4.io/plot_app?log=13ed6dc3-22dd-43f8-b898-4add41d60439
2019-01-17 10:23:15 +11:00
CarlOlsson 490888285d EKF: Remove flag prefix
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-01-13 23:48:46 +01:00