-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
Correct off-by-one problem in EKF IMU ringbuffer #26696
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
peterbarker
changed the title
Pr/rinbuffer tests
Correct off-by-one problem in EKF IMU ringbuffer
Apr 5, 2024
peterbarker
force-pushed
the
pr/rinbuffer-tests
branch
from
April 6, 2024 00:35
2634bee
to
c36b6b4
Compare
rmackay9
reviewed
Apr 8, 2024
rmackay9
reviewed
Apr 8, 2024
rmackay9
approved these changes
Apr 8, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after the two minor fixes
this init() call can be called on an existing buffer, in which case we clear the object. Presumably since we've just zeroed all the elements its safe to say that we should mark the object as having never-been-filled
Co-authored-by: luweiagi <[email protected]>
peterbarker
force-pushed
the
pr/rinbuffer-tests
branch
from
April 10, 2024 00:11
c36b6b4
to
c1620b0
Compare
I think there is a more correct fix at: |
Oh oh. I've added this back for discussion at next week's dev call so that it's not forgotten in case PeterB doesn't have time to look into it before then. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an alternate solution to a bug @luweiagi found in the EKF buffer code.
His PR is here: #25316
My formulation here switches the determination of whether the buffer has ever been full to looking for us wrapping the new offset, rather than looking at the old offset.
I think all of these approaches are bogus; if we advance the oldest pointer then we may never actually be "full". I think the current behaviour only works because the EKF doesn't consume until the buffers have been full at least once.
The supplied tests fail before this PR, pass after (the buffer says it is full on the third element, not the fourth, as @luweiagi pointed out in the issue).
Closes #25316