Swerve Modules driving out of control

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

  1. Stack trace the runVelocity call (should be the only method that causes the modules to move). This leads me to DriveCommands.
  2. I added logging to ensure there are no mathematically problems or small oversights

    The ChassisSpeeds log showed all values to be 0.
  3. Even though the input ChassisSpeeds is 0, the robot is still moving so I added a log to runVelocity

  4. 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

When you create your motor object, do you tell your motors to stop moving?
the motor controller remembers the last request it was given and sets the motor to it.
I do not think restore factory defaults deletes that memory

I will try that, thank you very much! Do you have any theory as to why this happens in the first place? Before the code gets deployed the modules are at rest so there shouldn’t be a previous request.

I think that is possible when you drive the bot, and then disable it while still driving, making that the motor controller remembers it’s request, but doesn’t move since the robot is disabled