Commit Graph

644 Commits

Author SHA1 Message Date
Randy Mackay
7470bc9994 AP_NavEKF3: CorrectGPSForAntennaOffset made const
also reduce scope of call to slightly reduce CPU load
2020-04-21 10:21:23 +10:00
Peter Barker
87108b86c8 AP_NavEKF3: add documentation for XKFM message 2020-04-21 09:48:43 +10:00
Randy Mackay
22c9081c83 AP_NavEKF3: minor comment fix 2020-04-15 19:35:30 +09:00
Peter Barker
d19f8db06f AP_NavEKF3: rename APMrover2 to Rover 2020-04-14 09:50:34 +09:00
Andrew Tridgell
1f8cd830ea AP_NavEKF3: fixed use of tabs 2020-04-11 21:14:31 +10:00
Paul Riseborough
f68f355852 AP_NavEKF3: Fix timestamp wrapping 2020-04-11 21:14:31 +10:00
Paul Riseborough
33ab1a7b15 AP_NavEKF3: Ensure yaw fusion commences when starting from rest 2020-04-11 21:14:31 +10:00
Paul Riseborough
a3725e2581 AP_NavEKF3: Fix bug in calculation of rotation order 2020-04-11 21:14:31 +10:00
Paul Riseborough
eeac0a05b9 AP_NavEKF3: Improvements to on ground movement check
Reduce sensitivity and log test ratios.
Reduce base logging rate to 5Hz and log when status changes.
2020-04-11 21:14:31 +10:00
Paul Riseborough
ebb8bb4f6f AP_NavEKF3: Enable use of yaw fusion before external yaw sensor starts 2020-04-11 21:14:31 +10:00
Andrew Tridgell
3ae0b0d446 AP_NavEKF3: added using_external_yaw() method
needed by AHRS for attitudes_consistent() check
2020-04-11 21:14:31 +10:00
Andrew Tridgell
6f04fae4a0 AP_NavEKF3: added fallback to mag option with external yaw
this allows for a magnetometer to be used as a fallback yaw source in
flight when using an external yaw source such as a GPS. The
magnetometer bias is learned while the GPS yaw is available and
fallback is only done if the mag yaw and GPS yaw are consistent when
fallback is enabled

