Logger.processInputs("Spindexer", inputs);
if (resetPos == null) {
- resetPos = (motor.getPosition().getValueAsDouble() % gearRatio);
+ resetPos = (motor.getPosition().getValueAsDouble() % gearRatio) % 1.0;
resetPID.reset();
}
motor.set(0.0);
reversing = false;
} else if (state == SpindexerState.RESET && resetPos != null) {
- motor.set(resetPID.calculate((motor.getPosition().getValueAsDouble() % gearRatio), resetPos));
+ motor.set(resetPID.calculate((motor.getPosition().getValueAsDouble() % gearRatio) % 1.0, resetPos));
} else {
motor.set(power);
reversing = false;