-
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
Rewrite DutyCycleEncoder and AnalogEncoder #6398
Conversation
Still needs C++, Tests and Sim support. Very WIP. |
wpilibj/src/main/java/edu/wpi/first/wpilibj/DutyCyclePotentiometer.java
Outdated
Show resolved
Hide resolved
For consistency's sake it may also be better to make the offset value "the voltage/position measurement where you would like 0 to be" and subtract the offset from the measured value - this is typically more intuitive to find (even though it's the same number multiplied by -1) and would match the convention used by DutyCycleEncoder currently, as well as many swerve templates/libraries |
wpilibj/src/main/java/edu/wpi/first/wpilibj/DutyCycleEncoder.java
Outdated
Show resolved
Hide resolved
/format |
Please retarget to the main branch. |
Clarification: What's the difference between AnalogPotentiometer and this version of AnalogEncoder? It took me some time to realize that |
They're basically the same thing at this point. We'd probably deprecate AnalogPotentiometer since actual potentiometers are rarely used anymore. As for the Zero, Naming things is hard. Some people think offset, some think zero. I've seen it about 50/50 split. |
So whatever the parameter name is, the description should include the other name as well. Maybe extract a base |
…pilib into absencoderreplace
This should all be done later. All this PR should be is fixing up the low level API. |
The existing AnalogEncoder and DutyCycleEncoder classes are massive footguns. They automatically include rollover support, which is often not what people want. Additionally, DutyCycle's rollover support is completely broken and cannot be trusted. It also cannot be easily fixed even at the FPGA level.