Commit Graph

736 Commits

Author SHA1 Message Date
Randy Mackay 6c3948f417 AP_NavEKF_Source: optimise configured_in_storage
This small CPU optimisation takes advantage of the fact that once configured in storage is true it will always remain true
2020-11-24 12:10:27 +11:00
Andrew Tridgell fe81387433 AP_NavEKF: allow init twice
this can happen if setup_core() fails with low mem and is called again
2020-11-20 21:56:32 +11:00
Andrew Tridgell e4a9497942 AP_NavEKF: added common EKF buffer classes 2020-11-20 21:56:32 +11:00
Randy Mackay 0119c48e1e AP_NavEKF_Source: add mark_configured_in_storage 2020-11-20 16:43:44 +09:00
Randy Mackay 50b2cf136f AP_NavEKF_Source: default OPTIONS to 1 (fuse all velocities) 2020-11-20 16:43:44 +09:00
Randy Mackay 9b84abecaa AP_NavEKF_Source: enables dynamically changing sensor sources 2020-11-20 16:43:44 +09:00
Paul Riseborough 78e10e99f5 AP_NavEKF: Add accessor for yaw estimator velocity innovation length 2020-11-16 16:01:13 +11:00
Andrew Tridgell 97a2c5a576 AP_NavEKF: removed Log_EKF_Timing
not needed for new replay

Co-authored-by: Peter Barker <pbarker@barker.dropbear.id.au>
2020-11-10 16:15:45 +11:00
Peter Barker 3a8751d8a7 AP_NavEKF: remove unused variables 2020-10-01 21:13:20 +10:00
Paul Riseborough 5ad5498b07 AP_NavEKF: Enable external setting of yaw estimator bias states 2020-07-07 15:33:58 +10:00
Paul Riseborough 709a42cb7f AP_NavEKF: remove unnecessary memcopy 2020-07-07 15:33:58 +10:00
Paul Riseborough 4a743a3827 AP_NavEKF: Remove unnecessary reset operations and class variables
The setting of EKF state variances is only required when commencing or recommencing velocity fusion.
The function that resets the EKF and GSF class variables has been renamed to be more consistent with its function.
2020-07-07 15:33:58 +10:00
Paul Riseborough 0ce4dd457d AP_NavEKF: Fix one frame delay in processing yaw estimator velocity data 2020-07-07 15:33:58 +10:00
Randy Mackay a43beaaa23 AP_NavEKF: GSF white space fixes 2020-04-24 09:43:23 +10:00
Randy Mackay 1ee9f3a6de AP_NavEKF: GSF getLogData and getYawData pass by reference 2020-04-24 09:43:23 +10:00
Paul Riseborough 51b62a34b9 AP_NavEKF: Use better type for array index 2020-04-24 09:43:23 +10:00
Paul Riseborough 6bb7c55bba AP_NavEKF: Add yaw estimator class using Gaussian Sum Filter
AP_NavEKF: Simplify centripetal accel correction
2020-04-24 09:43:22 +10:00
Rishabh b0134460e5 AP_NavEKF:Logger documentation TimeUS fix 2020-04-07 18:57:01 +10:00
Peter Barker 051a7dc298 AP_NavEKF: add onboard LogMessage documentation 2020-03-27 08:05:53 +11:00
Peter Hall 9ec5355dfc AP_NavEKF: add initalized flag and change to uint32_t 2020-02-19 06:45:07 +11:00
Peter Barker 0da27417bc AP_NavEKF: use instance # when logging EKF core timings 2019-12-06 12:52:03 +09:00
Andrew Tridgell f79907bd1e AP_NavEKF: fixed build with vector index checking 2019-10-01 15:39:03 +10:00
Andrew Tridgell 688b01c6c6 AP_NavEKF: added a common parent class for EKF2 and EKF3 core classes
this provides a common location for static intermediate variables in
EK2 and EK3. This has a few benefits:

 - the compiler can determine the address of the frequently accessed
   variables at compile time, making them faster

 - by sharing between EK2 and EK3 we save a lot of memory if both EK2
   and EK3 are enabled

 - we can fill all these with NaN in SITL on every loop, which allows
   us to catch cases where the variables are ever re-used between
   loops, which guarantees we aren't mixing data between EKF lanes or
   between EK2 and EK3
2019-10-01 15:39:03 +10:00
Peter Barker 9e0f525f69 AP_NavEKF: move logging in from AP_Logger 2019-09-03 09:28:37 +10:00
Andrew Tridgell 103d1aea41 AP_NavEKF: added gps_quality_good EKF flag 2018-07-14 17:49:52 +10:00
Michael du Breuil ac9d5f8a5c AP_NavEKF: Make the status unions use bool, add static asserts 2018-04-11 09:47:43 +09:00
priseborough 6a91b294b4 AP_NavEKF: Clarify definition for gps_glitching flag 2018-03-27 20:28:54 +09:00
priseborough 7d777485d8 AP_NavEKF: Add monitoring of average EKF time step 2017-04-29 11:03:44 +10:00
Andrew Tridgell ae3df89d17 AP_NavEKF: added ekf_timing structure 2017-04-28 17:19:39 +10:00
Michael du Breuil 61023fc636 NavEKF: Add GPS vertical accuracy to nav_gps_flags 2017-02-22 11:53:42 -08:00
priseborough bb29c74e52 AP_NavEKF: remove EKF1 2016-12-19 08:07:11 +11:00
Pierre Kancir f54cf6e097 AP_NavEKF: storeIndex remove second initialisation 2016-12-05 12:39:31 -08:00
murata de153ce1d7 AP_NavEKF: Correct the setting process of variable dAngBiasSigma. 2016-11-24 03:24:18 +00:00
murata ec42ddfb4e AP_NavEKF: style changes (tab to spaces, etc.)
AP_NavEKF: style changes (tab to spaces, etc.)

AP_NavEKF: style changes (tab to spaces, etc.)
2016-11-24 03:24:18 +00:00
Andrew Tridgell a05d216ce4 AP_NavEKF: make posOffset const ref for optflow 2016-10-27 15:45:40 +11:00
priseborough b40016db62 AP_NavEKF2: Fix documentation errors 2016-10-27 14:54:43 +11:00
priseborough 8160eca47e AP_NavEKF: update flow sensor interface
Adds a position offset which is not used by the backend
2016-10-27 14:54:42 +11:00
Mathieu OTHACEHE 152edf7189 Global: remove mode line from headers
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02:00
priseborough d0ba259d0d AP_NavEKF: Fix bug in median filter code 2016-10-19 19:44:58 +09:00
Jonathan Challinger 3eba985afd AP_NavEKF: use exact matrix for trim rotation 2016-10-13 10:02:13 +11:00
Tom Pittenger e63e7a5336 AP_NavEKF: comment that param "Enable" index is moved to top 2016-08-04 11:32:46 -07:00
priseborough b3bfb71431 AP_NavEKF: fix documentation errors 2016-07-19 12:16:50 +10:00
priseborough 487bbc3ed2 AP_NavEKF: Fix reporting of position status
Split publishing of local position into horiz and vert components with separate validity checks
Split status reporting into separate update and get functions and only update once after each loop update. This removes unnecessary re-calculation of the status logic and ensures all consumers get the same data (avoid possible race conditions).
2016-07-19 12:16:48 +10:00
Paul Riseborough d33bbf8cc7 AP_NavEKF: remove debug code 2016-05-21 15:13:52 +10:00
Paul Riseborough d59d8cc6e3 AP_NavEKF: extend fusion fault reporting coverage 2016-05-21 15:13:50 +10:00
Ricardo de Almeida Gonzaga 267a74ebb2 AP_NavEKF: Fix typos 2016-05-13 19:20:06 -03:00
dgrat 41661f815f AP_Math: Replace the pythagorous* functions with a variadic template
The new function can deal with a variable number of function parameters.
Additionally, I renamed the functions to norm(), because this is the
standard name used in several other projects.
2016-05-10 11:41:26 -03:00
Jonathan Challinger 6938e3d57b AP_NavEKF: check mag instance id when returning mag offsets 2016-04-21 09:51:41 +10:00
Lucas De Marchi bb0d96cedd AP_NavEKF: replace header guard with pragma once 2016-03-16 18:40:42 +11:00
Peter Barker 11760c33f6 AP_NavEKF: avoid use of undefined #defines
Ensure EKF_DISABLE_INTERRUPTS is defined

