Added support for CANandCoder

This commit is contained in:
thenetworkgrinch
2023-08-09 15:05:33 -05:00
parent d356dec4d0
commit f88fdfb6cf
4 changed files with 66 additions and 47 deletions

View File

@@ -68,6 +68,13 @@ public class ModuleJson
SwerveMotor angleMotor = angle.createMotor(false);
SwerveAbsoluteEncoder absEncoder = encoder.createEncoder(angleMotor);
// If the absolute encoder is attached.
if (absEncoder == null)
{
absEncoder = angle.createIntegratedEncoder(angleMotor);
angleMotor.setAbsoluteEncoder(absEncoder);
}
return new SwerveModuleConfiguration(
drive.createMotor(true),
angleMotor,