We are trying to get an angle from a Rev Through Bore encoder as an absolute encoder. We have the red white and black wires connected to the DIO port on the RoboRio.
We are using the DutyCycleEncoder class
We get NaN (Not a number) for the result when setting the dutyCycleRange
if we don’t set the duty cycle range we get we seem to get values 0 to 1. How is this supposed to be configured?
Add .0 to all your numbers. Java’s integer division is rounding these to zero.
YEah, the integer division issue fixed the NaN issue, but is still not returning a 360 but a 0-1 number which it does without setting the cycle range.
What function are you calling? Get() is not scaled by setDistancePerRotation(), getDistance() is.
Wait, that is because I am getting absolute position, i need to getDistance
If you want the absolute position to be 0-360, you need to do that multiplication yourself.