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

AHRS: added common origin between backends #27851

Merged
merged 5 commits into from
Sep 9, 2024

Conversation

tridge
Copy link
Contributor

@tridge tridge commented Aug 15, 2024

This ensures that EKF2, EKF3 and ExternalAHRS all have a common origin

Note that the origin will come from the first running backend that gets an origin, even if it is not the active backend. This is needed because EKF2 and EKF3 refuse to change origin once it is set.
The placement of this code in the update function for each backend is done as two backends may get an origin on the same loop, so we must check for an origin as soon as we call the backends update

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.

I like it. The copied block will go away when I manage to get the common base class stuff sorted....

Need to test it on real vehicles a bit.

@peterbarker
Copy link
Contributor

.. also should have an autotest

@tridge
Copy link
Contributor Author

tridge commented Aug 19, 2024

this was flight tested on a 5" quad, switching between EK2 and EK3 did not change position

@tridge
Copy link
Contributor Author

tridge commented Aug 19, 2024

.. also should have an autotest

not really sure how to do that ... the obvious method of not setting EK2_ENABLE=1 until after EK3 has set origin won't work, as this PR only does the origin set once

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.

an autotest would be nice but if it's too difficult then merging is OK

@tridge
Copy link
Contributor Author

tridge commented Aug 20, 2024

i'll try to do an autotest

this allows for use of a common origin between backends, and aligns
with EKF3 behaviour
and remove code that aligns origin to AHRS, this will be handled by
the AHRS common origin logic
this aligns the origin between EKF2, EKF3 and ExternalAHRS, making for
smooth transitions between AHRS backends in flight
when common origin is set we should return that, not backends private
origin
test EK2 and EK3 common origin
@tridge
Copy link
Contributor Author

tridge commented Sep 9, 2024

back for dev call this week. I think we should merge this now, but separately see if we can stop the EKFs from changing the origin height on baro reset, but as a separate PR

@tridge tridge merged commit ae6376f into ArduPilot:master Sep 9, 2024
94 checks passed
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.

4 participants