Commit Graph

86 Commits

Author SHA1 Message Date
Randy Mackay 4cadaa5194 AP_NavEKF3: readyToUseOptFlow, Beacon, ExtNav check source 2020-11-20 16:43:44 +09:00
Randy Mackay faed58a027 AP_NavEKF3: integrate Source for yaw 2020-11-20 16:43:44 +09:00
Randy Mackay 8931e50166 AP_NavEKF3: integrate Source for alt 2020-11-20 16:43:44 +09:00
Randy Mackay c21d58ebea AP_NavEKF3: integrate Source for position 2020-11-20 16:43:44 +09:00
Paul Riseborough aaf558f593 AP_NavEKF3: Add velocity innovation check to use of EKF-GSF yaw
Only apply to non fly forward vehicle, eg copters, because magnitude of velocity innovation produced by plane launches is TBD.
2020-11-16 16:01:13 +11:00
Paul Riseborough db86a5acc8 AP_NavEKF3: Don't update yaw estimator with bad GPS 2020-11-16 16:01:13 +11:00
Andrew Tridgell 9b81c5a1e0 AP_NavEKF3: use dal reference in EKF backends
saves a bit of flash space
2020-11-10 16:15:45 +11:00
Andrew Tridgell 096aab9388 AP_NavEKF3: convert to use AP_DAL for new replay structure
Co-authored-by: Peter Barker <pbarker@barker.dropbear.id.au>
2020-11-10 16:15:45 +11:00
Randy Mackay b726630ef4 AP_NavEKF3: pos timeout or glitch does not reset vel if fusing successfully
vel is not reset if GPS velocity, optical flow, visual odometry or wheel
encoders are successfully being fused
2020-10-28 19:06:53 +11:00
Randy Mackay 7b898ee001 AP_NavEKF3: minor comment and format fixes 2020-10-28 12:17:40 +09:00
Paul Riseborough 64a3d8fe4e AP_NavEKF3: Update documentation 2020-10-26 11:03:50 +11:00
Paul Riseborough 90e928c32a AP_NavEKF3: Re-tune tilt alignment check
New tilt error variance estimate is more accurate and larger than before.
2020-10-26 11:03:50 +11:00
Paul Riseborough 16ae75a681 AP_NavEKF3: Consolidate and log tilt error variance calculation 2020-10-26 11:03:50 +11:00
Andrew Tridgell fcccdcc936 AP_NavEKF3: fixed bug in external yaw for fixed wing
when we are on the ground we should not chang to AID_NONE if we have
an external yaw source

this fixes an EKF3 error loop on the ground found by Michael
2020-10-24 13:50:33 +11:00
Randy Mackay e4056086e0 AP_NavEKF3: minor format and spelling fixes 2020-10-21 13:54:22 +09:00
Randy Mackay 7398529f6b AP_NavEKF3: minor format fix 2020-09-28 20:57:39 +09:00
Andrew Tridgell 8a4b0f858a AP_NavEKF3: reset body mag variances at key points
we need to reset the body mag variances if we change sensors or if we
are starting 3D fusion. When not doing 3D fusion we zero the
variances, so they must be initialised again when we restart
fusion. This fixes a bug in handling the variances on a 2nd flight
2020-09-20 09:25:57 +10:00
Andrew Tridgell 1f21d72c79 AP_NavEKF3: fixed init of earth state mag variances
we were starting with zero variance for X and Y earth states, it
should start with sq(magNoise)
2020-09-20 09:25:57 +10:00
Randy Mackay 886a7d44a7 AP_NavEKF3: allow switch to ExtNav from optflow 2020-08-24 16:52:34 +09:00
Randy Mackay 6bf2057712 AP_NavEKF3: minor formatting fixes 2020-08-21 13:18:58 +09:00
Randy Mackay 4c40d2ac3f AP_NavEKF3: readyToUseBodyOdm uses delayed imu and wheel encoder timestamps 2020-08-21 13:18:58 +09:00
chobits 7ad9e3548f AP_NavEKF3: make reset source variable local 2020-08-10 09:43:28 +09:00
Peter Barker 6b701ae3b3 AP_NavEKF3: correct includes 2020-08-07 19:20:07 +10:00
chobits 564244ce9a AP_NavEKF3: fix extnav vel reset 2020-07-17 14:13:06 +09:00
Paul Riseborough 24fccd5d87 AP_NavEKF3: Don't delay GPS use unnecessarily
Fixed wing should not wait for bias state convergence after in-flight yaw alignment
2020-07-07 15:33:58 +10:00
Paul Riseborough 9a4108f55e AP_NavEKF3: Simplify setting EK3_MAG_CAL
Don't require user to separately set EK3_MAG_CAL to fly without a magnetomer
2020-07-07 15:33:58 +10:00
Paul Riseborough 21ea5d5039 AP_NavEKF3: Require GSF yaw history for reset when not using a yaw sensor 2020-07-07 15:33:58 +10:00
Paul Riseborough 354b551ef0 AP_NavEKF3: Handle repeated FW flight without magnetometer
The EKF can build up large yaw errors on ground so it is safer to stop using GPS and re-align after launch as per first launch.
2020-07-07 15:33:58 +10:00
Paul Riseborough 8ff6780323 AP_NavEKF3: Clarify distinct use cases for 'takeoff expected' 2020-07-07 15:33:58 +10:00
Paul Riseborough bcd23e1063 AP_NavEKF3: Fix one frame delay in processing yaw estimator velocity data 2020-07-07 15:33:58 +10:00
chobits c7817eaca1 AP_NavEKF3: support VISION_SPEED_ESTIMATE
Co-authored-by: Randy Mackay <rmackay9@yahoo.com>
2020-06-02 08:33:42 +09:00
Randy Mackay 5ad3611142 AP_NavEKF3: improve ext nav glitch handling
replaces extNavTimeout with posTimeout
replaces lastExtNavPassTime_ms with lastPosPassTime_ms
2020-05-15 11:23:07 +09:00
Paul Riseborough 318811210f AP_NavEKF3: Don't perform emergency yaw reset unless commanded externally
This limits the use of the reset to situations where it is a last ditch resort before a lane switch and failsafe.
This will limit false positives for general deployment, but still provide protection from fly-aways at the cost of some increase in reaction time.
2020-05-14 10:40:48 +10:00
Randy Mackay cbb25311bb AP_NavEKF3: setAidingMode uses lastExtNavPassTime_ms 2020-04-30 15:55:59 +09:00
priseborough c5e465aec9 AP_NavEKF3: add external nav system support
includes decoupling height source from use of external nav data
2020-04-30 15:55:59 +09:00
Randy Mackay 8a8271c2c7 AP_NavEKF3: minor format fixes 2020-04-24 09:43:23 +10:00
Paul Riseborough 7ba39c844c AP_NavEKF3: Split GSF yaw estimator processing
Separate prediction and correction steps are required to provide an up to
2020-04-24 09:43:23 +10:00
Paul Riseborough 53df8a0238 AP_NavEKF3: Fix timer wrapping bug 2020-04-24 09:43:23 +10:00
Paul Riseborough 12d639fc17 AP_NavEKF3: Misc changes arising from review
AP_NavEKF3: Fix typo in comment

