Commit Graph

240 Commits

Author SHA1 Message Date
Andrew Tridgell f7e138bddd AP_NavEKF2: use parent class for intermediate static variables
this makes the code faster as well as using less memory when both EK2
and EK3 are enabled
2019-10-01 15:39:03 +10:00
Andrew Tridgell 96c6544997 AP_NavEKF3: moved intermediate variables to common memory
this moves intermediate variables from being per-core to being common
between cores. This saves memory on systems with more than one core by
avoiding allocating this memory on every core.

This is an alternative to #11717 which moves memory onto the stack. It
doesn't save as much memory as #11717, but avoids creating large stack
frames
2019-09-24 12:51:54 +10:00
Andrew Tridgell 0041874826 AP_NavEKF2: moved intermediate variables to common memory
this moves intermediate variables from being per-core to being common
between cores. This saves memory on systems with more than one core by
avoiding allocating this memory on every core.

This is an alternative to #11717 which moves memory onto the stack. It
doesn't save as much memory as #11717, but avoids creating large stack
frames
2019-09-24 12:51:54 +10:00
Michael du Breuil a4d10b2e86 AP_NavEKF2: Allow the GPS to be responsible for logging 2019-09-10 09:09:17 +10:00
hoangthien94 fc9ff2b09a AP_NavEKF2: add method to check if ext nav is used for yaw 2019-08-03 08:44:11 +09:00
Andrew Tridgell e7163afe06 AP_NavEKF2: review fixes
thanks Paul!
2019-07-29 10:08:22 +10:00
Andrew Tridgell 742ae0b750 AP_NavEKF2: set origin on all cores
when EKF origin is set, make sure it is set on all cores
2019-07-29 10:08:22 +10:00
Andrew Tridgell 5db41147ed AP_NavEKF2: restrict setting of EKF origin
only allow EKF origin to be set if EKx_GPS_TYPE is set to 3, which is
used for indoor operation
2019-07-29 10:08:22 +10:00
Andrew Tridgell 567c902e75 AP_NavEKF2: force first EKF lane when disarmed
this ensures we consistently fly with EKF lane1 if it is healthy at
the point we arm. Otherwise the choice of lane will be a lottery.

