Addressing issue #7 by reading CANCoder values until successful with 10ms delay between readings. Fall back to reading relative encoder.

This commit is contained in:
thenetworkgrinch
2023-02-20 20:59:31 -06:00
parent 8f9ffdf031
commit dd28a657b2
43 changed files with 570 additions and 363 deletions

View File

@@ -53,9 +53,11 @@ public class ModuleJson
* @param physicalCharacteristics Physical characteristics of the swerve module.
* @return {@link SwerveModuleConfiguration} based on the provided data and parsed data.
*/
public SwerveModuleConfiguration createModuleConfiguration(PIDFConfig anglePIDF, PIDFConfig velocityPIDF,
double maxSpeed,
SwerveModulePhysicalCharacteristics physicalCharacteristics)
public SwerveModuleConfiguration createModuleConfiguration(
PIDFConfig anglePIDF,
PIDFConfig velocityPIDF,
double maxSpeed,
SwerveModulePhysicalCharacteristics physicalCharacteristics)
{
SwerveMotor angleMotor = angle.createMotor(false);
SwerveAbsoluteEncoder absEncoder = encoder.createEncoder();
@@ -67,10 +69,19 @@ public class ModuleJson
angleMotor.setAbsoluteEncoder(absEncoder);
}
return new SwerveModuleConfiguration(drive.createMotor(true), angleMotor, absEncoder,
absoluteEncoderOffset, Units.inchesToMeters(location.x),
Units.inchesToMeters(location.y), anglePIDF, velocityPIDF, maxSpeed,
physicalCharacteristics, absoluteEncoderInverted, inverted.drive,
inverted.angle);
return new SwerveModuleConfiguration(
drive.createMotor(true),
angleMotor,
absEncoder,
absoluteEncoderOffset,
Units.inchesToMeters(location.x),
Units.inchesToMeters(location.y),
anglePIDF,
velocityPIDF,
maxSpeed,
physicalCharacteristics,
absoluteEncoderInverted,
inverted.drive,
inverted.angle);
}
}