We have had an issue with our swerve code. When we start driving, the wheels are aligned properly. After driving it for a bit, however, the wheels start to drift in different directions. We have a test button which resets the wheel positions to the offsets, but it doesn’t produce the expected result. The encoder printouts on Shuffleboard say that the wheels are at their correct offset, but the wheels are still pointing in different directions.
Are you using an off-the-shelf swerve module? Could you provide some information about your swerve module? Are you using an absolute encoder? Does your feedback control run off of the absolute encoder, or are you using the onboard encoders of falcons or neos?
Depending on what module you have, here are some common issues people have run across this season that meet your symptoms:
Make sure all absolute encoders don’t have any drift (i.e. magnet properly retained)
Make sure motor pinions are not slipping if they are a press on, this may be hard to tell and difficult to do by hand, but putting a mark with a paint pen or something so you can see where the pinions is clocked relative to the shaft, running the modules, then check to see if the clocking mark has moved will give you an idea.
what kind of modules are you using, could you send a picture of the modules on the chassis, this sounds more like an issue relating to how the magnet on the absolute encoder is retained than a code issue
I am more concerned about the magnets in the shaft of the encoder. If those are loose then they move relativ to the shaft and produce the behavior you described.