Commit Graph

485 Commits

Author SHA1 Message Date
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
dbe860152d AP_NavEKF2: tight types on constants
This saves ~200 bytes on at stm32 build, at the expense of people having
to watch the type carefully when increasing the values
2018-03-01 20:27:19 +09: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
Pierre Kancir
171e80d8dc AP_NavEKF2: only report terrain estimator innovations with valid rng value 2017-12-18 22:51:46 +00:00
Andrew Tridgell
4d4e66d825 AP_NavEKF2: 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
priseborough
3b32d583a9 AP_NavEKF2: Fix delta time use error 2017-12-12 11:39:38 +11:00
priseborough
440d361aff AP_NavEKF2: Limit range of delta times 2017-12-12 11:39:38 +11:00
Andrew Tridgell
97729a12f0 AP_NavEKF2: don't run IMU updates until buffer fills
this prevents us using bad initial data multiple times. It fixes a bug
where the IMU may pause during EK2 initialisation
2017-12-12 11:39:38 +11:00
Andrew Tridgell
4019a167a9 AP_NavEKF2: fixed inverted function setInhibitGpsVertVelUse() 2017-11-29 09:47:14 +09:00
Samuel Tabor
1b4705242c AP_NavEKF2: print reason for EKF2 arming failure when no GPS is available 2017-11-20 13:53:31 +09: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
Lucas De Marchi
3c04f4e4d1 AP_NavEKF2: add static create method 2017-09-26 03:01:21 +01:00
Peter Barker
1e83ef3c44 AP_NavEKF2: use rangefinder backend accessors 2017-08-15 18:30:45 +01:00
priseborough
f2f3067326 AP_NavEKF2: Add interface to control GPS vertical velocity use 2017-08-10 19:49:45 +10:00
Michael du Breuil
dffa3d3b40 AP_NavEKF2: Fix possible compass nullptr dereference 2017-08-01 15:25:05 +01:00
priseborough
ac568bae53 AP_NavEKF2: Initialise EKF origin height to field elevation
Enables copters to set bit position 2 in the EK2_OGN_HGT_MASK parameter without having a large jump in reported local position height.
2017-07-17 02:22:02 +01: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
Randy Mackay
7e7f78d4b5 AP_NavEKF2: final mag reset at 2.5m 2017-07-08 08:39:43 +09:00
priseborough
c69c5440a0 AP_NavEKF2: Fix calculation of predicted LOS rate in terrain estimator 2017-06-26 14:58:06 +01:00
priseborough
ce8e935896 AP_NavEKF2: Fix terrain estimator innovation consistency check 2017-06-20 02:08:56 +01:00
priseborough
b7e6e6f95f AP_NavEKF2: Fix bug in flow fusion for terrain estimation
Also remove unused class variables
2017-06-20 02:08:56 +01:00
Andrew Tridgell
cbffc29f0b AP_NavEKF2: use AHRS likely flying state
this sets inFlight when AHRS has indicated flying for 5s
2017-06-20 09:44:44 +10:00
priseborough
647db728ce AP_NavEKF2: Improve is flying check for non fly forward vehicles
Will enable use of EK3_MAG_TYPE = 0 for coptersAP_NavEKF2:
2017-06-19 06:09:07 +10: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
fd25450632 AP_NavEKF2: Ensure reported local height = global height - origin height 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
priseborough
1985dcd366 AP_NavEKF2: Fix bug in declination fusion 2017-06-03 15:16:25 +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
priseborough
2d4eee0cce AP_NavEKF2: documentation update 2017-05-01 14:24:55 +10: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
priseborough
e48f46c98b AP_NavEKF2: Add monitoring of average EKF time step 2017-04-29 11:03:44 +10:00
priseborough
082f429da3 AP_NavEKF2: 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
ee5c032f27 AP_NavEKF2: added recording of timing statistics 2017-04-28 17:19:39 +10:00
priseborough
596b20eb07 AP_NavEKF2: close perf counter when doing early return 2017-04-27 20:14:21 +10:00
priseborough
88469ce80c AP_NavEKF2: Reset covariance if bad mag fusion update 2017-04-27 20:14:21 +10:00
Andrew Tridgell
d799bacd7d AP_NavEKF2: 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
Andrew Tridgell
9f3c2cb704 AP_NavEKF2: allow access to quaternion for each instance 2017-04-16 14:01:36 +10:00
Jonathan Challinger
c53125f3b5 AP_NavEKF2: apply height innovation floor only when barometer is in use 2017-03-24 14:42:36 -07:00
Jacob Walser
646d68c76d AP_NavEKF2: Fix parameter metadata 2017-03-22 16:16:26 -07:00
priseborough
44fa82d58c AP_NavEKF2: Reference correct derivation 2017-03-13 11:31:51 +11:00
priseborough
407a60e599 AP_NavEKF2: log correct GPS for replay 2017-03-13 11:31:51 +11:00
priseborough
8c46d4316b AP_NavEKF2: 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
priseborough
b7c4945000 AP_NavEKF2: 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
563be389ee AP_NavEKF2: only use downward facing rangefinder 2017-02-27 15:18:10 +09: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
Jacob Walser
e7a34b0fb3 AP_NavEKF2: Add set_baro_alt_noise method 2017-02-21 11:26:14 +11:00
priseborough
1a7b5538e5 AP_NavEKF2: Enable simple heading fusion to be set for specific cores 2017-02-15 19:17:53 +00:00
priseborough
a1d41edc4e AP_NavEKF2: 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
5cd403c0b9 AP_NavEKF2: prevent NaN if RNGFND_GNDCLEAR is zero 2017-02-15 07:04:38 +09:00
priseborough
a63eac8073 AP_NavEKF2: Add missing perf_end 2017-01-27 16:57:42 +09: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
Francisco Ferreira
c6875e1756
AP_NavEKF2: remove editor information wrongly added in d408d25 2017-01-09 16:16:14 +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
murata
653030b038 AP_NavEKF2: Changed if statements to switch statement.
AP_NavEKF2: Change indentation.
2016-12-26 10:15:55 +09:00
priseborough
6dc7d25fde AP_NavEKF2: 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
fe69d9a0ea AP_NavEKF2: remove duplicate include 2016-12-18 10:28:04 +11:00
priseborough
a8f3a374e2 AP_NavEKF2: replace sqrt function calls with sqrtf
Prevents compiler errors and un-wanted use of double precision types
2016-12-18 10:28:04 +11: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
69f3c83c20 AP_NavEKF2: Don't use speed switch criteria when speed estimate is invalid
Prevent unwanted switches from range finder to Baro height aiding due to triggering of the speed threshold
2016-12-09 21:17: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
murata
25e47cce6b AP_NavEKF2: Changed sqrt method to sqrtf method.
AP_NavEKF2: Changed sqrt method to sqrtf method.
2016-12-07 15:41:41 +00:00
Randy Mackay
fc5f4c20cd AP_NavEKF2: remove redundant check of beacon nullptr
thanks to muramura for spotting this
2016-12-01 14:53:26 +09: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
0ec8f0932a AP_NavEKF2: Prevent output of NaN's in range beacon debug output
This can happen if this accessor function is called before the EKF states are initialised
2016-11-30 17:56:50 +09:00
Randy Mackay
fbecda7eeb AP_NavEKF2: change order of variable initialisation
No functional change, this modifies the init order to match the declaration order.
2016-11-30 17:56:49 +09:00
Randy Mackay
82854953e7 AP_NavEKF2: minor comment fix 2016-11-30 17:56:48 +09:00
Randy Mackay
14a73e499a AP_NavEKF2: initialise two range beacon structures 2016-11-30 17:56:47 +09:00
priseborough
2ee8250807 AP_NavEKF2: Changes from code review by @muramura 2016-11-30 17:56:46 +09:00
Randy Mackay
1f4606e48a AP_NavEKF2: protect against null beacon 2016-11-30 17:56:45 +09:00
Randy Mackay
51ccfca31c AP_NavEKF2: fix format of statustext for beacon init 2016-11-30 17:56:44 +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
7d48054e6f AP_NavEKF2: Group GPS innovation tests when compiling error score 2016-11-24 19:58:07 +09:00
Randy Mackay
e9ea06bd10 AP_NavEKF2: minor comment fix 2016-11-24 19:58:03 +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
murata
c808ee2f49 Global: To nullptr from NULL.
RC_Channel: To nullptr from NULL.

AC_Fence: To nullptr from NULL.

AC_Avoidance: To nullptr from NULL.

AC_PrecLand: To nullptr from NULL.

DataFlash: To nullptr from NULL.

SITL: To nullptr from NULL.

GCS_MAVLink: To nullptr from NULL.

DataFlash: To nullptr from NULL.

AP_Compass: To nullptr from NULL.

Global: To nullptr from NULL.

Global: To nullptr from NULL.
2016-11-02 16:04:47 -02: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
c93c3d54f3 AP_NavEKF2: Don't correct for zero IMU position offset
The IMU offset correction involves a significant number of floating point operations and most users will leave the offset parameter at zero.
2016-10-27 14:54:44 +11:00
priseborough
1890bbdafa AP_NavEKF2: Don't correct GPS for zero position offset 2016-10-27 14:54:44 +11:00
priseborough
f025c96e63 AP_NavEKF2: Don't correct range finder for zero position offset 2016-10-27 14:54:43 +11:00
priseborough
9a0ce1d5eb AP_NavEKF2: Don't correct flow sensor for zero position offset 2016-10-27 14:54:43 +11:00
priseborough
b40016db62 AP_NavEKF2: Fix documentation errors 2016-10-27 14:54:43 +11:00