AP_NavEKF3: Use uint32_t data type for msec timers

AP_NavEKF3: Misc msec timer fixes

Fix wrapping bug.
Use common timestamp.

AP_NavEKF3: Format fixes - remove tabs

AP_NavEKF3: Fix typing and wrap issue on time comparison
2020-04-24 09:43:23 +10:00
Paul Riseborough 4b3952bd15 AP_NavEKF3: Eliminate unnecessary function call 2020-04-24 09:43:23 +10:00
Paul Riseborough 863f989130 AP_NavEKF3: Fix integration of GPS yaw options
AP_NavEKF3: fix failure to arm with EK3_MAG_CAL = 7

AP_NavEKF3: Fix failure to arm when not using magnetometer

AP_NavEKF3: Reduce yaw drift when EK3_MAG_CAL = 7
2020-04-24 09:43:22 +10:00
Paul Riseborough 410b5825fb AP_NavEKF3: Enable use of EKF-GSF yaw estimate
AP_NavEKF3: Add emergency yaw reset using a Gussian Sum Filter estimate

AP_NavEKF3: Reduce default minimum GPS velocity noise for Copters

Enables fail-safe to be set with more sensitivity and improves tracking accuracy.
Origin values were set using typical GPS performance for receivers on sale 6 years ago. Receiver performance has improved since then.

AP_NavEKF3: Prevent constant mag anomaly yaw resets

Prevents constant magnetic anomaly induced resets that can be triggered when flying with vehicle generated magnetic interference.
Allows for two resets per takeoff. Allowance for two resets is required, becasue a large ground based magnetic yaw anomaly can cause a sufficiently large yaw innovation that two resets in close succession are required.

AP_NavEKF3: Add option to fly without magnetometer

AP_NavEKF3: Rework emergency yaw reset logic

Use a separate external accessor function to request the yaw reset.
Allow reset requests to remain active for a defined period of time.
Tidy up reset function to split out accuracy check.

AP_NavEKF3: Fix vulnerability to lane switch race condition

Prevents the situation where a lane switch results in a lane being selected that does not have the correct yaw. This can occur if the primary lane becomes unhealthy before the external failsafe monitor has time to react.

AP_NavEKF3: Fix EKF_MAG_CAL = 6 behaviours

Fix bug causing the yaw alignment to be performed at startup before the GSF had a valid estimate.
Fix bug causing emergency yaw message to be output for a normal reset.
Fix vulnerability to reported negative yaw variance.
Remove duplicate timer checks.

AP_NavEKF3: Update EK3_MAG_CAL documentation

AP_NavEKF3: Relax yaw gyro bias convergence check when not using mag

AP_NavEKF3: Reduce yaw drift in hover with no yaw sensor

Uses the GSF yaw estimate if available which is better than the EKF's own yaw when no yaw sensor is available.
2020-04-24 09:43:22 +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
Peter Hall 47e3fda8e9 AP_NavEKF3: add initalized flag and change to uint32_t 2020-02-19 06:45:07 +11: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
priseborough 122f214416 AP_NavEKF3: Don't allow mag to interfere with use of external yaw sensor 2019-07-13 11:05:57 +10:00