Commit Graph

438 Commits

Author SHA1 Message Date
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
priseborough 13ca62b1c7 AP_NavEKF2: Correct velocity and position outputs for IMU offset
This can improve position hold performance where it is not practical to have the IMU located at the centroid.
Although this enables the effect of IMU position offsets to be corrected, users will still need to be instructed to place the IMU as close to the vehicle c.g. as practical as correcting for large offsets makes the velocity estimates noisy.
2016-10-27 14:54:43 +11:00
priseborough 21dcf42c27 AP_NavEKF2: Add missing documentation 2016-10-27 14:54:43 +11:00
priseborough 8922861359 AP_NavEKF2: Correct optical flow data for sensor position offset
Correction requires the body rates averaged across the flow sensor sampling interval. This data has been added to the sensor buffer.
The body rate data from the flow sensor driver does not contain the Z component, so an equivalent value sampled from the navigation IMU has been used instead.
The variable omegaAcrossFlowTime has been moved out of the class and into the only function that uses it.
2016-10-27 14:54:43 +11:00
priseborough 16f021c466 AP_NavEKF2: Correct range finder data for body frame position offset 2016-10-27 14:54:43 +11:00
priseborough e884e9cc6e AP_NavEKF2: Correct GPS data for antenna body frame offset 2016-10-27 14:54:43 +11:00
priseborough 064a106808 AP_NavEKF2: Get IMU accelerometer body position offset data 2016-10-27 14:54:42 +11:00
priseborough 397033b7c3 AP_NavEKF2: Add flow sensor body position offset to data buffer 2016-10-27 14:54:42 +11:00
priseborough 92c086b40e AP_NavEKF2: Add rangefinder body position offset to data buffer 2016-10-27 14:54:42 +11:00
priseborough 3148ad4623 AP_NavEKF2: Add GPS antenna position offset data to data buffer 2016-10-27 14:54:42 +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 9779511425 AP_NavEKF2: Fix bug in median filter code 2016-10-19 19:45:00 +09:00
Jonathan Challinger dac59cb5da AP_NavEKF2: use exact matrix for trim rotation 2016-10-13 10:02:14 +11:00
priseborough 5d09c78f34 AP_NavEKF2: Always perform optical flow takeoff check when receiving data
A specialised takeoff check is now always performed when we receive new flow data as the default behaviour is to try and use flow data whenever it is received, rather than limit its use to a use to a flow-only mode of operation that had to be selected via user parameter.
2016-10-10 14:49:48 +09:00
priseborough a75a383ef2 AP_NavEKF2: Update protection for out of focus flow data 2016-10-10 14:49:41 +09:00
priseborough 635826c056 AP_NavEKF2: Fix reporting of terrain estimator innovations
Terrain height is relevant whenever optical flow data is present
2016-10-10 14:49:35 +09:00
priseborough b0072b587c AP_NavEKF2: fix reporting of optical flow use status 2016-10-10 14:49:24 +09:00
priseborough ed9ecb28fb AP_NavEKF2: Enable entry into relative position mode on start-up 2016-10-10 14:49:21 +09:00
priseborough e0b8c54194 AP_NavEKF: Update GPS type parameter description 2016-10-10 14:49:18 +09:00
priseborough f9018fcc1b AP_NavEKF2: Enable simultaneous optical flow and GPS use
Enables simultaneous use of GPS and optical flow data with automatic fallback to relative position mode if GPS is lost and automatic switch-up to absolute position status if GPS gained/re-gained.
2016-10-10 14:49:02 +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
Randy Mackay 2ebb81b02f AP_NavEKF2: switching compass message to GCS downgraded to INFO 2016-09-21 21:42:44 +09:00
priseborough b6867e085d AP_NavEKF2: Don't report range finder variance on mavlink if not required 2016-09-21 10:41:21 +09:00
priseborough cb1d3c7ed2 AP_NavEKF2: Allow for terrain gradient when using range finder for height 2016-09-13 17:45:03 +09:00
priseborough 60d8adcca0 AP_NavEKF2: Fix height drift on ground using range finder without GPS 2016-09-13 17:44:59 +09:00
priseborough 8797714203 AP_NavEKF2: Fix bug in handling of invalid range finder data 2016-09-13 17:44:43 +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
Jonathan Challinger d1ecc63bf1 AP_NavEKF2: change priority of statustext messages 2016-07-29 13:19:51 +09:00
Andrew Tridgell 567d5cdbe6 AP_NavEKF2: use mavlink messages not printf for state change notifications 2016-07-19 12:16:51 +10:00
priseborough bd7bf21475 AP_NavEKF2: Speed improve switch-over to backup magnetometer
When switching over to a back up magnetometer, ensure that the earth field estimate are reset. other wise mag earth field estimates due to the previous failed mag could cause data from the new mag to be rejected.
2016-07-19 12:16:50 +10:00
priseborough e34cdc6666 AP_NavEKF2: 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.
2016-07-19 12:16:50 +10:00
priseborough e2b8807260 AP_NavEKF2: 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.
2016-07-19 12:16:50 +10:00
priseborough fcc07b5560 AP_NavEKF2: Prevent multiple aiding mode changes per update 2016-07-19 12:16:50 +10:00
priseborough f4f347fb75 AP_NavEKF2: add missing parenthesis and console message 2016-07-19 12:16:50 +10:00
priseborough 9a23152ee4 AP_NavEKF2: 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.
2016-07-19 12:16:50 +10:00
priseborough 230ba2700f AP_NavEKF2: fix documentation errors 2016-07-19 12:16:50 +10:00
priseborough 341d070db8 AP_NavEKF2: Separate filter status update and get functions
The filter status logic calculations were being repeated every time the get function was called.
The logic is now updated once per filter update step and a separate get function added
2016-07-19 12:16:49 +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 04e8726d8a AP_NavEKF2: relax bias convergence check
Enables bias convergence check to pass within 30 seconds when vehicle is static.
2016-07-19 12:16:48 +10:00
priseborough 280395afa1 AP_NavEKF2: Don't declare ready to do aiding unless gyro bias is learned 2016-07-19 12:16:48 +10:00