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

@@ -66,13 +66,19 @@ public class SwerveModulePhysicalCharacteristics
* @param driveEncoderPulsePerRotation The number of encoder pulses per motor rotation, 1 for integrated encoders.
* @param angleEncoderPulsePerRotation The number of encoder pulses per motor rotation, 1 for integrated encoders.
*/
public SwerveModulePhysicalCharacteristics(double driveGearRatio, double angleGearRatio,
double angleMotorFreeSpeedRPM,
double wheelDiameter, double wheelGripCoefficientOfFriction,
double optimalVoltage, int driveMotorCurrentLimit,
int angleMotorCurrentLimit, double driveMotorRampRate,
double angleMotorRampRate, int driveEncoderPulsePerRotation,
int angleEncoderPulsePerRotation)
public SwerveModulePhysicalCharacteristics(
double driveGearRatio,
double angleGearRatio,
double angleMotorFreeSpeedRPM,
double wheelDiameter,
double wheelGripCoefficientOfFriction,
double optimalVoltage,
int driveMotorCurrentLimit,
int angleMotorCurrentLimit,
double driveMotorRampRate,
double angleMotorRampRate,
int driveEncoderPulsePerRotation,
int angleEncoderPulsePerRotation)
{
this.wheelGripCoefficientOfFriction = wheelGripCoefficientOfFriction;
this.optimalVoltage = optimalVoltage;
@@ -106,12 +112,28 @@ public class SwerveModulePhysicalCharacteristics
* @param driveEncoderPulsePerRotation The number of encoder pulses per motor rotation, 1 for integrated encoders.
* @param angleEncoderPulsePerRotation The number of encoder pulses per motor rotation, 1 for integrated encoders.
*/
public SwerveModulePhysicalCharacteristics(double driveGearRatio, double angleGearRatio,
double angleMotorFreeSpeedRPM,
double wheelDiameter, double driveMotorRampRate, double angleMotorRampRate,
int driveEncoderPulsePerRotation, int angleEncoderPulsePerRotation)
public SwerveModulePhysicalCharacteristics(
double driveGearRatio,
double angleGearRatio,
double angleMotorFreeSpeedRPM,
double wheelDiameter,
double driveMotorRampRate,
double angleMotorRampRate,
int driveEncoderPulsePerRotation,
int angleEncoderPulsePerRotation)
{
this(driveGearRatio, angleGearRatio, angleMotorFreeSpeedRPM, wheelDiameter, 1.19, 12,
40, 20, driveMotorRampRate, angleMotorRampRate, driveEncoderPulsePerRotation, angleEncoderPulsePerRotation);
this(
driveGearRatio,
angleGearRatio,
angleMotorFreeSpeedRPM,
wheelDiameter,
1.19,
12,
40,
20,
driveMotorRampRate,
angleMotorRampRate,
driveEncoderPulsePerRotation,
angleEncoderPulsePerRotation);
}
}