I am working on programming a swerve drivetrain, and I seem to be having an issue with the orientation of the encoders. I am using 4 MK3 SDS Falcon swerve modules as well as 4 CANCoders. I have the CANCoders configured to report 0-360.
I am booting them to absolute position and am able to control the position of each module. My zeroing process is as follows:
- Turn each module so they are facing my desired zero.
- Take the angle of each CANCoder.
- Set the magnetOffset to the opposite of what each CANCoder reads.
- Reboot the robot.
This process is not working, and I am not sure why. Is there another way to zero the CANCoder? Print statements in my code make it appear as though the changing of the offset is working, but it does not appear to be.
Any advice is appreciated.