Issues with swerve offset

Our team is having issues with angle offset issues - our codebase is based off of 364’s swerve base but adapted for NEO motors, we are still using CANCoders though. Currently when redeploying code, the angle offsets which are supposed to be constant seem to change and essentially cause the drive to not drive straight. We have gone through a ton of the resources posted here for potential fixes including:

  • waitForUpdate on the cancoders
  • Phoenix 5/6 mismatch
  • magnet loctite
  • sensor initialization/booting to absolute (which we don’t think applies for phoenix 6?)
  • sensor range
  • cancoder seeding (which always returns that seeding is successful)
  • waiting a couple of seconds before seeding

If anyone has any fixes please let us know!

We are using MK4is from SDS. this is what we’re doing with the waitForUpdate():

public Rotation2d getCanCoderWithUpdate() {
      var posVal = angleEncoder.getAbsolutePosition().waitForUpdate(1);
      var val = Rotation2d.fromRotations(angleEncoder.getAbsolutePosition().getValue());
      if (posVal.getStatus().isOK()) {
                val = Rotation2d.fromRotations(posVal.getValueAsDouble());
        System.out.println("Success in getting rotation! Angle for posval: " + Rotation2d.fromRotations(posVal.getValueAsDouble()));
      }
      else {
        System.out.println("Failed to get accurate rotation! Error: " + posVal.getStatus());
      }
    return val;
  }

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.