Do not define MATH_CHECK_INDEXES, assume it is defined
2016-02-19 12:34:24 -02:00
Paul Riseborough 1950008248 AP_NavEKF: Send correct data over mavlink status message 2016-02-01 10:02:20 +09:00
Jonathan Challinger eabede692e AP_SmallEKF: move to AP_Mount/SoloGimbalEKF and merge solo version 2016-01-23 10:35:38 +09:00
Andrew Tridgell a6c39dee84 AP_NavEKF: don't allocate EKF1 unless it will leave 4k free memory 2016-01-07 08:33:33 +11:00
Andrew Tridgell a0a4b698f6 AP_NavEKF: disable EKF1 by default
use EKF2 instead
2016-01-05 16:41:48 +11:00
Andrew Tridgell 0ef61b1637 AP_NavEKF: moved ENABLE param to front of list
and mark as FLAG_ENABLE. This removes the EKF_* parameters when
EKF_ENABLE is 0
2016-01-04 11:14:43 +11:00
Andrew Tridgell 28a684ea03 AP_NavEKF: use get_loop_delta_t() from INS 2015-12-27 14:57:14 +09:00
Andrew Tridgell a042845da8 AP_NavEKF: avoid an optimiser bug in clang 2015-12-27 16:21:26 +11:00
Don Gagne 34d5dd0257 AP_NavEKF: fix invalid Range meta data 2015-12-27 16:10:44 +11:00
Andrew Tridgell d24f6f4050 AP_NavEKF: fixed static const bug 2015-12-20 17:55:39 +11:00
Lucas De Marchi 798b743660 AP_NavEKF: use MAX() instead of maxf() 2015-12-01 16:28:18 -02:00
Lucas De Marchi 2591261af6 Global: rename min and max macros to uppercase
The problem with using min() and max() is that they conflict with some
C++ headers. Name the macros in uppercase instead. We may go case by
case later converting them to be typesafe.

Changes generated with:

	git ls-files '*.cpp' '*.h' -z | xargs -0 sed -i 's/\([^_[:alnum:]]\)max(/\1MAX(/g'
	git ls-files '*.cpp' '*.h' -z | xargs -0 sed -i 's/\([^_[:alnum:]]\)min(/\1MIN(/g'
