[wpimath] Fix DCMotor.getSpeed() (#5061)

This bug didn't occur in C++ because the units system caught it at
compile time.
This commit is contained in:
Tyler Veness
2023-02-05 13:21:16 -08:00
committed by GitHub
parent b43ec87f57
commit 2f310a748c

View File

@@ -86,7 +86,8 @@ public class DCMotor {
* @return The speed of the motor.
*/
public double getSpeed(double torqueNm, double voltageInputVolts) {
return voltageInputVolts - 1.0 / KtNMPerAmp * torqueNm * rOhms * KvRadPerSecPerVolt;
return voltageInputVolts * KvRadPerSecPerVolt
- 1.0 / KtNMPerAmp * torqueNm * rOhms * KvRadPerSecPerVolt;
}
/**