Commit Graph

540 Commits

Author SHA1 Message Date
Paul Riseborough 211fdde755 AP_NavEKF2: Don't use geomag data when user specifies declination 2020-05-11 18:15:40 +10:00
Randy Mackay 59adb2adda AP_NavEKF2: getLLH fix when no GPS available 2020-05-11 18:15:40 +10:00
Andrew Tridgell 234ae5bc93 AP_NavEKF2: make mag variance reporting consistent
logged scaled variance should match the value used in MAVLink
EKF_STATUS_REPORT
2020-05-11 18:15:40 +10:00
Andrew Tridgell 2603b15354 AP_NavEKF2: fixed use of antenna position when switching GPS primary
when GPS primary switches we were using a position which had not been
corrected for antenna offset. This was used for calculating the reset
for sensor change.

This fixes that (trivial fix) and also fixes a similar issue on
position reset
2020-05-11 18:15:39 +10:00
Randy Mackay 18af8b0b7f AP_NavEKF2: initialise pre-arm failure message 2020-02-05 10:51:29 +11:00
Mark Whitehorn 32a5ea13b4 AP_NavEKF2: add prearm failure message for null core pointer 2020-02-05 10:51:29 +11:00
Randy Mackay acbdcbb430 AP_NavEKF2: suppress ekf fail-to-set-origin if core disabled 2020-02-05 10:43:36 +11:00
Randy Mackay 607f57e4d1 AP_NavEKF2: reduce EK2_HRT_FILT max to 30 2020-02-05 10:16:44 +11:00
Paul Riseborough e868b9dc35 AP_NavEKF2: Add missing vertical position derivative calculation
Use a third order order complementary filter to estimate the rate of change of vertical position output.
2020-02-05 10:16:44 +11:00
Andrew Tridgell 161154bf05 AP_NavEKF2: fixed build
broken by recent common variable change
2020-02-05 10:10:37 +11:00
Andrew Tridgell da7dc71195 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
2020-02-05 10:10:20 +11:00
Peter Barker 5e9aaca8df AP_NavEKF2: initialise Kfusion stack variable to fix compilation
This fixes the compilation, as previous patches have done.
2020-02-05 10:09:20 +11:00
Andrew Tridgell de12430977 AP_NavEKF2: fixed build with g++ 9.1
this is a false positive, but the cost of clearing this array is low,
and it saves a much more complex fix
2020-02-05 10:09:20 +11:00
Andrew Tridgell 5d67618968 AP_NavEKF2: added comment (review request) 2020-02-05 10:09:20 +11:00
Andrew Tridgell 164813bcc2 AP_NavEKF2: moved some of the intermediate vars to the stack
this keeps stack frames below 1k, while giving faster access to the
variables and saving more memory
2020-02-05 10:09:20 +11:00
Andrew Tridgell 6ffffff8c6 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
2020-02-05 10:09:00 +11:00
Andrew Tridgell a48d97c307 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
2020-02-05 10:08:10 +11:00
Andrew Tridgell 04827d229c AP_NavEKF2: don't use WMM tables unless we have a compass scale factor set 2019-12-09 13:18:01 +11:00
Andrew Tridgell 43df0022e1 use common variables for EKF 2019-10-06 10:58:07 +11:00
Andrew Tridgell 9ad9fe42bc 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-06 10:58:07 +11:00
Andrew Tridgell 46628b4401 AP_NavEKF2: make it easy to do EK2 timing tests
for future benchmarking
2019-10-06 10:58:07 +11:00
Andrew Tridgell fb7ddd9b9d AP_NavEKF2: change optimisation from -O3 to -O2 2019-10-02 12:03:47 +10:00
Peter Barker 784edac137 AP_NavEKF2: correct return of empty prearm string 2019-09-22 21:09:11 +10:00
Randy Mackay 94a52b3525 EKF2: RNG_USE_HGT param only used when ALT_SOURCE = rangefinder 2019-09-10 18:44:52 +10:00
Michael du Breuil a4d10b2e86 AP_NavEKF2: Allow the GPS to be responsible for logging 2019-09-10 09:09:17 +10:00
Peter Barker c8fac758ee AP_NavEKF2: use timing logging from AP_NavEKF 2019-09-03 09:28:37 +10:00
Andrew Tridgell 414d3eb670 AP_NavEKF2: don't fuse GPS when EK2_GPS_TYPE=3
when using a vision position system, the user may have vision derived
GPS data coming in using GPS_INPUT msgs. We should not fuse these when
EK2_GPS_TYPE=3 as we end up fusing both vision data and GPS data,
which does not work with the current EK2 code

