You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change in the way getVelocity() works.
It now "remembers" the last value calculated, and re-calculates it only when the delta-T is large enough (controllable through a new member field, default value is 100µs float minDeltaT = 0.000100; // default is 100 microseconds, or 10kHz
This will, I think, more elegantly handle the edge cases:
getVelocity() called too often
microseconds wrap
It does however introduce a kind of low-pass filter based on minDeltaT - one that was implicitly present in some form anyway, but is now explicit.
Please take a look and see if you agree with this change @askuric - we discussed it, but this might not be the way you imagined it?
Oh, and also important to mention: the change also implicitly, through its deltaT check, computes the velocity at most once per call to update() - since the timestamp is only updated during update().
So getVelocity() now has the same behaviour as getAngle(), where the value remains stable within one loop iteration, i.e. requiring a call to update() before the value changes.
I love it, its so simple and effective. That is more or less the solution I had in mind also. The only thing is that we might define this minDeltaT differently for different architectures. Like teensy/esp32/stm32g4/stm32f4 maybe go to 10us and the rest to 100us.
But exposing this variable is probably the best way to resolve this, leave it to the user to find the best value.
This file contains hidden or 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
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.
Change in the way getVelocity() works.
It now "remembers" the last value calculated, and re-calculates it only when the delta-T is large enough (controllable through a new member field, default value is 100µs
float minDeltaT = 0.000100; // default is 100 microseconds, or 10kHzThis will, I think, more elegantly handle the edge cases:
It does however introduce a kind of low-pass filter based on minDeltaT - one that was implicitly present in some form anyway, but is now explicit.
Please take a look and see if you agree with this change @askuric - we discussed it, but this might not be the way you imagined it?