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

@@ -23,7 +23,8 @@ public class SwerveControllerConfiguration
/**
* hypotenuse deadband for the robot angle control joystick.
*/
public final double angleJoyStickRadiusDeadband; // Deadband for the minimum hypot for the heading joystick.
public final double
angleJoyStickRadiusDeadband; // Deadband for the minimum hypot for the heading joystick.
/**
* Construct the swerve controller configuration.
@@ -32,13 +33,17 @@ public class SwerveControllerConfiguration
* @param headingPIDF Heading PIDF configuration.
* @param angleJoyStickRadiusDeadband Deadband on radius of angle joystick.
*/
public SwerveControllerConfiguration(SwerveDriveConfiguration driveCfg, PIDFConfig headingPIDF,
double angleJoyStickRadiusDeadband)
public SwerveControllerConfiguration(
SwerveDriveConfiguration driveCfg,
PIDFConfig headingPIDF,
double angleJoyStickRadiusDeadband)
{
this.maxSpeed = driveCfg.maxSpeed;
this.maxAngularVelocity = calculateMaxAngularVelocity(driveCfg.maxSpeed,
Math.abs(driveCfg.moduleLocationsMeters[0].getX()),
Math.abs(driveCfg.moduleLocationsMeters[0].getY()));
this.maxAngularVelocity =
calculateMaxAngularVelocity(
driveCfg.maxSpeed,
Math.abs(driveCfg.moduleLocationsMeters[0].getX()),
Math.abs(driveCfg.moduleLocationsMeters[0].getY()));
this.headingPIDF = headingPIDF;
this.angleJoyStickRadiusDeadband = angleJoyStickRadiusDeadband;
}
@@ -54,5 +59,4 @@ public class SwerveControllerConfiguration
{
this(driveCfg, headingPIDF, 0.5);
}
}