218 Commits

Author SHA1 Message Date
kamilritz
1bf09fd370 Remove EKF prefix from logged messages 2019-12-12 08:48:10 +01:00
kamilritz
181303488c Log height innovation sensor specific 2019-12-05 20:09:34 +11:00
kamilritz
ecd199d5d0 Fix vel pos test ratio 2019-12-05 20:09:34 +11:00
kamilritz
07e804676c Rename IMU biases 2019-12-05 20:09:34 +11:00
kamilritz
dae8c2f8dc Group velocity and position as a 3d vector 2019-12-05 20:09:34 +11:00
kamilritz
beedf1ce4f Add print statement to reset vel or pos function 2019-12-05 20:09:34 +11:00
kamilritz
5c038a3b43 Add stop*Fusion function 2019-12-05 20:09:34 +11:00
kamilritz
d5dc6bb8ea Clean get*innov* interface 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
6299d8199c ekf_helper: use latest validated range sample to reset height
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2019-10-24 07:55:37 +11:00
Paul Riseborough
4d37065f1b EKF: Make use of inverse rotation function consistent with name
The quaternion to inverse rotation matrix function has been updated so that the rotation it produces is the inverse to that produced by the matrix library and the the inverse of the quaternion is uses. This function is now used to directly calculate an inverse rotation matrix rather than calculating the forward rotation and then transposing it.
2019-10-23 14:44:08 +03:00
Paul Riseborough
36de2b3dc1 EKF: Use matrix library for quaternion to rotation matrix conversion 2019-10-23 14:44:08 +03:00
bresch
b38458c2ab Terrain estimator: formatting and remove redundant comments 2019-10-22 20:19:56 +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
fd6b364c11 posNED to pos and velNED to vel and add ev vel covariances to reset 2019-09-24 07:48:46 +10:00
kamilritz
cea053820d Remove spaces with tabs 2019-09-24 07:48:46 +10:00
kamilritz
1e57c4bbec Fix white space 2019-09-24 07:48:46 +10:00
kamilritz
10cbd79db7 Rotate external vision info in reset function if necessary 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
3e8139ff9f Enable vision velocity fusion 2019-09-24 07:48:46 +10:00
kamilritz
c5abfe626f remove canonicalize and adapt comments 2019-08-29 08:34:10 +10:00
kamilritz
a2ff415fe4 Fix get frame aligning quaternion function 2019-08-29 08:34:10 +10:00
kamilritz
53eac6e94e Canonicalize alignment quaternion 2019-08-29 08:34:10 +10:00
kamilritz
933c32c921 Enable local frame alignment also without using it 2019-08-29 08:34:10 +10:00
kamilritz
ea352a6631 Dont use mag suffix for magnitude 2019-08-29 08:34:10 +10:00
kamilritz
05196db79e Fix alignment of local frame 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
0e946f25fd EKF: Remove use of quaternion self product operator and fix delta rotation sign error 2019-06-17 19:24:55 +10:00
CarlOlsson
ad7f7af03b ekf: correct quaternion multiplication order 2019-06-17 19:24:55 +10:00
CarlOlsson
d6351bd7a5 EKF: update comment 2019-06-17 19:24:55 +10:00
Roman
cef2ba5ab9 implemented Kahan summation algorithm for adding process noise to delta
angle- and delta velocity bias variance

- the contribution of process noise per iteration for these states can be so
small that it gets lost if using standard floating point summation

Signed-off-by: Roman <bapstroman@gmail.com>
2019-06-11 19:28:06 +10: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
Paul Riseborough
fabd216ca5 EKF: Documentation edits 2019-03-13 08:14:23 +11:00
CarlOlsson
8d6e8ae078 EKF: update get_mag_decl_deg()
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-03-13 08:14:23 +11: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
CarlOlsson
1d91785a8e EKF: correct quaternion order 2019-03-12 19:07:55 +11:00
CarlOlsson
96c5c14041 EKF: Change the EKF initialization to
1) init tilt
2) init yaw
3) init tilt uncertainty
4) init yaw uncertainty

Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-03-12 19:07:55 +11:00
CarlOlsson
6cf512f103 EKF: Also update the newest and oldest quaternion estimate in
alignOutputFilter()

Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-03-12 19:07:55 +11:00
CarlOlsson
78122b20a6 EKF: fix the rotation direction of the buffered attitude solutions
in alignOutputFilter()

Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-03-12 19:07:55 +11:00
CarlOlsson
37339de57c EKF: remove unused variable
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-03-12 19:07:55 +11:00
Nuno Marques
4e0e68e905 Ekf: add more useful methods to interface with the covariances (#543) 2019-03-09 11:57:35 -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
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
CarlOlsson
6e7c119b31 EKF: limit yaw variance increase to 0.01 rad^2 to prevent a badly conditioned covariance matrix
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-01-31 09:53:57 -05:00
CarlOlsson
0896f7b9bd EKF: Also fill in lower part of covariance matrix in increaseQuatYawErrVariance()
Signed-off-by: CarlOlsson <carlolsson.co@gmail.com>
2019-01-31 09:53:57 -05:00
Paul Riseborough
911d4d8f49 EKF: Fix sign error in increaseQuatYawErrVariance function 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