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_InertialSensor: use accels and gyros with lowest number of errors as primary #19641

Closed

Conversation

peterbarker
Copy link
Contributor

Current behaviour is to only preferentially select a sensor if it has no errors.

This should be better in that:

  • if you have one sensor with a single error and another sensor with a bajillion errors we will use the first in preference
  • fewer issues at integer wrap (existing code should probably have reset to startup-error-count+1 rather than just startup-error-count)
  • 150 bytes cheaper
  • faster to calculate

This could be better still be refusing to increment an error score if another sensor has already hit its incremement limit and we would have the same value as it after incremement. OTOH, if your sensors are doing this to you then it really probably isn't going to help.

Drawbacks:

  • change in behaviour
  • if a pair of IMUs is having the same number of errors we could rapidly switch between the two IMUs

Also prevent integer overflow rather than attempting to correct for it.
This prevents a bug where we reset the error score to zero rather than
to some positive value on integer overflow.

Selecting the lowest error score would seem to be a better solution than
preferentially selecting one with zero errors.
@peterbarker peterbarker removed the RFC label Jan 1, 2022
@peterbarker peterbarker closed this Jan 4, 2022
@peterbarker peterbarker deleted the pr/ins-choose-lowest-errors branch August 9, 2023 02:52
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants