Robot not driving straight

Our robot has a significant problem in the sense that it cannot drive in a straight line without rotating. We have already tried making sure the swerve magnets are set in place and have spent hours testing PID values, yet we have still no success. We are wondering what the problem could be. Thanks!

Sounds like a module misalignment to me.

Due to numerous factors, the speed of all of your modules is never going to be exactly the same, which will cause heading drift over time. You can mitigate this by running closed loop velocity control on all of your modules, but the best solution is to use PID to maintain your robots heading.

The way we do it is if the driver has not given a turn input for .5s it will store the current gyro angle and use PID to keep the desired heading. I would recommend resetting this value whenever you reset your gyro or disable the robot to prevent unexpected and violent spins.