2015-12-01 16:28:09 -02:00
Luis Vale Gonçalves 40caec8afb AP_NavEKF: libraries_Text_revision
text revision of messages
2015-11-26 08:10:14 +11:00
Caio Marcelo de Oliveira Filho e3c317b96b AP_NavEKF: use millis/micros/panic functions 2015-11-20 12:32:31 +09:00
Andrew Tridgell 5561efde2b AP_NavEKF: we can assume get_sample_rate() returns a non-zero number
this fixes a build error with the previous patch
2015-11-18 11:48:50 +11:00
Paul Riseborough e32e6cfa67 AP_NavEKF: Protect against bad delta time from the INS library
Prevent arithmetic divide by zero exceptions and handle invalid delta time in a consistent way by setting invalid times to the average.
2015-11-18 11:43:40 +11:00
Julien BERAUD 259f5f07e8 AP_NavEKF_core: fix init of perf
_perf_FuseOptFlow  was used and not allocated
2015-11-14 14:44:29 +11:00
Paul Riseborough e8305c5653 AP_NavEKF: Prevent front-end from returning uninitialised data (garbage) 2015-11-09 15:56:45 +11:00
Paul Riseborough 0f8cfa02ab AP_NavEKF: Remove redundant if statement
Thank you to OXINARF for picking up this one
2015-11-08 17:06:57 +11:00
Paul Riseborough 2243f95074 AP_NavEKF: Enable clean entry into GPS aiding whilst in-flight
Ensures that the latest GPS data is used to reset the states.
Separates the logic used to set the origin from the logic used to determine when to reset states and commence GPS aiding
2015-11-08 17:06:49 +11:00
Paul Riseborough 624f169b9b AP_NavEKF: Publish enabled status 2015-11-08 15:37:27 +11:00
Siddharth Bharat Purohit 392fce76b2 AP_NavEKF: define getGpsGlitchStatus function 2015-11-08 12:55:58 +09:00
Andrew Tridgell 56909ce973 AP_NavEKF: split EKF1 into frontend and backend
this allows the primary EKF to be allocated dynamically, allowing for
experiments with EKF2 with multi-IMU support
2015-11-06 10:42:57 +11:00
Lucas De Marchi d00c8e3a34 AP_NavEKF: remove checks for HAL_BOARD_APM2 and HAL_BOARD_APM1 2015-11-04 12:14:12 +11:00
Paul Riseborough 9b37c29efa AP_NavEKF: Improve mag earth state reset accuracy
This removes errors in the in-flight reset of the earth field states by:

