diff --git a/wpilibc/src/main/native/cpp/PWMSpeedController.cpp b/wpilibc/src/main/native/cpp/PWMSpeedController.cpp index 51d6810476..413bf97f7b 100644 --- a/wpilibc/src/main/native/cpp/PWMSpeedController.cpp +++ b/wpilibc/src/main/native/cpp/PWMSpeedController.cpp @@ -13,7 +13,7 @@ void PWMSpeedController::Set(double speed) { } double PWMSpeedController::Get() const { - return GetSpeed(); + return GetSpeed() * (m_isInverted ? -1.0 : 1.0); } void PWMSpeedController::SetInverted(bool isInverted) { diff --git a/wpilibc/src/main/native/include/frc/PWMSpeedController.h b/wpilibc/src/main/native/include/frc/PWMSpeedController.h index 7cabe27d1d..3d12fb70c6 100644 --- a/wpilibc/src/main/native/include/frc/PWMSpeedController.h +++ b/wpilibc/src/main/native/include/frc/PWMSpeedController.h @@ -28,7 +28,9 @@ class PWMSpeedController : public PWM, public SpeedController { void Set(double value) override; /** - * 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 PWM#getSpeed()} instead. * * @return The most recently set value for the PWM between -1.0 and 1.0. */ diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PWMSpeedController.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/PWMSpeedController.java index ea4b7aaf8c..1c9801fc40 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PWMSpeedController.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/PWMSpeedController.java @@ -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