SteelRidgeRobotics / 2022-23_FRC_Season

All of our code for the season.
2 stars 1 forks source link

Fix swerve bug #4

Closed ProgramDragon64 closed 1 year ago

ProgramDragon64 commented 1 year ago

With joystick input, the wheel will suddenly turn almost 360 degrees. This is due to the fact of going from -179 degrees to 180 degrees, and vice versa.

The goal is to, of course, solve this issue and to prevent rotation if the wheel turns in one direction, if that ever becomes an issue.

ProgramDragon64 commented 1 year ago

Rev compensation complete. Will be checking wanted angle and given angle.

ProgramDragon64 commented 1 year ago

The rev compensation works, but is reset while turning. Seems to be happening from 0 to 1 or 0 to -1.

ProgramDragon64 commented 1 year ago

I have fixed the issue. I ended up rounding the value to the nearest revolution to solve the issue. The wheels will not randomly spin back, or spin back at a certain spot. The only time they will spin back is because that angle is closer that what it was.