Skip to content

AP_NavEKF3: added in a check for high velocity innovation #29434

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

Merged
merged 1 commit into from
Mar 12, 2025

Conversation

tridge
Copy link
Contributor

@tridge tridge commented Mar 5, 2025

if using GPS and our horizontal velocity innovation is high then mark the filter as unhealthy, which causes an arming failure

this helps with #29384

@peterbarker
Copy link
Contributor

Looks right. How was it tested?

@tridge
Copy link
Contributor Author

tridge commented Mar 5, 2025

Looks right. How was it tested?

replay on the log, with printf() for when it triggers

@peterbarker
Copy link
Contributor

@rmackay9 we have users moving from various non-GPS-navigation modes (eg. inside hangars) to using-GPS. Will this adversely affect them?

I'm thinking of things like the ahrs-source-extnav-optflow.lua workflows. I don't think we have any autotest for that one.

@rmackay9
Copy link
Contributor

rmackay9 commented Mar 5, 2025

Hi @peterbarker, I'm not sure.

TBH, I'm not sure if we should be changing the meaning of "healthy". If we want the pre-arm to protect against arming with high innovations then I think we should instead add a specific check for that.

@rishabsingh3003
Copy link
Contributor

I think this would block arming in some valid use cases; for example, a user trying to take off manually in alt-hold mode from a location that is adversely affecting the GPS (hence causing high innovations) but will be fine once high up in the air. It should be a specific check, as Randy suggested.

@peterbarker
Copy link
Contributor

I think this would block arming in some valid use cases; for example, a user trying to take off manually in alt-hold mode from a location that is adversely affecting the GPS (hence causing high innovations) but will be fine once high up in the air. It should be a specific check, as Randy suggested.

We have an arming bit for this specific situation - "always require position for arming"....

@tridge tridge force-pushed the pr-ekf3-health-vel-innovation branch from ededac3 to b1dbacd Compare March 7, 2025 23:06
@tridge
Copy link
Contributor Author

tridge commented Mar 7, 2025

@rmackay9 @rishabsingh3003 I've changed it so that the check is only done if position is required

@rmackay9
Copy link
Contributor

rmackay9 commented Mar 7, 2025

hmm, this essentially adds another type of healthy. I still don't understand why we don't just add an arming check if we're trying to prevent arming with a high velocity innovation. That would surely be a more direct approach?

@tridge
Copy link
Contributor Author

tridge commented Mar 8, 2025

hmm, this essentially adds another type of healthy. I still don't understand why we don't just add an arming check if we're trying to prevent arming with a high velocity innovation. That would surely be a more direct approach?

we want it to apply to all lanes, and we want it on the raw innovations in those lanes. We don't have that information outside the EKF code. So we could add a new set of APIs to do it externally, or we can extend the existing NavEKF3::pre_arm_check() which is what I've done.
I could add a NavEKF3_core::pre_arm_check() instead of extending healthy() if you like. I did it by extending healthy() as it is so similar to the existing checks inside healthy()
When this triggers the EKF really is unhealthy

Copy link
Contributor

@rishabsingh3003 rishabsingh3003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this change. However, checking just velocity seems a bit arbitrary. We should probably be checking at least some of the other states as well for high innovations?

For example, I probably wouldn't want to takeoff in guided if the vertical position innovations are super high. Might be scope creep considering this in response to a particular crash.

Copy link
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this will give us a pre-arm check, and I think it's mergeable just for that. Would have prevented a bad mishap, and is easily back-portable.

The current formulation doesn't give us any post-arming protection. We could possibly look at telling the EKF we require it to have position, instead of passing that information in as part of the arming checks. That would allow us to do this velocity check continuously rather than just at prearm.

@tridge
Copy link
Contributor Author

tridge commented Mar 10, 2025

For example, I probably wouldn't want to takeoff in guided if the vertical position innovations are super high. Might be scope creep considering this in response to a particular crash.

The position states will reset on high innovation, but the velocity states won't. We could add a check for how recently a reset has happened if we want to cover that. I was trying to get a minimal change in for this particular issue that we can put into 4.6.0.

@rmackay9
Copy link
Contributor

I think functionally this is fine but the way it's hidden in the ahrs::healthy() seems unintuitive for future developers to figure out.

I very much like Tridge's suggestion to, "I could add a NavEKF3_core::pre_arm_check()". I think then it becomes very obvious what the check's purpose is.

if using GPS and our horizontal velocity innovation is high then mark
the filter as unhealthy, which causes an arming failure

this helps with ArduPilot#29384
@tridge tridge force-pushed the pr-ekf3-health-vel-innovation branch from b1dbacd to 20ec96e Compare March 11, 2025 20:38
@tridge
Copy link
Contributor Author

tridge commented Mar 11, 2025

@rmackay9 I added the per-core pre-arm check function as discussed

Copy link
Contributor

@rmackay9 rmackay9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks!

@rmackay9 rmackay9 merged commit efe6e85 into ArduPilot:master Mar 12, 2025
102 of 103 checks passed
@Hwurzburg Hwurzburg added the WikiNeeded needs wiki update label Mar 12, 2025
@rmackay9 rmackay9 mentioned this pull request Mar 17, 2025
82 tasks
@rmackay9
Copy link
Contributor

this is included in 4.6.0-beta5

@rmackay9 rmackay9 moved this from Pending to 4.6.0-beta5 in 4.6 Backports Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EKF WikiNeeded needs wiki update
Projects
Status: 4.6.0-beta5
Development

Successfully merging this pull request may close these issues.

7 participants