Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP_NavEKF3 Prevent rejection of airspeed when dead reckoning #23999

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

priseborough
Copy link
Contributor

When flying a plane without GPS, gusts or transiting through wind shear layers can cause the airspeed measurement to fail consistency checks and be rejected which can result in a fall-back to a non-navigating state. This patch correct this behaviour by clipping the innovations instead of rejecting the airspeed measurement when the EKF is dead reckoning.

@priseborough priseborough marked this pull request as draft June 7, 2023 22:50
@priseborough priseborough self-assigned this Jun 7, 2023
@tridge
Copy link
Contributor

tridge commented Jun 8, 2023

@priseborough looks good to me. It is marked as WIP, do you want me to do some testing? I double deliberately adjust ARSPD_RATIO on my quadplane or SITL to test

@priseborough priseborough removed the WIP label Jun 22, 2023
@tridge tridge marked this pull request as ready for review June 23, 2023 04:49
@tridge tridge force-pushed the ekfAspdFuseFix-wip branch from d03de27 to 145d703 Compare June 23, 2023 04:49
@priseborough
Copy link
Contributor Author

I'm investigating a potential issue arising from SITL testing where setting ARSPD_RATIO to 1.5 during dead reckoning to simulate partially blocked airspeed sensor resulted in a larger than expected loss of navigation performance after a few minutes. I may have to increase the observation noise variance in addition to clipping the innovation.

@priseborough
Copy link
Contributor Author

priseborough commented Jun 25, 2023

I completed the following SITL test cases:

  1. test of rapid 5 m/s change in wind speed when dead reckoning which simulates climb or descent through a wind shear layer.

The following map shows the period of time from disabling of GPS until wind speed change is reverted. The estimated position drifts upwind at a rate consistent with the change in wind speed.

2023-06-25 09:39:40.379 SIM_GPS_DISABLE 0.000000 -> 1.000000
2023-06-25 09:40:56.139 SIM_WIND_SPD 0.000000 -> 5.000000
2023-06-25 09:42:33.379 SIM_WIND_SPD 5.000000 -> 0.000000

Screen Shot 2023-06-25 at 10 13 13 am

Airspeed innovations spike and then decay to zero

Screen Shot 2023-06-25 at 10 15 45 am
  1. test of a rapid reduction in airspeed sensor scale factor when dead reckoning which simulates a sudden partial blockage.

The first test with a zero wind speed behaved as expected.

2023-06-25 09:45:46.639 ARSPD_RATIO 2.000000 -> 1.500000
2023-06-25 09:48:21.639 ARSPD_RATIO 1.500000 -> 2.000000

Screen Shot 2023-06-25 at 10 18 37 am

The GPS was then re-enabled, wind speed increased and GPS disabled after allowing sufficient time for the wind speed to be learned

2023-06-25 09:50:27.879 SIM_GPS_DISABLE 1.000000 -> 0.000000
2023-06-25 09:51:26.879 SIM_WIND_SPD 0.000000 -> 5.000000
2023-06-25 09:55:42.879 SIM_GPS_DISABLE 0.000000 -> 1.000000

A partial blockage of the airspeed sensor was then simulated

2023-06-25 09:57:11.879 ARSPD_RATIO 2.000000 -> 1.500000
2023-06-25 10:00:53.139 ARSPD_RATIO 1.500000 -> 2.000000

The effect of a scale factor error on teh wind relative speed is to skew the trajectory.

Screen Shot 2023-06-25 at 10 32 42 am Screen Shot 2023-06-25 at 10 33 11 am

When the partial blockage was removed, the navigation performance was poor with velocity errors that prevented the vehicle from following a circular orbit.

Screen Shot 2023-06-25 at 10 36 48 am Screen Shot 2023-06-25 at 10 37 54 am

Here is the EKF's estimated velocity vs the GPS velocity in the north and east directions from when the airspeed scale factor was reduced, then restored then through to when GPS was re-enabled.

Screen Shot 2023-06-25 at 10 42 51 am Screen Shot 2023-06-25 at 10 43 08 am

The speed error is within expected bounds given the airspeed estimation error of 4 m/s

Screen Shot 2023-06-25 at 10 45 30 am

There is a build up in yaw and course angle error.

Screen Shot 2023-06-25 at 10 47 32 am Screen Shot 2023-06-25 at 10 50 25 am

This testing shows there is a EKF3 vulnerability to the combination of GPS loss, wind and large airspeed sensor errors which result in a yaw angle offset.