This also learns the Z gyro bias until first yaw alignment when
MAG_CAL is EXTERNAL_YAW_FALLBACK. This prevents large gyro bias
building while waiting for GPS lock
2020-04-11 21:14:31 +10:00
Andrew Tridgell
a3100251a8 AP_NavEKF3: use enum class for EK3_MAG_CAL values
and use effective_magCal() everywhere for consistency
2020-04-11 21:14:31 +10:00
Andrew Tridgell
be674fc36c AP_NavEKF3: make mag variance reporting consistent
logged scaled variance should match the value used in MAVLink
EKF_STATUS_REPORT
2020-04-06 17:30:29 +10:00
Peter Barker
609b66a053 AP_NavEKF3: rename struct log_NKF2a to log_XKF2 2020-03-31 10:25:59 +11:00
Daniel Magree
b3ff81648b Nav_EKF3: varInnovBodyVel assigned the innovation covariance, rather than inverse 2020-03-25 21:52:49 +11:00
Peter Barker
4c19eb4bab AP_NavEKF3: use compass reference rather than repeatedly asking AHRS for it 2020-03-13 08:26:18 +11:00
Andrew Tridgell
772438f3ed 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-02-19 18:12:54 +11:00
Siddharth Purohit
545331024f AP_NavEKF3: Primary compass is always at serial number 0 2020-02-19 13:59:53 +09:00
Peter Hall
47e3fda8e9 AP_NavEKF3: add initalized flag and change to uint32_t 2020-02-19 06:45:07 +11:00
Peter Barker
e289020332 AP_NavEKF3: stop taking ahrs in constructor 2020-01-21 11:53:18 +11:00
Peter Hall
dd75609599 AP_NavEKF3: get_time_flying in vehicle 2020-01-14 22:34:37 -07:00
Peter Barker
03cca68c5a AP_NavEKF3: use instance number when logging rather than multiple message IDs 2019-12-17 12:22:07 +11:00
Peter Barker
9ed37e4486 AP_NavEKF3: make send_status_report const 2019-12-11 07:54:41 +09:00
Peter Barker
4431d01230 AP_NavEKF3: stop relying on the presence of a RangeFinder 2019-12-11 08:09:01 +11:00
Peter Barker
b055eb8889 AP_NavEKF3: use instance # when logging EKF core timings 2019-12-06 12:52:03 +09:00
Andrew Tridgell
c6aad9b1ec AP_NavEKF3: don't use WMM tables unless we have a compass scale factor set 2019-12-03 20:48:23 +11:00
Peter Barker
fe8599d6d7 AP_NavEKF3: adjust for renaming of RangeFinder files 2019-11-12 07:14:37 +08:00
Peter Barker
11b372a986 AP_NavEKF3: use enum-class for RangeFinder Status 2019-11-09 08:01:53 +11:00
Randy Mackay
f24afbcf4b AP_NavEKF3: initialise pre-arm failure message 2019-10-31 09:51:27 +08:00
Mark Whitehorn
3e21ef1389 AP_NavEKF3: add prearm failure message for null core pointer 2019-10-29 11:59:29 +08:00
Randy Mackay
b4a8691a9e AP_NavEKF3: remove wheel encoder update limit 2019-10-22 07:15:48 +08:00
Randy Mackay
63309c6925 AP_NavEKF3: suppress ekf fail-to-set-origin if core disabled 2019-10-22 07:15:48 +08:00
Jaaaky
54f8e1137e 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.
2019-10-20 07:34:35 +11:00
Randy Mackay
5baed38266 AP_NavEKF3: reduce EK3_HRT_FILT max to 30 2019-10-18 11:15:25 +09:00
Paul Riseborough
5b1d9ed868 AP_NavEKF3: Add missing vertical position derivative calculation 2019-10-18 11:15:25 +09:00
Andrew Tridgell
c2067d5bc2 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
2019-10-15 11:06:11 +11:00
Andrew Tridgell
3995db49a4 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
2019-10-01 15:39:03 +10:00
Andrew Tridgell
0e3a27f74f AP_NavEKF3: change optimisation from -O3 to -O2 2019-09-28 08:57:26 +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
05d62c62bb 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:06:36 +10:00
Andrew Tridgell
c6f43e9700 AP_NavEKF3: fixed use of old irqsave() API 2019-09-21 15:36:47 +10:00
Peter Barker
1c187d8feb AP_NavEKF3: correct return of empty prearm string 2019-09-19 08:47:47 +09: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
Andrew Tridgell
2208689893 AP_NavEKF3: don't use disabled gyros in opticalflow takeoff detection 2019-07-07 19:03:01 +10:00
Andrew Tridgell
209bca162c AP_NavEKF3: added inactive bias learning
this allows for biases on inactive IMUs to be learned so that an IMU
switch within an EKF lane does not cause a jump in the IMU data
2019-07-07 19:03:01 +10:00
Peter Barker
ce45baa034 AP_NavEKF3: factor out and logging functions, reuse for 2nd core 2019-07-06 19:05:51 +10:00
Peter Barker
f3f364de26 AP_NavEKF3: move logging in from AP_Logger 2019-07-06 19:05:51 +10:00
Andrew Tridgell
5151416080 AP_NavEKF3: 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
ef2589738d AP_NavEKF3: use beacon singleton 2019-07-01 07:20:58 +09:00
Michael du Breuil
b624f6f008 AP_NavEKF3: Reduce scope of AP_Baro.h 2019-06-27 14:56:21 +10:00
Michael du Breuil
be74b631fe AP_NavEKF3: Fix AP_GPS.h include 2019-06-18 10:02:05 +10:00
Andrew Tridgell
60831c2878 AP_NavEKF3: 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
Peter Barker
dce472745e AP_NavEKF3: take EAS2TAS from AHRS rather than airspeed 2019-06-06 12:44:36 +10:00
Jaaaky
f21e4d833c AP_NavEKF3: Fix GPS < 3D empty PreArm: msg-as EKF2 2019-05-20 16:57:57 +10:00
Randy Mackay
0a5d6a430a AP_NavEKF3: accept optical flow data at up to 50hz 2019-05-11 16:23:57 +09:00
Andrew Tridgell
e4f6ffe719 AP_NavEKF3: 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
fe3b29a088 AP_NavEKF3: Allow checking all cores for health 2019-04-09 10:53:25 +10:00
Pierre Kancir
b3a1c9c90c AP_NavEKF3: use get_distance_NE instead of location_diff 2019-04-08 08:00:52 -07:00
Paul Riseborough
9aaa0cd2e0 AP_NavEKF3: Fix typo in comment 2019-04-02 10:51:12 +11:00
Paul Riseborough
b7e0a2345c AP_NavEKF3: Fix indexing error
Caused by copy and paste from AP_NavEKF2 which useds index 5 for vertical velocity. EKF3  should use index 6.
2019-04-02 10:51:12 +11:00
Paul Riseborough
0d3e1a7d23 AP_NavEKF3: flow use parameter improvements 2019-04-02 10:51:12 +11:00
Paul Riseborough
d3e9281846 AP_NavEKF3: 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
35c82ef67f AP_NavEKF3: Improve optical flow height estimation 2019-04-02 10:51:12 +11:00
Paul Riseborough
b848e231c7 AP_NavEKF3: Add parameter to control how optical flow data is used 2019-04-02 10:51:12 +11:00
Mark Whitehorn
3c432cf25c AP_NavEKF3: add getQuaternionBodyToNED 2019-03-29 10:58:00 +11:00
Tom Pittenger
17ee20af3f AP_NavEKF3: rename dataflash to logger 2019-03-28 16:40:57 +11:00
Dr.-Ing. Amilcar do Carmo Lucas
390e0fa601 AP_NavEKF3: replace location_offset() and get_distance() function calls with Location object member function calls
This allows removing duplicated code
2019-02-28 11:44:09 +11:00
Arjun Vinod
f382a657bd AP_NavEKF3: fixed typos 2019-02-26 08:33:39 +11:00
Tom Pittenger
55377b234f AP_NavEKF3: remove HAL_CPU_CLASS_150 check, 150 is already a minimum requirement 2019-02-17 13:00:00 -08:00
Tom Pittenger
8a6a39b590 AP_NavEKF3: unify singleton naming to _singleton and get_singleton() 2019-02-10 19:09:58 -07:00
Andrew Tridgell
39ffef1f08 AP_NavEKF3: fixed EKF compass switching
when we had 3 compasses the lack of the 'break' meant when we switched
compass in flight we would always switch back instantly to the one
that we had just rejected.
2019-02-09 13:04:52 +11: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
Peter Barker
0d4475f443 AP_NavEKF3: adjust for Location_Class and Location unification 2019-01-16 11:45:29 +11:00
Peter Barker
dd8da7321c AP_NavEKF3: adjust for location flags being moved out of union 2019-01-16 11:45:29 +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
Pierre Kancir
340429fbbb AP_NavEKF3: pass by const reference when needed 2018-12-20 09:05:01 +09:00
Michael du Breuil
25ef5fed82 AP_NavEKF3: Suppress clearing non-trival type warning 2018-10-30 16:17:03 -07:00
Andrew Tridgell
de58fb4637 AP_NavEKF3: support in-flight compass learning 2018-10-24 07:25:42 +10:00
Peter Barker
560f17a570 AP_NavEKF3: use union to alias array and struct access to states
This avoids creating two pointers of different types to the same memory.

Having two pointers to the same memory can lead to the compiler
optimising code such that a write to one pointer is rearranged to be
either before or after a read from the other pointer depending on
which is deemed faster - not a good outcome.
2018-10-19 08:46:43 +11:00
Peter Barker
27e3a89158 AP_NavEKF3: correct compilation when running MATH_CHECK_INDEXES 2018-10-19 08:46:43 +11:00
Peter Barker
281fad53c2 AP_NavEKF3: always set EKF control limits, even with no cores 2018-10-09 10:47:38 +11:00
Peter Barker
b68a91d171 AP_NavEKF3: remove default clause in setAidingMode
All aiding modes should be covered in the switch statement; adding the
default clause squelches a potentially useful compiler warning
2018-10-03 17:49:43 +01:00
Michael du Breuil
1991f223ac AP_NavEKF3: Fix roundoff, and missing offset handling of getLLH 2018-09-21 00:18:49 +01:00
Peter Barker
be9235a581 AP_NavEKF3: 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
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
Andrew Tridgell
ac40a20c02 AP_NavEKF3: fill in gps_quality_good flag 2018-07-14 17:49:52 +10:00
Peter Barker
6bf5ffdb6d AP_NavEKF3: use compass singleton for logging 2018-07-04 20:11:27 +01:00
murata
4d5e258b19 AP_NavEKF3: Delete unused definitions 2018-06-11 09:11:44 +09:00
murata
f0a6cd5846 AP_NavEKF3: Clarify the message 2018-06-04 11:32:15 +09:00
Andrew Tridgell
553abda91c AP_NavEKF3: use single precision ceilf() 2018-05-07 11:43:23 +10:00
Andrew Tridgell
4869dd0ae4 AP_NavEKF3: send airspeed variance over mavlink 2018-04-30 15:41:32 +10:00
Peter Barker
901ba0034c AP_NavEKF3: do not pass GPS into Log_Write_GPS; it uses singleton 2018-04-18 13:50:55 +09:00
Peter Barker
a0d874baa2 AP_NavEKF3: const accessors 2018-04-07 09:56:18 +09:00
Peter Barker
6791808ac6 AP_NavEKF3: remove unneeded initialisations
AP_NavEKF3 should never be allocated in uninitialised memory
2018-04-07 09:54:21 +09:00
Peter Barker
d38ff1dd2c AP_NavEKF3: initialise EKF3 constants in declaration not constructor 2018-04-07 09:54:21 +09:00
Pierre Kancir
2b2c1e2d78 AP_NavEKF3: only use bcn EKF is the alignement as been completed 2018-04-03 09:55:13 +09:00
Pierre Kancir
44a21bc8ac EKF3: correct acos to acosf 2018-04-03 09:54:45 +09:00
Pierre Kancir
48c5a9b9c5 AP_NavEKF3: style change in BCN mesurements 2018-04-03 09:54:43 +09:00
Pierre Kancir
4d2f2a2aad AP_NavEKF3: correct flag in case of GPS disable 2018-04-03 09:54:41 +09:00
priseborough
5785523a0d AP_NavEKF3: Clarify definition for gps_glitching flag 2018-03-27 20:28:56 +09:00
Peter Barker
55b8a2288e AP_NavEKF3: use ins singleton 2018-03-16 00:37:35 -07:00
Peter Barker
7b1a906c4e AP_NavEKF3: use baro singleton 2018-03-08 21:20:05 -08:00
Paul Riseborough
6a1055389d AP_NavEKF3: Fix origin height estimator indexing bug
EKF3 should use index 9 to access vertical position states
2018-02-21 17:04:30 +10:00
Tatsuya Yamaguchi
aef9fa4a63 AP_NavEKF3: delete \n from the log using gcs().send_text 2018-02-02 09:13:54 +09:00
murata
6a87840c7a AP_NavEKF3: Change the if statement to a switch statement. 2018-01-28 22:20:08 +00:00
bugobliterator
ea2a880d8a AP_NavEKF3: allocate from MEM_FAST region 2018-01-15 11:46:02 +11:00
Peter Barker
5dc714bf5f AP_NavEKF3: use GPS singleton 2017-12-27 00:58:02 +00:00
Pierre Kancir
be96a27fa8 AP_NavEKF3: only report terrain estimator innovations with valid rng value 2017-12-18 22:51:46 +00:00
Andrew Tridgell
c13eaf0c7f AP_NavEKF3: removed create() method for objects
See discussion here:

  https://github.com/ArduPilot/ardupilot/issues/7331

