Commit Graph

770 Commits

Author SHA1 Message Date
Peter Barker 1e17278bda AP_NavEKF3: add an option_is_enabled method 2024-11-12 12:20:44 +11:00
Peter Barker 44375f27e1 AP_NavEKF3: add enumeration to document EKF SolutionStatus
this isn't used for anything but documenting the solution status field, which can be used in the Wiki and in various log analysis tools
2024-11-05 08:59:42 +09:00
Peter Barker d8b109683a AP_NavEKF3: initialise variables as part of declaration 2024-10-15 10:45:59 +11:00
Peter Barker 8edcb4b8d3 AP_NavEKF3: clarify wind direction descriptions 2024-10-08 20:57:36 +11:00
Thomas Watson 8e5ee61b02 AP_NavEKF3: derivation: don't generate unused equations
The code is left in for the future when they might be used.
2024-10-01 09:28:54 +10:00
Thomas Watson f9fa2565c4 AP_NavEKF3: document provenance of tilt error variance equations
This is also from the older version of the generator.

Note that as documented, some of the equations have been removed and
rearranged slightly as it is assumed their terms are zero. Additionally,
the result is taken as the sum of the diagonal entries of the matrix.
2024-10-01 09:28:54 +10:00
Thomas Watson 34fba4dfd7 AP_NavEKF3: document provenance of drag force fusion equations
It's from the older version of the generator as well.

Update variable names in the real code to be the same as the generated
code. Skip generation of the unused alternate form of the equations.

Delete `acc_bf_generated.cpp` as we know exactly how to generate it now.
2024-10-01 09:28:54 +10:00
Thomas Watson ef1c31bd50 AP_NavEKF3: document provenance of yaw fusion equations
Requires digging up old versions of the generator script.

The equations have been rearranged somewhat after generation to choose
the appropriate method but they do match overall. The auto-substitution
of the power functions caused slight changes to the generated syntax so
we make those to the real code as well.

Delete `yaw_generated.cpp` as we know exactly how to generate it now.
2024-10-01 09:28:54 +10:00
Thomas Watson ad5da01077 AP_NavEKF3: document provenance of covariance matrix equations
Validated that the generated code matches exactly the code in AP_NavEKF3
(except for the early exits).

Delete `covariance_generated.cpp` as we know exactly how to generate it
now (and it was out of date anyway).
2024-10-01 09:28:54 +10:00
Thomas Watson 4184980537 AP_NavEKF3: derivation: pin generator library versions
Document exactly which versions were used when generating the code.
Sympy is the most important so it is explicitly checked.

Also add an alternate generate script which uses `nix-shell` to make it
convenient to automatically use these versions.
2024-10-01 09:28:54 +10:00
Thomas Watson 57082257fd AP_NavEKF3: derivation: make generation slightly easier
Add a shell script to run the generate_1.py file. Foresight tells us
that we will need multiple such files.

Also ignore the generated code files as they are already out of date and
we are aiming to document provenance and make them unnecessary anyway.
2024-10-01 09:28:54 +10:00
Thomas Watson c880bf57cd AP_NavEKF3: derivation: auto-substitute optimized power functions
Avoids the need to manually insert them after generation.
2024-10-01 09:28:54 +10:00
Peter Barker 53c50b6bc7 AP_NavEKF3: re-order initialiser lines so -Werror=reorder will work 2024-09-24 22:50:28 +10:00
muramura 9e28bec87a AP_NavEKF3: use UINT8_MAX as flag value in place of 255 2024-09-13 09:17:17 +10:00
Tatsuya Yamaguchi 83c544f792 AP_NavEKF3: use SourceSetSelection enum class 2024-09-08 10:02:29 +10:00
Peter Barker 33f9513854 AP_NavEKF3: correct includes 2024-09-06 08:52:01 +10:00
George Zogopoulos 18e95c7979 Revert "AP_NavEKF3: Corrected logged units"
This reverts commit 1f01f75036.
2024-09-06 08:46:11 +10:00
Peter Barker 6cfecaa86d AP_NavEKF3: use enum class for DAL MemoryType 2024-09-04 09:51:08 +10:00
Peter Barker e8f361458e AP_NavEKF3: rename gpsVelInnovTime_ms to gpsRetrieveTime_ms
in preparation for using this for other things
2024-09-03 10:34:02 +10:00
Peter Barker 2a6b45f4d9 AP_NavEKF3: tidy formatting of is_deadreckoning 2024-09-03 10:34:02 +10:00
Peter Barker 4782ace3b9 AP_NavEKF3: rename lastPosPassTime_ms to lastGpsPosPassTime_ms 2024-09-03 10:34:02 +10:00
Peter Barker a51614f360 AP_NavEKF3: use reference for dal in frontend
in place of method calls
2024-09-03 10:16:59 +10:00
Peter Barker 02c6784c11 AP_NavEKF3: add and use pr/EK3_FEATURE_OPTFLOW_FUSION 2024-09-02 11:53:12 +10:00
Peter Barker 4e27c51aa1 AP_NavEKF3: do not log DefaultAirspeed if logging not started
if we are not going to use this value ourselves then we certainly should not add it to the replay log
2024-08-27 10:15:10 +10:00
George Zogopoulos 1f01f75036 AP_NavEKF3: Corrected logged units 2024-08-07 17:02:28 +10:00
Paul Riseborough 4904c718a5 AP_NavEKF3: Fix yaw alignment bug
When the  yaw is aligned to the GPS yaw, the recordYawResetsCompleted() function should be called the same as for any other yaw reset.
2024-07-25 09:34:48 +10:00
Clyde McQueen 630d3fa8a7 AP_NavEKF3: log mag fusion selection to XKFS 2024-07-11 16:16:27 +10:00
Peter Barker c8a20726ff AP_NavEKF3: do not store prediction-enabled as state
this is only used in one place, and that place is called from the same routine setting the persistent state.  The only other place which calls readIMUData shouldn't be running the prediction step, but mmay, depending on the previous setting of the prediction step.

We are not initialising this state on filter reset, so it's possible that the state will be set when we do an InitialiseFilterBootstrap, which is probably not desired
2024-07-09 10:45:03 +10:00
Peter Barker ce48932f4d AP_NavEKF3: remove storedRange member variable if rangefinder measurements disabled 2024-07-04 19:21:44 +10:00
Willian Galvani cb74ebbddd EKF3: allow earth-frame fields to be estimated with an origin but no GPS 2024-07-03 16:49:27 +10:00
Peter Barker 13e7d04497 AP_NavEKF3: make AP_RANGEFINDER_ENABLED remove more code 2024-07-02 09:17:26 +10:00
Peter Barker 563c3e7c62 AP_NavEKF3: rename ins get_primary_accel to get_first_usable_accel 2024-06-26 17:12:12 +10:00
Clyde McQueen 0e6543f0e4 AP_NavEKF3: sub update for yaw reset and inFlight checks
on sub, request final yaw reset after diving 0.5m.
Also update rangefinder tests for sub
2024-06-25 18:09:37 +10:00
Paul Riseborough 61874da020 AP_NavEKF3: Rework method of synthesising airspeed for dead reckoning
The previous method resulted in data incest and fusion of predicted airspeed on every EKF internal time step.
This was not apparent during flight where the vehicle was turning, but during long straight legs did not constrain along track drift.
2024-06-09 14:25:02 +10:00
Paul Riseborough 720c2da807 AP_NavEKF3: Rework GPS jamming resiliency
Make it user selectable.
Remove potential for a race condition between decisions based on latest data and the EKF fusion processing which operates on a delayed time horizon. This is achieved by preventing data entering the buffer if awaiting checks to pass ensuring that no EKF fusion time horizon processes can use data that hasn't passed checks.
Log the waitingForGpsChecks class variable
2024-06-09 14:25:02 +10:00
Paul Riseborough 996bf7d4df AP_NavEKF3: Log gpsGoodToAlign 2024-06-09 14:25:02 +10:00
Paul Riseborough eb2ff2192d AP_NavEKF3: Don't block no compass planes from running GPS alignment checks 2024-06-09 14:25:02 +10:00
Paul Riseborough 6baeb1cd9d AP_NavEKF3: Fix bug causing in flight yaw align to not complete 2024-06-09 14:25:02 +10:00
Paul Riseborough ffde7f815c AP_NavEKF3: Allow wind to relearn rapidly when GPS is re-enabled 2024-06-09 14:25:02 +10:00
Paul Riseborough 87bf8d9997 AP_NavEKF3: Treat wind as truth when deadreckoning with no airspeed sensor 2024-06-09 14:25:02 +10:00
Paul Riseborough 568972c0f0 AP_NavEKF3: Fix bug preventing use of default or synthetic airspeed 2024-06-09 14:25:02 +10:00
Paul Riseborough 2c3174b77b AP_NavEKF3: Strengthen protection against GPS jamming
These changes prevent the EKF from consuming GPS data too soon when it is recovering from jamming if the EKF is able to navigate using dead reckoning.
2024-06-09 14:25:02 +10:00
Paul Riseborough 324d5da811 AP_NavEKF3: Use last observed wind states to enable dead reckoning
These changes enable the EKF to use the last observable wind velocity vector estimate to synthesise an airspeed measurement if operating without an airspeed sensor and when all other measurement types that can constrain velocoty drift are lost. This enables the EKF to use dead reckoning to continue after loss of GPS when there is no air speed sensor fitted and without the need to set a default airspeed value.
The logic used to fuse a default airspeed value has also been cleaned up and the call to FuseAirSpeed() from inside SelectBetaDragFusion() has been removed.

AP_NavEKF3: Fix error in default airspeed observation variance

AP_NavEKF3: Enable shadow fusion of airspeed when sensor is disabled
2024-06-09 14:25:02 +10:00
Paul Riseborough e53416e77b AP_NavEKF3: Apply GPS quality checks following loss of 3D fix if velocity error is bounded 2024-06-09 14:25:02 +10:00
Andrew Tridgell 94cbd7cbfb AP_NavEKF3: use NEW_NOTHROW for new(std::nothrow) 2024-06-04 09:20:21 +10:00
Paul Riseborough 91423d4c71 AP_NavEKF3: Remove unncessary local position height reporting offset
The offset generated by the EK3_OGN_HGT_MASK parameter bit 2 option is applied to the baro or range finder sensor so it does not have to be applied to the local position height.
2024-05-23 10:35:51 +10:00
Paul Riseborough 5fded75eb6 AP_NavEKF3: Adjust sensor height when EK3_OGN_HGT_MASK bit 2 is set 2024-05-23 10:35:51 +10:00
Peter Barker 36e385fb22 AP_NavEKF3: set-origin failure comment improved 2024-05-21 09:56:02 +10:00
Randy Mackay 4e2dd7c399 AP_NavEKF3: accept set origin even when using GPS 2024-05-21 09:56:02 +10:00
Paul Riseborough 3c8b3be7a7 AP_NavEKF3: Change yaw source to stop compass use when calibrating 2024-04-23 15:19:56 +09:00