Commit Graph

54 Commits

Author SHA1 Message Date
Beat Küng 07c6aabd98 EKF: reduce KH to only the elements that are really needed, and merge the loops 2016-11-02 10:26:40 +01:00
Paul Riseborough 1b59a89a18 EKF: save some stack memory 2016-11-02 09:06:06 +01:00
Beat Küng 25cb400da9 EKF: remove Ekf::KHP and move KHP to the methods where it's used
Everywhere where KHP is used, it is first completely reset, thus making
it unnecessary to keep it as a class member.

This saves 2.3KB RAM.

Stack sizes don't need changing, since there is already a function
Ekf::predictCovariance(), which needs around 3KB of stack and is called
close to where the fuse* functions are called.
2016-11-01 22:49:20 +01:00
Paul Riseborough 79b1d3018d EKF: Fix magnetometer innovation test ratio reporting bug 2016-10-12 08:51:45 +02:00
Paul Riseborough a2d866520a EKF: perform innovation check in all axes before fusing 3D mag data (#171)
Perform the innovation consistency check on all axes first and exit if any axis fails. Reduces the likelihood of bad magnetometer data corrupting the attitude estimates.
2016-07-07 16:46:30 +02:00
Paul Riseborough b3baab64f2 EKF: Updates to 3-axis mag fusion auto-code
The code fragments for the magnetometer fusion have been refreshed from the auto-coder.
Explicit floating point types used for constants.
The 3x24 observation Jacobian has been replaced with a 1x24 that is updated each axis iteration to save memory.
2016-06-08 12:56:59 +10:00
Paul Riseborough 21168f9929 EKF: fix bug in 3-axis mag fusion innovation test
The fault flag was not being set after an innovation test failure resulting in fusion of the failed measurement
2016-06-08 11:58:33 +10:00
Paul Riseborough 99b34f0df4 EKF: Only reset necessary terms when mag fusion covariance reset required
Only the quaternion and mag fusion state covariances are used in the mag fusion calculations.
2016-06-08 11:58:33 +10:00
Paul Riseborough 381d99aed6 EKF: Inform console of serious fusion numerical errors 2016-06-08 11:58:33 +10:00
Paul Riseborough dbfe8c0242 EKF: remove approximation in mag fusion innovation variance calculation
The covariance was not being updated with the observation from one axis before the innovation variance was calculated for the next axis. This results in greater weighting on measurements for subsequent axes.
2016-06-08 11:58:33 +10:00
Paul Riseborough 65da9173b9 EKF: capture innovation checks and reset events in separate variables
rename the innovation check status class variable and remove the reset flags from it.
2016-06-01 17:13:00 +10:00
Paul Riseborough 388e500180 EKF: remove un-used magnetometer health class variable
replaced by _sensor_health_status
2016-06-01 17:13:00 +10:00
Paul Riseborough e7690bd8f8 EKF: capture magnetometer innovation test failures 2016-06-01 17:13:00 +10:00
Paul Riseborough 3fb449295e EKF: capture yaw innovation test failures 2016-06-01 17:13:00 +10:00
Carl Olsson 0fafc49a49 fixed typos (#147) 2016-05-22 17:40:43 +02:00
Paul Riseborough 920d83d68c EKF: Fix bugs preventing use of external vision yaw data 2016-05-14 21:56:41 +10:00
Paul Riseborough 59eb9eb3db EKF: fix shadow declaration arising from rebase 2016-05-14 21:17:30 +10:00
Paul Riseborough e917d6c7f2 EKF: Add fusion of external yaw data 2016-05-14 21:17:29 +10:00
Paul Riseborough 020b87933e EKF: replace fault status struct with a union to facilitate logging 2016-05-07 21:11:16 +10:00
Paul Riseborough 7f5669fb2d EKF: consolidate covariance corrections
Combines the forced symmetry, variance limiting and zeroing of covariances for unwanted states in the one function.
This ensures a consistent correction is applied after every covariance prediction or correction.
2016-05-07 20:29:50 +10:00
Paul Riseborough c8d95586e7 EKF: Improve protection against bad magnetometer fusion 2016-05-07 14:23:20 +10:00
Paul Riseborough f01f4ae4b1 EKF: tidy up mag declination fusion 2016-05-05 21:23:03 +10:00
Paul Riseborough 0d31aad33a EKF: Fix bad limit on magnetometer noise parameter 2016-05-05 21:23:03 +10:00
Paul Riseborough 7069fb7a04 EKF: refresh auto code for mag fusion 2016-05-05 21:23:03 +10:00
Paul Riseborough a373ada858 EKF: explicitly define floating point type in hardcoded constants 2016-05-05 21:23:03 +10:00
Paul Riseborough 82da832816 EKF: tidy up Kalman gain calculations
Inhibiting of states is controlled via zeroing rows and columns in the covariance prediction so conditional logic in gain calculations is unnecessary.
2016-05-05 21:23:03 +10:00
Paul Riseborough fe9f88a8b4 EKF: test new derivation
Use direct attitude parameterisation
Discard scale factors
Add accel bias
2016-05-05 21:23:03 +10:00
Paul Riseborough 5bf02517a7 EKF: Rationalise use of rotation matrices and improve efficiency 2016-04-12 11:14:31 +10:00
Paul Riseborough 6b2e2dba90 EKF: Add GPS height option and improve height recovery 2016-03-16 10:40:51 +11:00
Paul Riseborough 5242af84af EKF: Standardise covariance update and use static arrays for large matrices 2016-03-05 08:58:19 +11:00
Paul Riseborough 1414d591ce EKF: Fix bug in declination fusion indexing 2016-03-05 08:43:33 +11:00
Paul Riseborough a6da73fa83 EKF: Add missing div0 protection 2016-03-01 18:03:35 +11:00
Paul Riseborough 97df006a6a EKF: Update direct heading fusion
Adds a 312 Euler rotation sequence option for magnetic heading fusion.
Switches between it and the normal 321 sequence option depending on orientation.
2016-03-01 15:25:22 +11:00
Paul Riseborough 0ad5329caf EKF: Update comments in heading fusion to clarify calculation of magnetic heading 2016-02-24 12:06:11 +11:00
Roman Bapst 8eb63a150d Merge pull request #53 from bugobliterator/pr-sharedlib
Shared Library build
2016-02-23 08:30:46 +01:00
Paul Riseborough a711632017 EKF: Add method to fuse horizontal magnetometer data
This method is more suitable than a raw heading measurement because it works across a full range of pitch angles.
It has been made the default for ground operation.
2016-02-20 19:45:32 +11:00
Paul Riseborough 6df6ac0023 EKF: Fix sign error in heading innovation calculation and clean up 2016-02-20 11:54:53 +11:00
Paul Riseborough 90e1bd3e36 EKF: wrap compass yaw estimate 2016-02-19 16:53:55 +11:00
Paul Riseborough 7d6226eb45 EKF: Improve efficiency of yaw angle fusion
Use direct calculation of Kaman gains with optimised algebra
2016-02-19 16:25:01 +11:00
Paul Riseborough 7f121e81e4 EKF: Update yaw innovation calculation to match revised derivation
The new derivation does not use magnetic field measurements in the observation model and instead fuses in a heading measurement directly.
2016-02-19 16:18:07 +11:00
bugobliterator 263c48d089 EKF: remove dependecies and allow ekf to be built as standalone shared lib 2016-02-17 17:33:18 -08:00
Paul Riseborough 1d40507af8 EKF: Set Kaman gains to zero for un-used states
This is a defensive programming technique. In theory this should not be necessary if the corresponding covariance entries are zero.
2016-02-16 11:08:30 +11:00
Paul Riseborough 402206a305 EKF: Fix critical bug in fusion of yaw and declination observations
This bug was in the derivation and resulted from use of a tan instead of an atan operator. The derivations have been reworked and the updated auto-code has been imported as part of this patch.
2016-02-16 11:08:30 +11:00
Paul Riseborough 2bbe7f9a1c EKF: Update magnetometer fusion to use declination from the specified source 2016-02-14 22:01:53 +01:00
Paul Riseborough 47ab5ebcdd EKF: Make PR comply with project convention for indenting 2016-02-08 15:12:38 +11:00
Paul Riseborough dbb8e12948 EKF: Add fusion method to constrain declination when unobservable
When fusing 3-axis magnetometer data without absolute external aiding leg GPS), the declination is ultimately unobservable and the declination of the  field states and the vehicle heading will slowly drift over time. To prevent this we need to fuse in a declination to constraint the NE earth field estimates.
2016-02-08 14:18:43 +11:00
Paul Riseborough 9347afe250 EKF: Use unique variable name for mag heading fusion observation Jacobian 2016-02-08 14:18:43 +11:00
Paul Riseborough 3f81eb7d1b EKF: fix formatting 2016-02-04 17:15:03 +11:00
Paul Riseborough 2b1e8fe910 EKF: Update tuning parameters
Set conservative defaults as a baseline for tuning
Add a missing parameter for magnetometer observation noise.
Correct error in definition of magnetic heading observations noise (previous parameter defined the variance directly, not the noise).
Scale vertical GPS noise to allow for average EPV to EPH ratio.
Update documentation and display names for consistency.
2016-02-03 17:05:45 +11:00
bugobliterator d79e12dfa1 EKF: fix code style 2016-01-31 00:12:16 -08:00