I am attempting to initialize the zero angle with the CANcoders and then use the SPARK MAX to drive the turn motors with the internal PID. I have gotten it to the point where the motors react correctly to driving, but all point to an incorrect zero. Further more, the zero point is different for each of them every time I redeploy code.
I have checked the offset angle dozens of times through Phoenix Tuner; I must be doing something else wrong.
Could someone check my SwerveModule.java and see where I am going wrong? The drive subsystem and robot container remain the same from previous years doing swerve drive, so I am assuming I am setting this up wrong.
Thanks for the help. I already had it boot to absolute so I added the second option. They all reported “Ok” every time so that is nice to see.
I fixed my offsets as someone had changed the range to unsigned 0-360. All the modules point in the same direction now.
However, I have a new problem. While I can turn to the correct position, the modules jitter a lot when going to position. They don’t oscillate around setpoint, just jitter while going there.
No problem! If you look at your DriverStation Log (Driver Station Log File Viewer — FIRST Robotics Competition documentation) you can look at the current draw of your PDPCTRE's Power Distribution Panel/PDHREV's Power Distribution Hub. If you continue to see Jitter like that you may want to add or adjust your current limiting on your swerve module motors. Additionally voltage compensation could help.
we had this same issue like 2 years ago, spent hour trying to do offsets everytime it kept changing and we were so confused, turns out the battery was just low lol. happy you figured it out