Problem
Sometimes on enable (most of the time but not every time), the swerve modules would go really fast in a certain direction. This problem resolves itself on a power cycle (redeploying code does not resolve it).
For context and code familiarity, our code is a lightly modified version of AdvantageKit Advanced Swerve Example
What I tried to do
- Stack trace the runVelocity call (should be the only method that causes the modules to move). This leads me to DriveCommands.
- I added logging to ensure there are no mathematically problems or small oversights
The ChassisSpeeds log showed all values to be 0. - Even though the input ChassisSpeeds is 0, the robot is still moving so I added a log to runVelocity
- Despite all of this, the modules are still moving
Here is our GitHub repo GitHub - WheatleyRobotics/Reefscape
We would greatly appreciate any input or suggestion anyone can offer!
-Kaicheng 2872 Programming