1) Using a state vector and magnetometer measurement from the same time coordinate
2) Not using the AHRS trim offsets in the calculation
2015-11-02 17:47:01 +09:00
Paul Riseborough 0dd5a7c4fa AP_NavEKF: Use correct blended delta time for all vel and pos integration
dtIMUactual has been spit into a separate dtDelAng and dtDelVel and dtDelVel1 and dtDelVel2 delta time in recognition of the amount of timing jitter and different update rates for the IMU's
2015-11-02 17:47:00 +09:00
Paul Riseborough 42214ec303 AP_NavEKF: Fix failure to start mag cal due to gyro noise
Vibration in the 400Hz delta angles could cause the angular rate condition check for in-flight magnetic field alignment to fail.
The symptons were failure to start magnetic field learning as expected when EK2_MAG_CAL=3 was set.
The calculation of a delta rotation between consecutive magnetometer samples has been introduced instead of the most recent IMU delta angle as this is less affected by noise and give an upper bound on the angular error.
the check has been moved into the magnetometer fusion control function so that any reset will be performed using fresh magnetometer data
2015-11-02 17:46:59 +09:00
Paul Riseborough 707089178f AP_NavEKF: Update default parameter values:
Explicitly set Plane parameters rather than rely on use of the default
If no type defined, default to Copter parameters (most common platform type
Enable different platform types to use different initial accel bias uncertainty
Reduce initial accel bias uncertainty for copter to prevent initial oscillation in bias and height estimate
2015-11-02 17:46:58 +09:00
Paul Riseborough 3d8f720aaf AP_NavEKF: Improve initial accel bias learning
Fuse synthetic velocity data at zero before arming to improve stability margins for initial bias offset learning.
2015-11-02 17:46:57 +09:00
Paul Riseborough 64ad7d6a50 AP_NavEKF: handle case where one IMU fails to return a delta velocity or angle 2015-11-02 17:46:56 +09:00
Paul Riseborough 69d4bd2481 AP_NavEKF: Protect against baro data errors in constant position mode
Large baro data errors when flying without GPS could cause total failure of the EKF.
This patch provides protection against this happening in-flight but allows for large innovations during preflight alignment.
2015-11-02 17:46:55 +09:00
Paul Riseborough 778b1c3e18 AP_NavEKF: Remove dead code for constant velocity mode 2015-11-02 17:46:54 +09:00
Paul Riseborough fb8e01a73c AP_NavEKF: Do not automatically accept DCM alignment data after 30 seconds
A looser check is applied at 30 seconds rather than no check.
2015-11-02 17:46:53 +09:00
Paul Riseborough be11e12f81 AP_NavEKF: Improve height reset during climbs and descents
Resets the vertical velocity to the GPS when the height is reset is the GPS is healthy
2015-11-02 17:46:53 +09:00
Paul Riseborough 59df23bc0f AP_NavEKF: Reduce EKF health pre-arm check false positives 2015-11-02 17:46:52 +09:00
Paul Riseborough a1e32d71ec AP_NavEKF: Prevent large rotation rates corrupting the in-flight mag reset 2015-10-30 15:34:14 +09:00
Lucas De Marchi 831d8acca5 Remove use of PROGMEM
Now variables don't have to be declared with PROGMEM anymore, so remove
them. This was automated with:

    git grep -l -z PROGMEM | xargs -0 sed -i 's/ PROGMEM / /g'
    git grep -l -z PROGMEM | xargs -0 sed -i 's/PROGMEM//g'

The 2 commands were done so we don't leave behind spurious spaces.

AVR-specific places were not changed.
2015-10-30 14:35:16 +09:00
Randy Mackay 3f29365cae AP_NavEKF: constify getLastPosNorthEastReset 2015-10-30 12:24:15 +09:00
Randy Mackay 758c5a7d7f AP_NavEKF: constify getLastYawResetAngle 2015-10-30 12:24:11 +09:00
Paul Riseborough 7c40448bab AP_NavEKF: Remove GPS glitch offset logic
The correction for offsets due to position and velocity resets will now be handled in the control loops.
2015-10-30 12:24:01 +09:00
Paul Riseborough 5489ff9118 AP_NavEKF: publish position and velocity state reset data
Used by the control loops to compensate for steps in velocity and/or position resulting from state resets.
2015-10-30 12:24:00 +09:00
Paul Riseborough 44f42fe72d AP_NavEK: Reduce settling time after start-up disturbance
Now that we are using  a consistent 50Hz minimum update rate for the covariance prediction we do not need a different initial gyro bias uncertainty for plane and copter to maintain filter stability margins.
The default value of 0.1 rad/s was too high and gave excessive settling time of the filter attitude after startup.
The initial attitude uncertainty has been increased to allow for some movement during startup.
2015-10-22 16:23:14 +11:00
Paul Riseborough 6c017ffcb5 AP_NavEKF: Predict covariance more often to prevent instability on startup
If the baro data and magnetometer data are interleaved (arriving every 100 msec and offset by 50 msec), then the filter will go unstable during startup and fail to complete checks.
2015-10-22 09:57:38 +09:00
Andrew Tridgell f66966ccae NavEKF: use new perf counter API 2015-10-20 18:16:15 +11:00
Paul Riseborough 240ea92947 AP_NavEKF: Re-center gyro bias limits on arming
Allows the gyro bias to vary by up to +-10 deg/second before and after arming.
2015-10-20 15:21:39 +11:00
Paul Riseborough 8515dda727 AP_NavEKF: Fix bug in vertical position derivative calculation 2015-10-20 15:21:39 +11:00
Paul Riseborough 6b3e114cd6 AP_NavEKF: Enable EKF1 to be disabled to reduce frame over-runs 2015-10-20 15:21:39 +11:00
Paul Riseborough 840f307d58 AP_NavEKF: Make EKF2 PosDownDerivative interface follow coding conventions
Updates arising from peer review.
2015-10-20 15:21:37 +11:00
Paul Riseborough dab658f6ed AP_NavEKF: Add methods to output and calculate vertical position derivative 2015-10-20 15:21:36 +11:00
Andrew Tridgell f5b5a3b0f8 AP_NavEKF: added EKF_DISABLE_INTERRUPTS
this helps with performance tuning
2015-10-20 14:37:41 +11:00
Andrew Tridgell 10fddf4c7e AP_NavEKF: enable optimisation level 3 for the EKF 2015-10-20 14:36:56 +11:00