Commit Graph

225 Commits

Author SHA1 Message Date
Andrew Tridgell
cba3d1358b AP_NavEKF3: fixed memory corruption on push before init
this fixes a bug that happens with VISION_SPEED_ESTIMATE from a
companion computer, which may come in before the EKF buffers are
allocated. That causes a push to an uninitialised ringbuffer which
triggers memory corruption

found using the new memory guard system
2021-02-05 19:09:03 +11:00
Andrew Tridgell
350275690c AP_NavEKF3: only fuse airspeed if healthy 2021-01-06 09:33:48 +11:00
Dr.-Ing. Amilcar do Carmo Lucas
8291cbe604 AP_NavEKF3: fix vertical flyaways when rangefinder stops providing data 2021-01-06 09:33:47 +11:00
Andrew Tridgell
f8ef56be1b AP_NavEKF3: apply min GPS accuracy at measurement point
this fixes an issue a RTK GPS gives 1cm horizontal and vertical
accuracy and that causes the variances to get too small
2020-08-25 12:39:11 +10:00
Andrew Tridgell
65e9159d0f AP_NavEKF3: fixes for new compass API 2020-05-11 19:47:23 +10:00
Paul Riseborough
c04b31d9c0 AP_NavEKF3: Don't use geomag data when user specifies declination 2020-05-11 18:15:40 +10:00
Randy Mackay
0da8f39fd6 AP_NavEKF3: getLLH fix when no GPS available 2020-05-11 18:15:40 +10:00
Andrew Tridgell
4f7450dde9 AP_NavEKF3: 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
d4c6f462bf AP_NavEKF3: 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
Andrew Tridgell
c7a39648d4 AP_NavEKF3: don't use WMM tables unless we have a compass scale factor set 2020-02-05 10:51:31 +11:00
Randy Mackay
b8fe1e6f41 AP_NavEKF3: initialise pre-arm failure message 2020-02-05 10:51:29 +11:00
Mark Whitehorn
8b2b7444d3 AP_NavEKF3: add prearm failure message for null core pointer 2020-02-05 10:51:29 +11:00
Randy Mackay
931fb2f986 AP_NavEKF3: remove wheel encoder update limit 2020-02-05 10:43:36 +11:00
Randy Mackay
843e1190ac AP_NavEKF3: suppress ekf fail-to-set-origin if core disabled 2020-02-05 10:43:36 +11:00
Jaaaky
fc5e1362a9 AP_NavEKF3: added EK3_MAG_EF_LIM parameter
Adapted from EKF2 implementation as of commits
3835d2613, e9ed3540f and df4fc0fff
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.
2020-02-05 10:43:36 +11:00
Randy Mackay
15ca5f5511 AP_NavEKF3: reduce EK3_HRT_FILT max to 30 2020-02-05 10:16:44 +11:00
Paul Riseborough
c5e3f7df7f AP_NavEKF3: Add missing vertical position derivative calculation 2020-02-05 10:16:44 +11:00
Andrew Tridgell
f24de4e2bc AP_NavEKF3: set a min yaw accuracy from GPS of 5 degrees
GPS modules tend to be rather optimistic about their yaw accuracy. By
setting a min or 5 degrees we prevent the user constantly getting
warnings about yaw innovations
2020-02-05 10:13:53 +11:00
Andrew Tridgell
b1e0299a0f AP_NavEKF3: 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
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
43df0022e1 use common variables for EKF 2019-10-06 10:58:07 +11:00
Andrew Tridgell
a49cc87dae AP_NavEKF3: change optimisation from -O3 to -O2 2019-10-02 12:03:53 +10:00
Peter Barker
6693610c7a AP_NavEKF3: correct return of empty prearm string 2019-09-22 21:09:04 +10:00
Andrew Tridgell
372eca7dad AP_NavEKF3: fixed use of uninitialised variable in EKF3 mag fusion
not all elements of H_MAG are initialised, but they are used, as found
by valgrind
2019-09-22 21:07:38 +10:00
Andrew Tridgell
fae2e44eac AP_NavEKF3: reset inhibitMagStates on in-flight yaw reset
this is needed to prevent the next ConstrainVariances() from zeroing
the variances, which leads to very slow learning of mag states
2019-09-11 14:22:18 +10:00
Randy Mackay
0e1a2efb7c EKF3: RNG_USE_HGT param only used when ALT_SOURCE = rangefinder 2019-09-10 18:44:52 +10:00
Michael du Breuil
9a7d64e8fc AP_NavEKF3: Allow the GPS to be responsible for logging 2019-09-10 09:09:17 +10:00
Peter Barker
7ea449076f AP_NavEKF3: use timing logging from AP_NavEKF 2019-09-03 09:28:37 +10:00
Peter Barker
61ed6e07eb AP_NavEKF3: shorten EKF3 initialisation send-text string
Now:
pbarker@bluebottle:~/rc/ardupilot(master)$ echo -n "EKF3 IMU1 buffers IMU=11 OBS=4 OF=10, dt=0.0120" | wc
      0       7      47