This change makes it possible to run EK2 and EK3 in parallel in a
Vicon, wityh EK2 using VISION_POSITION_ESTIMATE data and EK3 using
GPS_INPUT (with yaw) data.
2019-08-26 12:27:31 +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 098701ec79 AP_NavEKF2: fixed baro innovation gate when on ground with AIDING_NONE
when on the ground without a position source we would disable the
innovation gate for the barometer. This meant that a single (or small
number of) really bad baro readings would be fused into the EKF,
causing it to destabilise

Fixes #11903
2019-07-30 08:23:21 +10:00
Andrew Tridgell e7163afe06 AP_NavEKF2: review fixes
thanks Paul!
2019-07-29 10:08:22 +10:00
Andrew Tridgell c57b25b4c9 AP_NavEKF2: ensure that EKF origin stays in sync on all cores
this prevents the EKF origin on different cores from being initialised
to different values. A common value is stored in the frontend and used
by a core if it doesn't have an origin
2019-07-29 10:08:22 +10:00
Andrew Tridgell a01faa2f00 AP_NavEKF2: use origin lat for earth rates
home may not yet be set when this code is run, so using home may be
invalid
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
Siddharth Purohit 1527a5b97c AP_NavEKF2: do logging for 3rd EKF core 2019-07-23 12:34:38 +10:00
Andrew Tridgell 2427440e13 AP_NavEKF2: origin handling fixes from Francisco 2019-07-11 06:40:55 +10:00
Andrew Tridgell e8d9a1fae9 AP_NavEKF2: don't allow height datum reset when not on ground 2019-07-07 19:20:32 +10:00
Andrew Tridgell f5fd38aef2 AP_NavEKF2: set terrainState to zero on height datum reset 2019-07-07 19:20:32 +10:00
Andrew Tridgell 9372073f63 AP_NavEKF2: continuously update gpsGoodToAlign
use it to determine how to handle a height datum reset
2019-07-07 19:20:32 +10:00
Andrew Tridgell 20ebb2500b AP_NavEKF2: ensure that both AMSL and relative alt are correct after a reset
this forces the EKF origin to the GPS alt on a height datum reset if
we have GPS lock. If we don't do this then the reported AMSL alt will
drift over time away from the GPS alt when we reset while on the
ground
2019-07-07 19:20:32 +10:00
Andrew Tridgell ddef40fa3d AP_NavEKF2: don't use disabled gyros in opticalflow takeoff detection 2019-07-07 19:03:01 +10:00
Andrew Tridgell 1c4c5a6850 AP_NavEKF2: learn gyro biases for inactive gyros
this allows us to learn the gyro biases each lane would need if it had
to switch to another gyro due to a sensor failure. This prevents a
sudden change in gyro bias on IMU failure
2019-07-07 19:03:01 +10:00
Peter Barker 6a0a466f42 AP_NavEKF2: factor out and logging functions, reuse for 2nd core 2019-07-06 19:05:51 +10:00
Peter Barker 5175d23cc1 AP_NavEKF2: move logging in from AP_Logger 2019-07-06 19:05:51 +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
Peter Barker 82df167ad4 AP_NavEKF2: use beacon singleton 2019-07-01 07:20:58 +09:00
Michael du Breuil f04e47fc17 AP_NavEKF2: Reduce scope of AP_Baro.h 2019-06-27 14:56:21 +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