This is important as many systems have quite different filtering and
vibration characteristics on their different IMUs. We by default
enable fast sampling only on the first IMU for example, which means
the 2nd and 3rd IMUs are more vulnerable to high freq causing
aliasing.
2019-07-04 06:48:23 +10:00
Michael du Breuil 892b687c09 AP_NavEKF2: Fix AP_GPS.h include 2019-06-18 10:02:05 +10:00
Andrew Tridgell 3073c4da7a AP_NavEKF2: added checkLaneSwitch()
this allows the vehicle code to ask the EKF to change lanes if it is
about to do an EKF failsafe
2019-06-12 09:52:20 +10:00
Andrew Tridgell df4fc0fff0 AP_NavEKF2: default EK2_MAG_EF_LIM to 50
this was supposed to be part of the original PR (agreed with Paul to
enable by default)
2019-06-08 20:24:58 +10:00
Andrew Tridgell 3835d2613e AP_NavEKF2: added EK2_MAG_EF_LIM parameter
this sets a limit on the difference between the earth field from the
WMM tables and the learned earth field inside the EKF. Setting it to
zero disables the feature. A positive value sets the limit in mGauss.
2019-06-03 12:21:29 +10:00
Andrew Tridgell cc62998d40 AP_NavEKF2: fixed bug in EKF lane selection
this fixes an issue in selecting the best lane to change to when we
have 3 or more EKF cores. The bug is that if the current lane is
unhealthy it would always choose the last healthy lane instead of
choosing the lane with the lowest score
2019-05-07 06:59:50 +10:00
Michael du Breuil 7f639c1bb2 AP_NavEKF2: Allow checking all cores for failure 2019-04-09 10:53:25 +10:00
Paul Riseborough 8038efc152 AP_NavEKF2: Flow use parameter updates 2019-04-02 10:51:12 +11:00
Paul Riseborough e2148e7e2a AP_NavEKF2: Update default plane optical flow param values
Reduce time required to form estimate of terrain offset
2019-04-02 10:51:12 +11:00
Paul Riseborough 67d20f3b3c AP_NavEKF2: Update parameter description 2019-04-02 10:51:12 +11:00
Paul Riseborough 1862512c2b AP_NavEKF2: Use flow sensor for navigation with unknown platform type
This is the more common use case.
2019-04-02 10:51:12 +11:00
Paul Riseborough 921205f61c AP_NavEKF2: Minor amendments from review 2019-04-02 10:51:12 +11:00
Paul Riseborough a40208ebd4 AP_NavEKF2: Improve optical flow height estimation
Updated derivation using sequential fusion of Y and X axis data.
2019-04-02 10:51:12 +11:00
Paul Riseborough 2b8b53d6b2 AP_NavEKF2: Add parameter to control how optical flow flow data is used 2019-04-02 10:51:12 +11:00
Mark Whitehorn 6b70181837 AP_NavEKF2: add getQuaternionBodyToNED 2019-03-29 10:58:00 +11:00
Tom Pittenger 8506ae9c32 AP_NavEKF2: rename dataflash to logger 2019-03-28 16:40:57 +11:00
Arjun Vinod a0e7c37f8c AP_NavEKF2: fixed typos 2019-02-22 10:21:35 +11:00
Tom Pittenger b32e8a4424 AP_NavEKF2: remove HAL_CPU_CLASS_150 check, 150 is already a minimum requirement 2019-02-17 12:59:52 -08:00
Tom Pittenger 8a6a39b590 AP_NavEKF3: unify singleton naming to _singleton and get_singleton() 2019-02-10 19:09:58 -07:00
chobits 3766ee1b60 AP_NavEKF2: add external navigation data lag 2019-01-31 08:30:22 +09:00
Peter Barker 6fc76a32af GLOBAL: use AP::logger() and strip redundant Log_ from methods 2019-01-18 18:08:20 +11:00
Peter Barker b47733142f GLOBAL: rename DataFlash_Class to AP_Logger 2019-01-18 18:08:20 +11:00
Randy Mackay c616587b86 AP_NavEKF: increase ABIAS_P_NSE param doc range to 0.005 2018-12-27 14:09:53 +09:00
Michael du Breuil 29db069c75 AP_NavEKF2: Suppress clearing non-trival type warning 2018-10-30 16:17:03 -07:00
chobitsfan 1e56ad4837 AP_NavEKF2: add external nav system to POSNE_M_NSE description 2018-10-24 19:14:54 +09:00
Peter Barker 889190d46e AP_NavEKF2: always set EKF control limits, even with no cores 2018-10-09 10:47:38 +11:00
Peter Barker d8aa8d2b71 AP_NavEKF2: fix writeOptFlowMeas signature
const some of the vectors, stop taking references to scalars that aren't
being changed
2018-09-11 09:03:22 +10:00
Michael du Breuil ee9cc28fda AP_NavEKF2: Utilize the GPS drivers estimate for lag 2018-08-07 09:55:26 +10:00
Randy Mackay 3d72022f6e EKF: modify ALT_SOURCE param description
We regularly find users changing the ALT_SOURCE to 1 (range finder) when trying to implement terrain following which is not the correct way to do it
2018-07-18 08:31:09 +09:00
Peter Barker baa818a812 AP_NavEKF2: use compass singleton for logging 2018-07-04 20:11:27 +01:00
Peter Barker 578facc9ad AP_NavEKF2: do not pass GPS into Log_Write_GPS; it uses singleton 2018-04-18 13:50:55 +09:00
Peter Barker 81044760c7 AP_NavEKF2: const accessors 2018-04-04 12:20:36 +01:00
Paul Riseborough c680b931dc AP_NavEKF2: Enable fusion of external nav position data 2018-03-27 20:28:42 +09:00
Peter Barker 40957ec430 AP_NavEKF2: use ins singleton 2018-03-16 00:37:35 -07:00
Peter Barker 5ab89324b2 AP_NavEKF2: use baro singleton 2018-03-08 21:20:05 -08:00
Peter Barker 5b7d5a9757 AP_NavEKF2: mark getEulerAngles as const 2018-03-07 12:34:39 +00:00
Peter Barker 3a99b2bce1 AP_NavEKF: move initialisation of EKF constants into header file
Various comments where getting out of sync with one-another, and
having everything in one place lets you match values against types.
2018-03-01 20:27:19 +09:00
bugobliterator b1213a522d AP_NavEKF2: allocate NavEKF core from MEM_FAST region 2018-01-15 11:46:02 +11:00
Peter Barker 9c8466dc03 AP_NavEKF2: use GPS singleton 2017-12-27 00:58:02 +00:00
priseborough efdc651d1a AP_NavEKF2: Require reboot after changing ALT_SOURCE parameter
Toggling between alt sources in flight using the parameter can have unpredictable effects due to the various height offsets and the possibility that the data source may be unavailable.
2017-10-04 00:24:15 +01:00
priseborough f2f3067326 AP_NavEKF2: Add interface to control GPS vertical velocity use 2017-08-10 19:49:45 +10:00
priseborough 027552ef44 AP_NavEKF2: Fix default behaviour for height origin corrections
Previous default was to apply in-flight height origin changes to local position instead of to reported origin height. This caused problems with copters that took off before getting GPS lock.
2017-07-17 02:22:02 +01:00
Peter Barker 5da3759ff4 AP_NavEKF2: eliminate GCS_MAVLINK::send_statustext_all 2017-07-11 23:53:53 +01:00
Dr.-Ing. Amilcar Do Carmo Lucas 7426bdb9b7 AP_NavEKF2: Fix long description of EK2_OGN_HGT_MASK parameter 2017-06-16 12:05:20 +01:00
priseborough b42fb31d7d AP_NavEKF2: Change default value of EK2_OGN_HGT_MASK
Turn off by default.
Update parameter description
2017-06-14 12:44:41 +01:00
priseborough 77d21f72d4 AP_NavEKF2: Allow reporting of origin height for specified instance 2017-06-14 12:44:41 +01:00
priseborough 36e7dfb5f6 AP_NavEKF2: Improve GPS reference height estimator
Fix rounding error bug preventing state from updating after initial convergence.
Decouple GPS reference height from published EKf origin height.
Add bitmask parameter to control update and publishing of GPS reference height.
2017-06-14 12:44:41 +01:00
Dr.-Ing. Amilcar Do Carmo Lucas 3f6059397c AP_NavEKF2: Add missing @RebootRequired: True 2017-05-27 01:55:55 +01:00
Dr.-Ing. Amilcar Do Carmo Lucas 38b19b9eee AP_NavEKF2: Use SI units conventions in parameter units
Follow the rules from:
http://physics.nist.gov/cuu/Units/units.html
http://physics.nist.gov/cuu/Units/outside.html
and
http://physics.nist.gov/cuu/Units/checklist.html
one further constrain is that only printable (7bit) ASCII characters are allowed
2017-05-17 18:07:25 +10:00
Dr.-Ing. Amilcar Do Carmo Lucas ce37517268 AP_NavEKF2: Improve comments, typos 2017-05-03 08:44:49 +09:00
Andrew Tridgell 2de8777669 AP_NavEKF2: added inter-EKF scheduling cooperation
this changes the stragegy for load levelling between EKF cores so it
works between EK2 and EK3, and with future estimators as well.