we were getting some uninitialised variables. While it only showed up in
AP_SbusOut, it means we can't be sure it won't happen on other objects,
so safest to remove the approach

Thanks to assistance from Lucas, Peter and Francisco
2017-12-14 08:12:28 +11:00
Andrew Tridgell
6b30c9213a AP_NavEKF3: delay startup until IMU buffer is filled
this prevents a vulnerability where the initial IMU data is processed
26 times (where 26 is the IMU buffer length)
2017-12-12 11:39:38 +11:00
Andrew Tridgell
2c6593e35e AP_NavEKF3: fixed inverted function setInhibitGpsVertVelUse() 2017-11-29 09:47:14 +09:00
priseborough
c96bc54254 AP_NavEKF3: correctly use wheel odometry speed for pitched rovers 2017-10-31 08:11:05 +09:00
priseborough
ee6b43aabf AP_NavEKF3: Fix bugs in use of wheel encoder data
Found by pavloblindnology
2017-10-28 10:58:01 +09:00
Lucas De Marchi
bd6145af6d AP_NavEKF3: add static create method 2017-09-26 03:01:21 +01:00
Peter Barker
63440800fc AP_NavEKF3: use rangefinder backend accessors 2017-08-15 18:30:45 +01:00
priseborough
2310cb6d19 AP_NavEKF3: Enable external control over use of GPS vertical velocity 2017-08-10 19:49:45 +10:00
Michael du Breuil
efe70c8d3a AP_NavEKF3: Fix possible compass nullptr dereference 2017-08-01 15:25:05 +01:00
priseborough
db7c8439c6 AP_NavEKF3: Fix bug in wheel odometry timestamp correction 2017-07-28 12:48:38 +09:00
priseborough
c7f6d52065 AP_NavEKF3: Add wheel encoder odometry
Uses the existing body frame odometry observation model.
Handles each sensored wheel as a separate sensor.
2017-07-27 16:52:27 +09:00
priseborough
cbe8f97489 AP_NavEKF3: rename struct used for velocity odometry observations
Do this so we can add other odometry observation types.
2017-07-27 16:52:26 +09:00
priseborough
08a3f55c90 AP_NavEKF3: Fix error in scaling of observation error 2017-07-27 16:52:25 +09:00
priseborough
593437ca95 AP_NavEKF3: Add tuning of visual odometry observation error
Also adjust default values based on replay analysis.
2017-07-27 16:52:25 +09:00
priseborough
58d58b4eac AP_NavEKF3: Initialise EKF origin height to field elevation
Enables copters to set bit position 2 in the EK3_OGN_HGT_MASK parameter without having a large jump in reported local position height.
2017-07-17 02:22:02 +01:00
priseborough
0827b13feb AP_NavEKF3: 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
93e09c51d3 AP_NavEKF3: eliminate GCS_MAVLINK::send_statustext_all 2017-07-11 23:53:53 +01:00
Randy Mackay
d64b2fcbf0 AP_NavEKF3: final mag reset at 2.5m 2017-07-08 08:39:43 +09:00
priseborough
9d0fa09d39 AP_NavEKF3: Fix calculation of predicted LOS rate in terrain estimator 2017-06-26 14:58:06 +01:00
priseborough
a4d18696a7 AP_NavEKF3: Improve variable names and documentation
Also remove unnecessary calculation of innov * gain
2017-06-23 00:43:58 +01:00
priseborough
368983ed5a AP_NavEKF3: Clean up aiding mode logic using switch statements 2017-06-23 00:43:58 +01:00
priseborough
2a9eceaf10 AP_NavEKF3: Fix bugs causing height drift when using range beacons 2017-06-23 00:43:58 +01:00
priseborough
7659e9c31f AP_NavEKF3: Improve checking of time delay validity when setting buffers
This change means that provided the GPS_DELAY_MS parameters are set for each GPS receiver attached, the EKF will not have to wait for the configuration of each receiver to be determined before it can start.
This significantly reduces start-up times when the delay parameters are set.
2017-06-21 11:44:45 +01:00
priseborough
7d63286088 AP_NavEKF3: update to match AP_GPS interface change 2017-06-21 11:44:45 +01:00
priseborough
06d40a7901 AP_NavEKF3: Fix terrain estimator innovation consistency check 2017-06-20 02:08:56 +01:00
priseborough
284fc0f3c5 AP_NavEKF3: Fix bug in flow fusion for terrain estimation
Also remove unused class variables
2017-06-20 02:08:56 +01:00
Andrew Tridgell
a1508b58c1 AP_NavEKF3: use AHRS likely flying state
this sets inFlight when AHRS has indicated flying for 5s
2017-06-20 09:44:44 +10:00
priseborough
edee8396ba AP_NavEKF3: Improve in-flight check for non fly forward vehicles
This will enable the EK3_MAG_TYPE 0 option to be used for multirotors
2017-06-19 06:09:07 +10:00
Dr.-Ing. Amilcar Do Carmo Lucas
6a01c65197 AP_NavEKF3: Fix long description of EK3_OGN_HGT_MASK parameter (NFC) 2017-06-16 12:05:20 +01:00
priseborough
49ec2b4032 AP_NavEKF3: Change default value of EK3_OGN_HGT_MASK
Turn off by default.
Update parameter description.
2017-06-14 12:44:41 +01:00
priseborough
6d14cf0ab8 AP_NavEKF3: Ensure reported local height = global height - origin height 2017-06-14 12:44:41 +01:00
priseborough
3ae7998f51 AP_NavEKF3: Allow reporting of origin height for specified instance 2017-06-14 12:44:41 +01:00
priseborough
e58ba8044d AP_NavEKF3: Improve protection for badly conditioned dVel bias covariances
If variance falls below desired minimum, set state noise to a larger value.
If variance drops below safe value, set to desired minimum and reset off-diagonals to zero.
2017-06-14 12:44:41 +01:00
priseborough
bf963f8b65 AP_NavEKF3: Raise lower limit on del vel bias state variances
This is required to prevent co-variance matrix errors due to long periods without movement causing height divergence.
2017-06-14 12:44:41 +01:00
priseborough
628d140319 AP_NavEKF3: Make target covariance time step larger
The target covariance time step has been increased from 10 to 12 msec to improve conditioning of the covariance prediction calculation.
2017-06-14 12:44:41 +01:00
priseborough
2b97d0f5c9 AP_NavEKF3: Add public accessor for state variances 2017-06-14 12:44:41 +01:00
priseborough
9f97cbfc3b AP_NavEKF3: Revert auto-code to original form and remove micro optimisations
To eliminate the possibility of editing errors, revert the covariance prediction auto-code to the original auto-code without the replacement fo the /2 and /4 operations. The compiler optimisations are able to correctly handle the /2 and /4 operations.

