FRC2706 / 2024-2706-Robot-Code

Code for the 2024 game.
Other
3 stars 0 forks source link

Fix: Error in calculating if the swerve encoders are synced #91

Closed ErikCald closed 3 months ago

ErikCald commented 4 months ago

Describe your changes

Explain what you did:

This method is supposed to check if 2 angles are within ~3 degrees of each other but it wasn't properly handling angles that wrap around 0 to 360 or angles that had different ranges. For example, the cancoder minus offset might be in the range of [40, 400) if the offset if -40 degrees. Fix: After subtracting the angles to find the error, I forced the angleError to be in the range of -180 to 180.

Checklist before requesting a review