It allows us to run EK3 and EK2 at the same time with good scheduling
performance
2017-05-01 14:24:55 +10:00
Andrew Tridgell ee5c032f27 AP_NavEKF2: added recording of timing statistics 2017-04-28 17:19:39 +10:00
Randy Mackay b255c7b370 AP_NavEKF: add setOrigin 2017-04-22 10:37:31 +09:00
Andrew Tridgell 9f3c2cb704 AP_NavEKF2: allow access to quaternion for each instance 2017-04-16 14:01:36 +10:00
Jacob Walser 646d68c76d AP_NavEKF2: Fix parameter metadata 2017-03-22 16:16:26 -07:00
priseborough 407a60e599 AP_NavEKF2: log correct GPS for replay 2017-03-13 11:31:51 +11:00
Michael du Breuil 8b69f1708e NavEKF2: Add optional check for GPS vertical accuracy before aligning the EKF 2017-02-22 11:53:42 -08:00
priseborough 1a7b5538e5 AP_NavEKF2: Enable simple heading fusion to be set for specific cores 2017-02-15 19:17:53 +00:00
priseborough 7ea37029b6 AP_NavEKF2: use standard unit descriptor for milliseconds 2017-01-27 16:57:42 +09:00
Dr.-Ing. Amilcar Do Carmo Lucas 715d094678 AP_NavEKF2: Correct display names, bitmask and units 2017-01-16 19:07:26 +00:00
Dr.-Ing. Amilcar Do Carmo Lucas 9389ec2274 AP_NavEKF2: fix parameter descriptions 2017-01-09 13:30:30 +09:00
Dr.-Ing. Amilcar Do Carmo Lucas d408d25f92 More spelling stuff 2017-01-06 10:57:39 -08:00
Dr.-Ing. Amilcar Do Carmo Lucas 8419045aea Spell in comments 2017-01-06 10:57:39 -08:00
priseborough 76106889d5 AP_NavEKF2: Prevent unwanted core switch on startup
Require primary core to be healthy for 10 seconds before starting selection logic
2016-12-13 01:18:28 +00:00
priseborough 14a0155f5e AP_NavEKF2: Allow threshold speed for range finder use to be adjusted 2016-12-09 21:17:28 +00:00
priseborough 665ba1c009 AP_NavEKF2: Fix bug in reporting of vertical position reset
Fixes a bug that allows the last reported reset time to to wind back and an out of date reset delta to be reported if a switch to a core that has previously been reset occurs.
Allows multiple consumers provided they access on the same frame.
2016-12-01 10:35:38 +09:00
priseborough 7f347e39dd AP_NavEKF2: Fix bug in reporting of horizontal position reset
Fixes a bug that allows the last reported reset time to to wind back and an out of date reset delta to be reported if a switch to a core that has previously been reset occurs.
Allows multiple consumers provided they access on the same frame.
2016-12-01 10:35:38 +09:00
priseborough 656d9bb2c4 AP_NavEKF2: Fix bug in reporting of yaw reset
Fixes a bug that allows the last reported reset time to to wind back and an out of date reset delta to be reported if a switch to a core that has previously been reset occurs.
Allows multiple consumers provided they access on the same frame
2016-12-01 10:35:38 +09:00
Randy Mackay 66a9093cd0 AP_NavEKF2: getRangeBeaconDebug returns false on failure to get beacon data 2016-11-30 17:56:51 +09:00
priseborough ef03a85cd3 AP_NavEKF2: add range beacon interface and fusion method 2016-11-30 17:56:43 +09:00
priseborough 0a177d04fd AP_NavEKF2: Simply core switch implementation
Functionally equivalent
2016-11-24 19:58:10 +09:00
priseborough 0df45703f1 AP_NavEKF2: Fix errors in position reset delta publishing 2016-11-24 19:57:47 +09:00
priseborough f6021c959d AP_NavEKF2: capture and publish vertical position reset deltas
Calculate the change in vertical position due to a internal EKF state reset or a EKF core switch
2016-11-24 19:57:45 +09:00
priseborough e62863f9a1 AP_NavEKF2: Reduce unnecessary EKF core switching
1) Do not switch to a core until its states have been updated.
2) Distinguish between mandated switches required for health failure and optional switches required due to innovation checks failing.
3) Apply hyseresis to innovation check levels
2016-11-24 19:57:41 +09:00
Andrew Tridgell 82365f8670 AP_NavEKF2: save some memory in the position offsets in EKF2
we don't need to copy that vector3f for every sample. A uint8_t does
the job
2016-10-27 17:09:06 +11:00
priseborough fd905c23e1 AP_NavEKF2: Add body position offset to optical flow interface 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 e0b8c54194 AP_NavEKF: Update GPS type parameter description 2016-10-10 14:49:18 +09:00
priseborough ab55991b33 AP_NavEKF2: Report position jumps due to lane switches
Also moves code required to update reset data due to lane switches into separate functionscto improve readability.
2016-10-10 11:56:14 +09:00
Francisco Ferreira 42cd8e9721 AP_NavEKF2: Handle yaw jumps due to core switches
Based on work from Paul Riseborough (priseborough)
2016-09-25 18:24:11 -07:00
Francisco Ferreira 8da22e441b Revert 3 commits about yaw reset core switch
Revert "AP_NavEKF2: Fix bug in published yaw reset value found during code review"
commit 175faf1e41.

