mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-05 03:21:42 +00:00
[wpimath] Fix SimpleFeedforward overload set (#7516)
This commit is contained in:
@@ -34,19 +34,17 @@ class SimpleMotorFeedforwardTest {
|
||||
double nextVelocity = 3.0; // rad/s
|
||||
|
||||
assertEquals(
|
||||
37.52499583432516 + 0.5,
|
||||
simpleMotor.calculateWithVelocities(currentVelocity, nextVelocity),
|
||||
0.002);
|
||||
37.52499583432516 + 0.5, simpleMotor.calculate(currentVelocity, nextVelocity), 0.002);
|
||||
assertEquals(
|
||||
plantInversion.calculate(r, nextR).get(0, 0) + Ks,
|
||||
simpleMotor.calculateWithVelocities(currentVelocity, nextVelocity),
|
||||
simpleMotor.calculate(currentVelocity, nextVelocity),
|
||||
0.002);
|
||||
|
||||
// These won't match exactly. It's just an approximation to make sure they're
|
||||
// in the same ballpark.
|
||||
assertEquals(
|
||||
plantInversion.calculate(r, nextR).get(0, 0) + Ks,
|
||||
simpleMotor.calculateWithVelocities(currentVelocity, nextVelocity),
|
||||
simpleMotor.calculate(currentVelocity, nextVelocity),
|
||||
2.0);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,25 +51,25 @@ class DifferentialDriveVoltageConstraintTest {
|
||||
assertAll(
|
||||
() ->
|
||||
assertTrue(
|
||||
feedforward.calculateWithVelocities(
|
||||
feedforward.calculate(
|
||||
wheelSpeeds.leftMetersPerSecond,
|
||||
wheelSpeeds.leftMetersPerSecond + dt * acceleration)
|
||||
<= maxVoltage + 0.05),
|
||||
() ->
|
||||
assertTrue(
|
||||
feedforward.calculateWithVelocities(
|
||||
feedforward.calculate(
|
||||
wheelSpeeds.leftMetersPerSecond,
|
||||
wheelSpeeds.leftMetersPerSecond + dt * acceleration)
|
||||
>= -maxVoltage - 0.05),
|
||||
() ->
|
||||
assertTrue(
|
||||
feedforward.calculateWithVelocities(
|
||||
feedforward.calculate(
|
||||
wheelSpeeds.rightMetersPerSecond,
|
||||
wheelSpeeds.rightMetersPerSecond + dt * acceleration)
|
||||
<= maxVoltage + 0.05),
|
||||
() ->
|
||||
assertTrue(
|
||||
feedforward.calculateWithVelocities(
|
||||
feedforward.calculate(
|
||||
wheelSpeeds.rightMetersPerSecond,
|
||||
wheelSpeeds.rightMetersPerSecond + dt * acceleration)
|
||||
>= -maxVoltage - 0.05));
|
||||
|
||||
@@ -43,7 +43,7 @@ class ExponentialProfileTest {
|
||||
private static ExponentialProfile.State checkDynamics(
|
||||
ExponentialProfile profile, ExponentialProfile.State current, ExponentialProfile.State goal) {
|
||||
var next = profile.calculate(kDt, current, goal);
|
||||
var signal = feedforward.calculateWithVelocities(current.velocity, next.velocity);
|
||||
var signal = feedforward.calculate(current.velocity, next.velocity);
|
||||
|
||||
assertTrue(Math.abs(signal) < constraints.maxInput + 1e-9);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user