-
Notifications
You must be signed in to change notification settings - Fork 613
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
Make encoder classes unit-aware #6746
Comments
For the java version, would it be a good idea to include methods for returning stuff in the java units library, or should the only return value be doubles? |
In Java. we've been offering getters and setters for both doubles and units. It's not ideal, but the Java units library just wasn't performant enough on the roboRIO for us to not offer an escape hatch. The units library got rewritten for 2025, so maybe units-only will work out better this time? |
Sure then. I don't think the units api rewrite does anything on the performance side of things though(just adds support for more methods that weren't possible w/ java's generics system). |
Another option is just delaying this until 2027 when we get a more powerful processor and better garbage collectors (the more modern GCs don't support ARM 32-bit). |
Thinking about it, I think that for java we can probably mimic the simulation classes' methods(getVelocityRadPerSec(), getPositionRad()) as well as a getPosition() method that returns an Angle |
Is your feature request related to a problem? Please describe.
We currently have Encoder, AnalogEncoder, and DutyCycleEncoder. None of them are unit-safe.
Describe the solution you'd like
To facilitate strong unit typing, we should split them all into linear and angular versions. I mocked up an API in C++ but never finished implementing the internals.
https://github.com/calcmogul/allwpilib/tree/_ref-new-encoder-api
The text was updated successfully, but these errors were encountered: