Commit Graph

179 Commits

Author SHA1 Message Date
Daniel Agar ed9a394029
EKF RingBuffer avoid copying 2017-11-15 18:08:51 -05:00
Paul Riseborough 01d68ef67c EKF: Enable use of rotated external nav estimates 2017-11-01 08:33:57 +11:00
Paul Riseborough 79995b2c15 Create total energy control system implementation
This is a new, clean and streamlined variant of the mathematical derivation I created a few years ago.
2017-10-22 20:37:40 +02:00
Paul Riseborough dd5b8525c3 EKF: Use hamiltonian convention for quaternion product order 2017-08-31 11:14:02 +02:00
Daniel Agar 99ba1c3745
EKF trivial code style cleanup 2017-08-25 10:09:11 -04:00
Paul Riseborough eb1e73ec81 Merge pull request #283 from PX4/ekf_matrix_cleanup
EKF matrix typedef cleanup
2017-07-03 21:02:24 +10:00
ChristophTobler ed8fa16678 use baro for the ekf alignment if range finder is primary height source 2017-06-30 10:28:57 +02:00
Daniel Agar c44488fdb8
EKF matrix typedef cleanup 2017-06-19 11:10:01 -04:00
Roman 39983a7d55 range aid: added hysteresis for switching in and out of range aid
- prevents rapid switching
- added innovation consistency check for using range aid

Signed-off-by: Roman <bapstroman@gmail.com>
2017-06-15 09:10:43 +02:00
Paul Riseborough fed4a9bc5a EKF: add vertical position derivative output
Add calculation of a vertical position derivative to the output predictor. This will have degraded tracking relative to the EKF states, but the velocity will be closer to the first derivative of the position and reduce the effect inertial prediction errors on control loops that are operating in a pure velocity feedback mode.
Move calculation of IMU offset angular rate correction out of velocity accessor and into output predictor.
Provide separate accessor for vertical position derivative.
2017-06-12 10:45:46 +10:00
Paul Riseborough 05c3c46f83 ekf2: changes arising from code review 2017-05-17 08:59:01 +02:00
Paul Riseborough 394dd95cba EKF: Don't do magnetic field estimation without earth frame measurements
Use horizontal acceleration to check if yaw is observable independent of the magnetometer.
Use rotation about the vertical to check if mag raises are observable.
If neither yaw of mag biases are observable, save the magnetic field variances and switch to magnetic yaw fusion.
Use the last learned declination when using magnetic yaw fusion so that the yaw reference remains consistent.
When yaw or biases become observable, reinstate the saved variances and switch back to 3D mag fusion.
2017-05-17 08:59:01 +02:00
ChristophTobler 47973a4820 run terrain estimator after control fusion modes. Otherwise _range_data_ready will never be true and fuseHagl() will never run 2017-05-15 07:42:51 +02:00
Daniel Agar 3919d60f66
ekf2 initialization fixes 2017-04-24 18:56:50 -04:00
Paul Riseborough 465b145929 EKF: Add multi-rotor drag model for wind estimation 2017-04-16 13:07:12 +02:00
Paul Riseborough 2f2ac5be43 EKF: Improve protection against severe IMU accel errors
Use vertical velocity and position innovation failure to detect bad accelerometer data caused by clipping or aliasing which can cause large vertical acceleration errors and loss of height estimation. When bad accel data is detected:

1) Inhibit accelerometer bias learning
2) Force fusion of vertical velocity and height data
3) Increase accelerometer process noise
2017-04-07 08:47:13 +10:00
Paul Riseborough fa07536314 EKF: Prevent rounding errors causing bad conditioned covariance matrix
The previous practice of relying on the off-diagonals being zero caused problems with conditioning of the magnetometer fusion on one flight. By storing the variances when the learning inhibit becomes active and ensuring that the rows and columns in the covariance matrix for the inhibited states are always zero, the observed numerical conditioning error has been eliminated for replay of the problem flight log .
2017-04-06 13:34:37 +10:00
Paul Riseborough 588b27bde7 EKF: inhibit accelerometer bias learning if manoeuvre levels are excessive
This prevents bad scale factors and other errors associated with rapid manoeuvres corrupting the accelerometer bias estimates.
2017-03-10 10:14:06 +01:00
Paul Riseborough 5fb24c3032 EKF: Reduce EKF prediction delta time jitter
Make the target EKF rate an integer multiple of the IMU rate. This slightly increases the average prediction time step for the EKF from just over 10msec to 12msec, but the variation reduces significantly which makes filter tuning more deterministic.
Improve the algorithm used to adjust the collection time criteria to reduce jitter in the correction.
2017-03-10 10:14:06 +01:00
Paul Riseborough 8511754094 EKF - detect and fix badly conditioned accel bias covariance values. 2017-03-10 10:14:06 +01:00
Paul Riseborough 879ad1fd2c Merge pull request #231 from pickledgator/ev_hgt_counter_fix
height counter update for ev primary height source
2017-03-10 14:18:35 +11:00
Paul Riseborough 092cc52838 EKF: Remove out of date comment 2017-03-10 14:18:13 +11:00
Roman 6480fcc3d5 terrain estimator: fixed computation of filtered time since last range update
- do not use hrt to compute delta time
- limit filter state
- do not use static variables

Signed-off-by: Roman <bapstroman@gmail.com>
2017-02-22 14:12:05 +01:00
Paul Riseborough 6561edb9a5 EKF: Clean up terrain estimation functionality.
This is a functionally equivalent. It moves all of the code for the terrain estimator into a single function call from the main filter update, making it clear that it is independent of the main filter.
2017-02-22 14:12:05 +01:00
devbharat 8004e9fe7e EKF: Make range finder data continuous check more robust
Use a filtered arrival time delta to determine if range data is continuous
2017-02-22 14:12:05 +01:00
Paul Riseborough cf9c8de167 EKF: Add arbitrary pitch offset for range sensor 2017-02-22 14:12:05 +01:00
Daniel Agar 2750961be6 c++11 initialization cleanup (#237) 2017-02-05 13:05:10 -05:00
Daniel Agar 7883085e4a clang-tidy readability-simplify-boolean-expr (#235) 2017-02-02 00:17:43 -05:00
Paul Riseborough 26a06567bb EKF: add missing initialisation for class variables 2017-01-15 10:02:31 +01:00
Paul Riseborough 6358bbd257 EKF: remove self assignment 2017-01-15 10:02:31 +01:00
Daniel Agar a7cdef6c5c clang-tidy modernize-redundant-void-arg 2017-01-14 16:24:45 -08:00
Nic ec1a14bc6b height counter needs to be updated with ev counter value when our primary height source is set to ev 2017-01-05 21:47:13 -08:00
Paul Riseborough 3c4c09593f EKF: Rationalise console messages
Combine the observation action buffer and alignment messages
Ensure all data timeout messages are warnings.
Use consistent terminology.
2016-12-28 10:39:47 +01:00
Paul Riseborough 5ad329b641 EKF: Fix variable names to match convention 2016-11-07 22:23:12 +11:00
Paul Riseborough 403424d55d EKF: fix cross compiler build errors 2016-11-07 09:38:44 +11:00
CarlOlsson 15768f6f93 adopted ekf.cpp 2016-11-05 12:19:01 +01:00
Paul Riseborough b29174d86b Merge pull request #193 from PX4/pr-haglInit
Pr hagl init
2016-10-04 08:21:15 +11:00
Paul Riseborough 65762e5998 EKF: publish output predictor tracking errors 2016-10-03 14:13:07 +11:00
Paul Riseborough c81f9f1dba EKF: Reduce output predictor tracking errors
Implements a PI tracking loop
2016-10-03 14:13:07 +11:00
Roman cc05db4985 terrain estimator: pass initialisation return value correctly
Signed-off-by: Roman <bapstroman@gmail.com>
2016-09-20 14:07:50 +02:00
Paul Riseborough 7bc9217f00 EKF: Clean up control of observation fusion
All the decision for a sensor are made within a specific function for that sensor and when there is data to process at the fusion time horizon.
Information and warning messages are improved.
2016-06-30 17:06:32 +10:00
Paul Riseborough 2024252d65 Merge pull request #158 from CarlOlsson/act_ars_off_by_default
activate tas fusion, off by default
2016-06-08 14:17:31 +10:00
Paul Riseborough 34ffffa021 EKF: Prevent use of non time-stamped invalid data during initialisation
Fixes bad height initialisation seen intermittently with snapdragon
2016-06-08 11:56:07 +10:00
CarlOlsson eded0a8f7e activate tas fusion, off by default 2016-06-07 13:49:17 +02:00
Paul Riseborough 081e17729c EKF: delay commencement of 3D mag fusion until clear of ground
Wait until enough height has been gained to be clear of ground based magnetic anomalies. Failure to do so can result in incorrect earth field initialisation.
2016-06-06 21:59:46 +10:00
Paul Riseborough 81ca167da8 EKF: align output observer to EKF states on startup 2016-06-01 17:13:00 +10:00
Paul Riseborough 733862f649 EKF: move the reset status struct to the Ekf class
This protects it from being modified externally
2016-06-01 17:13:00 +10:00
Paul Riseborough aca0336392 EKF: update vertical position and velocity reset capture
Use reset event struct members instead of separate variables
2016-06-01 17:13:00 +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