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

[wpimath] Add lastValue() method to filters #6351

Merged
merged 1 commit into from
Feb 10, 2024
Merged

[wpimath] Add lastValue() method to filters #6351

merged 1 commit into from
Feb 10, 2024

Conversation

N0tACyb0rg
Copy link
Contributor

Adds the getValue method to return the current value of a SlewRateLimiter without recalculating the value.

@N0tACyb0rg N0tACyb0rg requested a review from a team as a code owner February 6, 2024 18:15
@Oblarg
Copy link
Contributor

Oblarg commented Feb 6, 2024 via email

@N0tACyb0rg
Copy link
Contributor Author

Something like that? Or should it just be lastValue?

@Oblarg
Copy link
Contributor

Oblarg commented Feb 6, 2024

I prefer lastValue() to getLastValue() (shorter, no risk of confusion) but either is fine.

Copy link
Contributor Author

@N0tACyb0rg N0tACyb0rg left a comment

Choose a reason for hiding this comment

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

I actually ended up prefering lastValue() to getLastValue() as well, changed it to that.

@calcmogul
Copy link
Member

calcmogul commented Feb 6, 2024

If we're going to add this, we should add it to all filter classes that can support it (i.e., they've already cached the latest output internally). LinearFilter would return m_outputs.getFirst().

@N0tACyb0rg
Copy link
Contributor Author

Okay, I'll start working on it.

@N0tACyb0rg
Copy link
Contributor Author

I added lastValue() methods to the LinearFilter and MedianFilter classes alongside SlewRateLimiter.

Copy link
Member

@calcmogul calcmogul left a comment

Choose a reason for hiding this comment

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

Now there's a mix of GetValue() and LastValue(). Which do we want?

Copy link
Contributor Author

@N0tACyb0rg N0tACyb0rg left a comment

Choose a reason for hiding this comment

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

Sorry about that, brains on autopilot are fun. 😅

@calcmogul calcmogul changed the title [wpimath] Add getValue method for SlewRateLimiter [wpimath] Add lastValue() method to filters Feb 6, 2024
@N0tACyb0rg
Copy link
Contributor Author

That should be the last thing. Let me know if it's good to go and I'll squash the commits.

@N0tACyb0rg
Copy link
Contributor Author

I squashed the commits, they should be ready to merge now.

@calcmogul
Copy link
Member

We autosquash PRs before merge anyway.

@PeterJohnson PeterJohnson merged commit 3207795 into wpilibsuite:main Feb 10, 2024
25 checks passed
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.

4 participants