Also use local variables for intermediate covariance calculations. The use of class variables for these small arrays was unnecessary.
2017-06-14 12:44:41 +01:00
priseborough
f38fccd57c AP_NavEKF3: Prevent possible race condition re-zeroing state variances 2017-06-14 12:44:41 +01:00
priseborough
7adaea6019 AP_NavEKF3: Improve partitioning and efficiency of the covariance prediction
This patch ensures that covariance matrix entries for inactive states are always set to zero.
It also halves the number of copy operations from the updated to stored matrix.
2017-06-14 12:44:41 +01:00
priseborough
a1c117360c AP_NavEKF3: Ensure Kalman gain calculatons respect deactivated states
All Kalman gain calculations now explicity set gains for deactivated states to zero.
Previous use of loops to set gains to zero have been replaced with more efficient memset operations.
2017-06-14 12:44:41 +01:00
priseborough
5058405f8c AP_NavEKF3: add gyro bias state inhibit and rework index limit calculation
Inhibiting gyro bias estimation during the initial tilt alignment speeds alignment.
The calculation of the maxmum state index required has been modified so that it can handle all combinations of inhibited states.
Limiting the maximum state index accessed by all EKF operations result in significant processing reductions when higher index states are not being used.
2017-06-14 12:44:41 +01:00
priseborough
0cba133a1e AP_NavEKF3: Fix initialisation of state inhibit flags 2017-06-14 12:44:41 +01:00
priseborough
9da3caca47 AP_NavEKF3: 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
c1eb9fb9c3 AP_NavEKF3: Spell in comments 2017-05-18 09:29:55 +09:00
Dr.-Ing. Amilcar Do Carmo Lucas
d3a57b5965 AP_NavEKF3: 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
9cb068d3f4 AP_NavEKF3: Spell in coments 2017-05-16 20:29:16 +09:00
murata
46cba2c970 libraries: Delete the setting value for specific editor. 2017-05-11 13:18:41 -07:00
Dr.-Ing. Amilcar Do Carmo Lucas
23b7f1e645 AP_NavEKF3: Improve comments, typos 2017-05-03 08:45:01 +09:00
priseborough
4a898037e9 AP_NavEKF3: documentation update 2017-05-01 14:24:55 +10:00
Andrew Tridgell
a04aff7a7d AP_NavEKF3: 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
priseborough
0bf50fd56f AP_NavEKF3: Add monitoring of average EKF time step 2017-04-29 11:03:44 +10:00
priseborough
3ce81967ae AP_NavEKF3: Improve calculation and use of average EKF time step 2017-04-29 11:03:44 +10:00
priseborough
7abf9997e6 AP_NavEKF3: Correctly initialise dtIMUavg time step and apply LPF 2017-04-29 11:03:44 +10:00
priseborough
1301b9797a AP_NavEKF3: Fix solution validity reporting bug
Fixes bug that causes relative position status to report as false when using optical flow and using range finder as the primary height sensor.
2017-04-28 17:19:23 +01:00
Andrew Tridgell
adb281cd4e AP_NavEKF3: added timing statistics logging 2017-04-28 17:19:39 +10:00
priseborough
f208986d43 AP_NavEKF3: Reset covariance if bad mag fusion update 2017-04-27 20:14:21 +10:00
Andrew Tridgell
18b66f9eed AP_NavEKF3: fixed reset of coviariance matrix 2017-04-27 18:33:25 +10:00
Randy Mackay
b255c7b370 AP_NavEKF: add setOrigin 2017-04-22 10:37:31 +09:00
priseborough
fb7104f4e3 AP_NavEKF3: add fusion method for body frame odometry data 2017-04-19 11:04:40 +09:00
Andrew Tridgell
248773a7c8 AP_NavEKF3: allow access to quaternion for each instance 2017-04-16 14:01:36 +10:00
priseborough
8250fe4943 AP_NavEKF3: fix documentation derivation references 2017-04-10 15:47:35 +09:00
priseborough
06c073e448 AP_NavEKF3: Update tilt alignment check 2017-04-05 20:16:16 +10:00
Jonathan Challinger
c7a73e84d6 AP_NavEKF3: apply height innovation floor only when barometer is in use 2017-03-24 14:42:36 -07:00
priseborough
56a9e2c462 AP_NavEKF3: Reference correct derivation 2017-03-13 11:31:51 +11:00
priseborough
18927395d7 AP_NavEKF3: log correct GPS for replay 2017-03-13 11:31:51 +11:00
priseborough
01551a4423 AP_NavEKF3: handle position jump caused by change in GPS receiver
If the GPS receiver selection changes and we are using GPS for height, the vertical position will be reset to the new GPS height measurement.
correct output observer history when doing a GPS height reset
2017-03-13 11:31:51 +11:00
Randy Mackay
3e039a6ba4 AP_NavEKF3: minor formatting fixes
No functional change
2017-03-06 18:40:18 +11:00
Randy Mackay
a80c0a231d AP_NavEKF3: attempt to set-up every core
previously we would only call setup_core for the 2nd core if the first had been setup successfully
2017-03-06 18:40:18 +11:00
priseborough
7a8783f35e AP_NavEKF3: Fix bug preventing reset to GPS
This fixes a bug that prevented the reset to the GPS position occurring if GPS velocity observations were still passing innovation consistency checks.
2017-03-06 17:11:39 +11:00
Randy Mackay
3f6a734a71 AP_NavEKF3: only use downward facing rangefinder 2017-02-27 15:18:11 +09:00
Michael du Breuil
1de198883d AP_NavEKF3: Check gps vertical accuracy for aligning the GPS 2017-02-22 11:53:42 -08:00
Jacob Walser
ac1e1b9460 AP_NavEKF3: Add set_baro_alt_noise method 2017-02-21 11:26:14 +11:00
Francisco Ferreira
23f959b92f
AP_NavEKF3: fix copied parameter descriptions 2017-02-15 19:20:04 +00:00
priseborough
de7a679534 AP_NavEKF3: Enable simple heading fusion to be set for specific cores 2017-02-15 19:09:45 +00:00
priseborough
ccb952ba31 AP_NavEKF3: Use the same mag fusion method for all cores
The original reason for using a different method for the second core is no longer valid.
2017-02-15 19:01:10 +00:00
priseborough
e399f57ffa AP_NavEKF3: prevent NaN if RNGFND_GNDCLEAR is zero 2017-02-15 07:04:38 +09:00
priseborough
784fa6fed8 AP_NavEKF3: fix compiler error 2017-01-27 16:57:42 +09:00
priseborough
2c36da2b21 AP_NavEKF3: relocate perf monitor to count all three mag components 2017-01-27 16:57:42 +09:00
priseborough
4d958952f6 AP_NavEKF3: use standard unit descriptor for milliseconds 2017-01-27 16:57:42 +09:00
priseborough
b5ba1d0346 AP_NavEKF3: protect against large delay values returned by the GPS library 2017-01-27 16:57:42 +09:00
priseborough
4540faf6af AP_NavEKF3: Improve waiting for GPS configuration
Do not time out and provide an escalating series of messages. We may need to adjust the time thresholds used for escalation.
Do not wait if the EKF is not using the GPS.
2017-01-27 16:57:42 +09:00
priseborough
52e8f687d9 AP_NavEKF3: fix logic bug introduced by magnetometer use changes 2017-01-27 16:57:42 +09:00
priseborough
a133d55b6d AP_NavEKF3: Allow copters to fly with magnetometers disabled
Copter operation without a magnetometer is limited to constant position and relative position modes only (no GPS or range beacon fusion permitted)
Copter optical flow operation without a magnetometer is permitted.
The ability of planes to takeoff/launch without a magnetometer and align the yaw using the GPS velocity is retained.
2017-01-27 16:57:42 +09:00
priseborough
2e5ac40ef6 AP_NavEKF3: remove unnecessary stdio includes 2017-01-27 16:57:42 +09:00
priseborough
8688d1ddac AP_NavEKF3: Improve range finder selection logic
Fixes bug that could leave it locked out of range finder use.
2017-01-27 16:57:42 +09:00
priseborough
7e8f3fca53 AP_NavEKF3: Address review comments
Removes a leftover debug printf statement.
Fixes documentation errors.
Replace remaining fmaxf function calls with Ardupilot MAX function
2017-01-27 16:57:42 +09:00
priseborough
b723966b8d AP_NavEKF2: Add protection against bad GPS time delay values
Prevent bad values for GPS time delay pushing the GPS time stamp outside the range of IMU data contained in the buffer. If this occurs it can prevent the GPS measurements from being fused and cause loss of navigation.
2017-01-27 16:57:42 +09:00
priseborough
59ee074560 AP_NavEKF3: Remove EKF2 names 2017-01-27 16:57:42 +09:00
priseborough
b862f0d7ad AP_NavEKF3: Enable use of GPS delay value from returned by the driver
Use the time delay returned by the GPS driver.
Wait long enough for the GPS configuration to be determined, but time out after 30 seconds and warn the user that a default value for time delay will be used.
2017-01-27 16:57:42 +09:00
priseborough
69a47d7522 AP_NavEKF3: Improve reporting of buffer allocation 2017-01-27 16:57:42 +09:00
priseborough
ceb42225fd AP_NavEKF3: Ensure enough time to fill buffers when starting filter 2017-01-27 16:57:42 +09:00
priseborough
a8fd1d8bcd AP_NavEKF3: fix potential time-stamping bug
Use a consistent time reference
2017-01-27 16:57:42 +09:00
priseborough
8d1733cee6 AP_NavEKF3: Use FIR filtered airspeed
Switch to use of an airspeed reading averaged across the raw sensor readings. since the last update.
This avoids use of the IIR which requires a larger time delay compensation and violates the assumption of uncorrelated noise.
The time delay parameter has been reduced to compensate for the removal of the airspeed IIR filtering.
2017-01-27 16:57:42 +09:00
priseborough
9261c34097 AP_NavEKF3: Update default GPS delay
This value is a compromise between what works best for a Ublox 6 which is around 200msec delay and the more recent 7 and 8 series receivers that are around 120msec delay.
2017-01-27 16:57:42 +09:00
priseborough
ed5039823f AP_NavEKF3: Adapt sensor buffer lengths
Adapt the lengths of the IMU and observations buffers on startup to the specified time delays and update rates.
This does require the EKF to be re-started if time delays are changed.
2017-01-27 16:57:42 +09:00
priseborough
2cc48f78a7 AP_NavEKF3: Update range beacon fusion
Add innovation consistency check to alignment filter and publish alignment filter status data
2017-01-27 16:57:42 +09:00
priseborough
92b8c33b19 AP_NavEKF3: publish 3-state range beacon estimator states 2017-01-27 16:57:42 +09:00
priseborough
7c53573a0c AP_NavEKF3: Allow range beacon use with intermittent GPS 2017-01-27 16:57:42 +09:00
priseborough
e5e4883c72 AP_NavEKF3: Fix GPS use inhibit interface documentation 2017-01-27 16:57:42 +09:00
priseborough
c7e1828238 AP_NavEKF3: improve variable name 2017-01-27 16:57:42 +09:00
Dr.-Ing. Amilcar Do Carmo Lucas
cae557fb4c AP_NavEKF3: Correct display names, bitmask and units 2017-01-16 19:07:26 +00:00
Dr.-Ing. Amilcar Do Carmo Lucas
195e32c2fc AP_NavEKF3: fix some parameter descriptions 2017-01-09 13:30:24 +09:00
Dr.-Ing. Amilcar Do Carmo Lucas
d408d25f92 More spelling stuff 2017-01-06 10:57:39 -08:00
priseborough
71eb46dd04 AP_NavEKF3: Fix bug in loss of aiding fallback
Fixes a bug introduced by the introduction of range beacon fusion to the fallback test.
2016-12-21 18:08:39 +11:00
priseborough
f1c05ee320 AP_NavEKF3: Allow accel switch on bias uncertainty to be adjusted 2016-12-19 08:07:15 +11:00
priseborough
7d4a50f483 AP_NavEKF3: Prevent unwanted core switch on startup
Require primary core to be healthy for 10 seconds before starting selection logic
2016-12-19 08:07:14 +11:00
priseborough
cd6fd0ea45 AP_NavEKF3: Improvements to range finder selection logic
Enables the horizontal speed at which we switch from range finder to alternate to be adjusted.
Does not switch from range finder to alternate based on speed when speed estimate is invalid.
2016-12-19 08:07:14 +11:00
priseborough
7202acc1b5 AP_NavEKF3: Default EKF3 to off
Will revert this and set EKF2 to off by default after testing is completed on all platform types
2016-12-19 08:07:09 +11:00
priseborough
39969e7d8e AP_NavEKF3: added EKF3 for EKF experimentation
AP_NavEKF3: Implement same maths as PX4/ecl EKF

Replace attitude vector states with quaternions
Remove gyro scale factor states
Add XY accel delta velocity bias estimation
Initial tuning
Add GPS body frame offset compensation

AP_NavEKF3: Fix bugs and consolidate aiding switch logic

Switching in and out of aiding modes was being performed in more than one place and was using two variables.
The reversion out of GPS mode due to prolonged loss of GPS was not working.
This consolidates the logic and ensures that PV_AidingMode is only changed by the setAidingMode function.

AP_NavEKF3: prevent multiple fusion mode changes per filter update

AP_NavEKF3: Update tuning defaults

AP_NavEKF3: Fix bug causing switching in and out of aiding
If the GPS receiver was disconnected and no data received, then then the gpsGoodToAlign check did not get a chance to run and becasue it was previously true the EKF would switch back into aiding.
This prevents this by ensuring that gpsGoodToAlign defaults to false when the check is not being performed.
An additional check has also been dded to ensure that there is GPS data to fuse before we declare ready to use GPS.

AP_NavEKF3: Fix bug preventing planes recovering from bad magnetometers
This bug created a race condition whereby if the EKF had to reset the yaw to the GPS ground course to recover from a bad magnetometer, the new heading could be over-written by the bad magnetic heading when the plane reached the height for the scheduled reset.

AP_NavEKF3: Improve switch-over to backup magnetometer
When switching over to a back up magnetometer, ensure that the earth field estimate are reset. Otherwise mag earth field estimates due to the previous failed mag could cause data from the new mag to be rejected.

AP_NavEKF3: enable automatic use of range finder height

AP_NavEKF3: Fix bug in handling of invalid range data

AP_NavEKF3: Fix height drift on ground using range finder without GPSAP_NavEKF3:

AP_NavEKF3: Handle yaw jumps due to core switches

AP_NavEKF3: Enable simultaneous GPS and optical flow use

AP_NavEKF3: fix console status reporting

AP_NavEKF3: send messages to mavlink instead of console

This allows the GCS to better handle the display of messages to the user.

AP_NavEKF3: replace deprecated function call

AP_NavEKF3: Compensate for sensor body frame offsets

AP_NavEKF3: Fix bug in median filter code

AP_NavEKF3: save some memory in the position offsets in EKF3

We don't need to copy that vector3f for every sample. A uint8_t does the job

AP_NavEKF3: Add fusion of range beacon data

AP_NavEKF3: Bring up to date with EKF2

AP_NavEKF3: Misc range beacon updates

AP_NavEKF3: Add mising accessors

AP_NavEKF3: remove duplicate include

AP_NavEKF3: Prevent NaN's when accessing range beacon debug data

AP_NavEKF3: Update range beacon naming

AP_NavEKF3: updates

AP_NavEKF3: miscellaneous changes

AP_NavEKF3: misc updates

AP_NavEKF3: misc range beacons updates

AP_NavEKF3: add missing rover default param
2016-12-19 08:06:47 +11:00