pbarker@bluebottle:~/rc/ardupilot(master)$

Closes #11952
2019-08-05 19:50:32 +10:00
Andrew Tridgell
fc65e04ef2 AP_NavEKF3: 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
04944fa6ce AP_NavEKF3: review fixes
thanks Paul!
2019-07-29 10:08:22 +10:00
Andrew Tridgell
451fe840ee AP_NavEKF3: 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
0fcb2037e1 AP_NavEKF3: 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
a3411efdb5 AP_NavEKF3: 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
3818d8ecda AP_NavEKF3: 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
db9f7c3dd5 AP_NavEKF3: do logging for 3rd EKF core 2019-07-23 12:34:38 +10:00
priseborough
209a32b8b9 AP_NavEKF3: Fix bug in use of external 321 yaw to align 2019-07-13 11:05:57 +10:00
priseborough
122f214416 AP_NavEKF3: Don't allow mag to interfere with use of external yaw sensor 2019-07-13 11:05:57 +10:00
Andrew Tridgell
b56914b879 AP_NavEKF3: use GPS yaw if available and enabled
this allows a suitable GPS to be used as an external yaw source
2019-07-13 11:05:57 +10:00
priseborough
0c4f92d4c1 AP_NavEKF3: Add control logic to use external yaw sensor 2019-07-13 11:05:57 +10:00
priseborough
71d358803a AP_NavEKF3: Fix yaw sensor alignment status reporting 2019-07-13 11:05:57 +10:00
priseborough
977a7b68ed AP_NavEKF3: Add push to buffer for external yaw sensor data 2019-07-13 11:05:57 +10:00
priseborough
0a971c5181 AP_NavEKF3: Add function to reset yaw to external measurement 2019-07-13 11:05:57 +10:00
Andrew Tridgell
62575a194c AP_NavEKF3: Add data buffers for yaw sensor 2019-07-13 11:05:57 +10:00
priseborough
87c7649d09 AP_NavEKF3: Add interface for yaw angle measurements 2019-07-13 11:05:57 +10:00
Andrew Tridgell
634db441f8 AP_NavEKF3: origin handling fixes from Francisco 2019-07-11 06:40:55 +10:00
Andrew Tridgell
92783bccfa AP_NavEKF3: don't allow height datum reset when not on ground 2019-07-07 19:20:32 +10:00
Andrew Tridgell
3f9e48951b AP_NavEKF3: set terrainState to zero on height datum reset 2019-07-07 19:20:32 +10:00
Andrew Tridgell
f3fc910abe AP_NavEKF3: continuously update gpsGoodToAlign
use it to determine how to handle a height datum reset
2019-07-07 19:20:32 +10:00
Andrew Tridgell
b9a5794671 AP_NavEKF3: 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