Skip to content

Commit

Permalink
Flip operands in calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
viggy96 committed Oct 28, 2024
1 parent 94acbb1 commit a3b022a
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,13 @@ public Measure<Velocity<Distance>> calculate(Measure<Velocity<Distance>> velocit
inertialVelocity = Units.MetersPerSecond.of(Math.abs(inertialVelocity.in(Units.MetersPerSecond)));

// See if user has been trying to accelerate for a while...
boolean slowWheel = wheelSpeed.minus(Units.MetersPerSecond.of(Math.abs(velocityRequest.in(Units.MetersPerSecond))))
boolean slowWheel = Units.MetersPerSecond.of(Math.abs(velocityRequest.in(Units.MetersPerSecond))).minus(wheelSpeed)
.gt(VELOCITY_DIFFERENCE_THRESHOLD);
if (slowWheel) {
if (slowWheel) m_forceAccelerateTimer.start();
else {
m_forceAccelerateTimer.reset();
m_forceAccelerateTimer.start();
} else m_forceAccelerateTimer.stop();
m_forceAccelerateTimer.stop();
}
boolean forceAcceleration = m_staticForceAccelerationDebouncer.calculate(
velocityRequest.gte(VELOCITY_REQUEST_THRESHOLD) && wheelSpeed.lte(WHEEL_SPEED_THRESHOLD)
) || m_dynamicForceAccelerationDebouncer.calculate(
Expand Down

0 comments on commit a3b022a

Please sign in to comment.