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_AHRS: prevent DCM fallback when losing GPS #25408

Closed

Conversation

robertlong13
Copy link
Collaborator

DCM is particularly bad during hover modes and should only be used when the EKF cannot safely do its job. Currently, losing the GPS during VTOL takeoff triggers an unnecessary DCM fallback.

This PR changes the const_pos_mode flag check so that it only triggers fallback if that happens despite having GPS.

DCM fallback should only occur when GPS stops fusing, not when it
is lost completely.
@rmackay9
Copy link
Contributor

This is probably OK but we should be sure that there is no change in the Copter's reported position when we gain/lose GPS. For extra points we should test the behaviour when using a non-GPS sensor for position estimation (e.g. visual odometry/vicon).

@robertlong13
Copy link
Collaborator Author

robertlong13 commented Oct 31, 2023

This is probably OK but we should be sure that there is no change in the Copter's reported position when we gain/lose GPS. For extra points we should test the behaviour when using a non-GPS sensor for position estimation (e.g. visual odometry/vicon).

You mean the Plane's reported position? This is all under an if block than only runs for Plane and Rover.

I'll see about testing these cases, but I need to learn about them and how to sim them first.

@robertlong13
Copy link
Collaborator Author

Thinking about this more, you're right that I probably should be checking if it has any kind of device that can provide AID_RELATIVE or AID_ABSOLUTE is active, not just GPS (i.e., something should be able to keep the EKF from going const_pos_mode, but something is going very wrong, meaning we need the fallback).

Copy link
Member

@IamPete1 IamPete1 left a comment

Choose a reason for hiding this comment

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

I wounder if it should also check fly_forward, that would restrict this change of behavior to only VTOL modes on plane.

@robertlong13
Copy link
Collaborator Author

I wounder if it should also check fly_forward, that would restrict this change of behavior to only VTOL modes on plane.

For some reason, in my testing (though that's been limited), killing GPS only seems to trigger DCM fallback in hover. Haven't tested on a real bird in forward flight though.

I'll give the fly_forward check some thought though. If I do that, I'd rather go the extra step of fully disallowing DCM in hover, like Copter does always.

@timtuxworth
Copy link
Contributor

timtuxworth commented Dec 4, 2023

During my no-GPS testing with a fixed-wing - mostly flying fixed wing AUTO mode, the plane would fallback to DCM within a few seconds of me turning off the GPS - it was very annoying because I was trying to test EKF dead-reckoning.
[Not a VTOL].

@IamPete1
Copy link
Member

IamPete1 commented Dec 4, 2023

For some reason, in my testing (though that's been limited), killing GPS only seems to trigger DCM fallback in hover. Haven't tested on a real bird in forward flight though.

That is because EKF does not throw its toys out of the pram if flyforward is true and it looses GPS. (provided everything else is good) So as you say adding that check should not change the current behavior.

Everything we can do to minimize the scope of the change means less testing and fewer edge cases.

@Ryanf55
Copy link
Collaborator

Ryanf55 commented Dec 4, 2023

Tridge recommends this approach because it's vehicle-dependent:
#25676

@robertlong13
Copy link
Collaborator Author

I like Tridge's approach better. Closing

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.

5 participants