The following patches were evaluated to see if yaw and ground course angle errors could be reduced.

  1. Rework of the patch so that instead of clipping the airspeed innovation at the gate limit when the test ratio is >1, the i innovation variance is scaled up instead so that the Kalman gain is consistent with a test ratio of 1. This gives the same effect as before with respect to the change in states for a given observation but has the additional effect that the covariance matrix update reflects the reduce confidence of the measurement. See priseborough@c80dfeb
  2. Use a smaller airspeed innovation gate size when dead reckoning. See priseborough@0eac1d7
  3. Use s smaller sideslip angle observation noise when dead reckoning. See priseborough@b400939

These changes were evaluated by replaying the SITL test log.

Patch 1. did not noticeably reduce ground course angle error when dead reckoning in wind with the -25% airspeed scale factor error.

Screen Shot 2023-06-25 at 11 09 50 am

Patches 1 and 2 slightly reduced ground course angle error:

Screen Shot 2023-06-25 at 11 13 05 am

Patches 1,2 and 3 slightly reduced ground course angle error:

Screen Shot 2023-06-25 at 11 15 57 am

Looking at yaw angle estimation error across all tests:

Patch 1 only makes no difference because the airspeed innovation test limit is not being exceeded.

Screen Shot 2023-06-25 at 11 26 23 am Screen Shot 2023-06-25 at 11 35 52 am

Patches 1 & 2 significantly reduced yaw angle estimation error

Screen Shot 2023-06-25 at 11 28 49 am

There was some transient wind speed estimation error
Screen Shot 2023-06-25 at 11 34 04 am

Patches 1, 2 & 3 further reduced yaw angle estimation error.

Screen Shot 2023-06-25 at 11 32 43 am Screen Shot 2023-06-25 at 11 33 10 am

I'll continue the testing and provide updated patches if required. We will need to accept the inherent limitations associated with use of airspeed sensor relative navigation and importance of sensor calibration.

@priseborough priseborough force-pushed the ekfAspdFuseFix-wip branch 2 times, most recently from b400939 to 0444436 Compare June 25, 2023 02:22
@priseborough
Copy link
Contributor Author

priseborough commented Jun 25, 2023

The ability to handle a partial blockage of the airspeed sensor when dead reckoning with 7 m/s of wind was evaluated with SITL simulation of current upstream master and then the log was replayed using the following commits:

  1. priseborough@0444436
  2. priseborough@c80dfeb
  3. priseborough@0eac1d7
  4. priseborough@b400939

2023-06-25 12:34:02.199 SIM_WIND_SPD 0.000000 -> 7.000000
2023-06-25 12:40:12.959 SIM_GPS_DISABLE 0.000000 -> 1.000000
2023-06-25 12:42:01.459 ARSPD_RATIO 2.000000 -> 1.500000
2023-06-25 12:45:19.699 ARSPD_RATIO 1.500000 -> 2.000000
2023-06-25 12:45:33.959 SIM_GPS_DISABLE 1.000000 -> 0.000000

Commit 1 - there was not change to velocity or yaw estimation accuracy

Screen Shot 2023-06-25 at 12 37 23 pm Screen Shot 2023-06-25 at 12 40 58 pm Screen Shot 2023-06-25 at 12 41 37 pm

Commits 1 and 2 - same as above, no change

Commits 1,2 and 3 - small change to velocity and yaw esitmates when airspeed sensor partial blockage is removed.

Screen Shot 2023-06-25 at 12 46 13 pm Screen Shot 2023-06-25 at 12 46 35 pm Screen Shot 2023-06-25 at 12 46 51 pm

Commits 1,2,3 and 4 - Using a smaller process noise for sideslip fusion when dead reckoning slightly increased estimation errors when the airspeed partial blockage/scale factor error was introduced:

Screen Shot 2023-06-25 at 12 51 51 pm Screen Shot 2023-06-25 at 12 52 07 pm Screen Shot 2023-06-25 at 12 52 26 pm

The summary from SITL testing is that:

  1. The sensitivity to airspeed scale factor error when dead reckoning in wind is an inherent attribute of the EKF's method of dead reckoning and not something introduced by this PR.
  2. Commit 1. was effective in preventing the EKF rejecting airspeed measurements when dead reckoning.

The commit 2. upscaling scaling of the airspeed innovation variance when the airspeed observation is theoretically a good thing to do instead of just clipping the innovation, because the covariance update operation will then factor in the likely reduced accuracy of the airspeed measurement.

The commit 3. use of a smaller innovation gate for airspeed did slightly reduce yaw angle estimation error with replay of the SITL test log described in the earlier comment so it is worth including.

@tridge tridge force-pushed the ekfAspdFuseFix-wip branch from c5782cd to 031de06 Compare November 3, 2023 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants