Skip to content

Commit a3b022a

Browse files
committed
Flip operands in calculation
1 parent 94acbb1 commit a3b022a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/main/java/org/lasarobotics/drive/TractionControlController.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,13 @@ public Measure<Velocity<Distance>> calculate(Measure<Velocity<Distance>> velocit
129129
inertialVelocity = Units.MetersPerSecond.of(Math.abs(inertialVelocity.in(Units.MetersPerSecond)));
130130

131131
// See if user has been trying to accelerate for a while...
132-
boolean slowWheel = wheelSpeed.minus(Units.MetersPerSecond.of(Math.abs(velocityRequest.in(Units.MetersPerSecond))))
132+
boolean slowWheel = Units.MetersPerSecond.of(Math.abs(velocityRequest.in(Units.MetersPerSecond))).minus(wheelSpeed)
133133
.gt(VELOCITY_DIFFERENCE_THRESHOLD);
134-
if (slowWheel) {
134+
if (slowWheel) m_forceAccelerateTimer.start();
135+
else {
135136
m_forceAccelerateTimer.reset();
136-
m_forceAccelerateTimer.start();
137-
} else m_forceAccelerateTimer.stop();
137+
m_forceAccelerateTimer.stop();
138+
}
138139
boolean forceAcceleration = m_staticForceAccelerationDebouncer.calculate(
139140
velocityRequest.gte(VELOCITY_REQUEST_THRESHOLD) && wheelSpeed.lte(WHEEL_SPEED_THRESHOLD)
140141
) || m_dynamicForceAccelerationDebouncer.calculate(

0 commit comments

Comments
 (0)