Revert "AP_NavEKF2: use a struct for all yaw step class variables"
commit 77fad065d1.

Partially revert "AP_NavEKF2: Handle yaw jumps due to core switches"
commit 885bfd1b4e.
2016-09-25 18:24:11 -07:00
priseborough cb1d3c7ed2 AP_NavEKF2: Allow for terrain gradient when using range finder for height 2016-09-13 17:45:03 +09:00
priseborough 175faf1e41 AP_NavEKF2: Fix bug in published yaw reset value found during code review 2016-09-13 17:35:18 +09:00
priseborough 77fad065d1 AP_NavEKF2: use a struct for all yaw step class variables 2016-09-13 17:35:16 +09:00
priseborough 885bfd1b4e AP_NavEKF2: Handle yaw jumps due to core switches 2016-09-13 17:35:14 +09:00
Andrew Tridgell dd812cfc0c AP_NavEKF2: added getPrimaryCoreIMUIndex()
needed for correct AHRS gyro estimate
2016-09-05 12:53:53 +10:00
priseborough e6f36f04db AP_NavEKF2: Enable automatic use of range finder height
The EK2_RNG_USE_HGT parameter sets the height (expressed as a percentage of the maximum range of the range finder as set by the RNGFND_MAX_CM parameter) below which the range finder will be used as the primary height source when the vehicle is moving slowly.

When using a height reference other than GPS, the height datum can drift due to air pressure changes if using baro, or due to terrain height changes if using range finder as the primary height source. To ensure that a consistent height datum is available when switching between altitude sources, the WGS-84 height estimate of the EKF's local positi norigin is updated using a
single state Bayes estimator,

If rngfinder or gps height data is lost whilst being used, there will be a fall-back to baro data.
2016-08-08 10:56:44 +09:00
priseborough 230ba2700f AP_NavEKF2: fix documentation errors 2016-07-19 12:16:50 +10:00
priseborough b1717649b1 AP_NavEKF2: remove combined NED local position interface 2016-07-19 12:16:49 +10:00
priseborough e374ec634d AP_NavEKF2: Add separate horizontal/vertical local position interfaces 2016-07-19 12:16:49 +10:00
priseborough e6592186fc AP_NavEKF2: Tuning update
Slow down magnetic field learning
2016-07-10 08:21:18 +10:00
priseborough a49c16d63c AP_NavEKF2: Update output filter tuning
Updated tuning to take advantage of corrected time delta dtEkfAvg
2016-07-09 15:57:36 +10:00