Hi everyone,
I am currently working on getting our swerve drive (MK4, NEOs, TTB analog encoders) working again after it broke apart due to multiple compounding issues in the offseason so far. For now, I am currently just trying to get the wheels to turn in the direction I want them to turn, so I created a function that just drives all the modules in the same direction like a crab drive. I also have a function that resets the relative encoders to the absolute encoder positions. I’ve gotten it to the point that they all seem to work, except for one module that acts strangely.
I think I’ve traced the problem to the absolute encoder by printing the absolute encoder and relative encoder values to the dashboard, and what happens is all of the values match what is supposed to be happening, except the one absolute encoder that off by around 90 degrees. When driving straight forward, the relative encoders and 3 of the absolute encoders all print 0 radians, pi radians, or 2pi radians which is correct given optimize() is working correctly. However, the one absolute encoder is printing either 0.7 radians or 2 radians and alternating between those two values after I press the button that resets the encoders.
I have already checked the magnet and it appears to be glued properly as it doesn’t move when I try to move it either by touching or scratching it with a magnetic object. I believe we have been having this issue since last competition season where we would just spam the reset encoder button until the wheel was close enough that we could drive (janky I know). However, at the time I didn’t really think it was an issue as it would still drive (I think the other wheels would pretty much just drag it into position). Is there any way to diagnose/fix an issue with the encoders themselves? Should I just buy a replacement encoder?