Skip to content

Commit

Permalink
Added fix so wheels dont move when absolute encoder's are not tuned.
Browse files Browse the repository at this point in the history
Signed-off-by: thenetworkgrinch <thenetworkgrinch@users.noreply.github.com>
  • Loading branch information
thenetworkgrinch committed Jan 23, 2024
1 parent a680b2f commit b26816b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/swervelib/SwerveModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public void setDesiredState(SwerveModuleState desiredState, boolean isOpenLoop,
/* If the error is close to 0.25 rotations, then we're 90 degrees, so movement doesn't help us at all */
double cosineScalar = Math.cos(Units.degreesToRadians(steerMotorError));
/* Make sure we don't invert our drive, even though we shouldn't ever target over 90 degrees anyway */
if (cosineScalar < 0.0)
if (cosineScalar < 0.0 || desiredState.speedMetersPerSecond == 0)
{
cosineScalar = 0.0;
}
Expand Down

0 comments on commit b26816b

Please sign in to comment.