[wpilib] PWMSpeedController.get(): Apply Inversion (#3016)

This makes get() return the value actually sent to the motor.

This is a breaking change.
This commit is contained in:
Austin Shalit
2020-12-31 14:35:10 -08:00
committed by GitHub
parent 670a187a3c
commit 948af6d5b5
3 changed files with 8 additions and 4 deletions

View File

@@ -40,13 +40,15 @@ public abstract class PWMSpeedController extends PWM implements SpeedController
}
/**
* Get the recently set value of the PWM.
* Get the recently set value of the PWM. This value is affected by the inversion property. If you
* want the value that is sent directly to the SpeedController, use {@link
* edu.wpi.first.wpilibj.PWM#getSpeed()} instead.
*
* @return The most recently set value for the PWM between -1.0 and 1.0.
*/
@Override
public double get() {
return getSpeed();
return getSpeed() * (m_isInverted ? -1.0 : 1.0);
}
@Override