Updated swerve module optimizations and moved math to SwerveMath.

This commit is contained in:
thenetworkgrinch
2023-03-29 07:24:24 -05:00
parent 8d83836a8a
commit d160c01364
121 changed files with 813 additions and 597 deletions

View File

@@ -46,6 +46,12 @@ public class SwerveModulePhysicalCharacteristics
* Free speed rotations per minute of the motor, as described by the vendor.
*/
public final double angleMotorFreeSpeedRPM;
/**
* Angle motor kV used for second order kinematics to tune the feedforward, this variable should be adjusted so that
* your drive train does not drift towards the direction you are rotating while you translate. When set to 0 the
* calculated kV will be used.
*/
public final double angleMotorKV;
/**
* Construct the swerve module physical characteristics.
@@ -78,7 +84,8 @@ public class SwerveModulePhysicalCharacteristics
double driveMotorRampRate,
double angleMotorRampRate,
int driveEncoderPulsePerRotation,
int angleEncoderPulsePerRotation)
int angleEncoderPulsePerRotation,
double angleMotorKV)
{
this.wheelGripCoefficientOfFriction = wheelGripCoefficientOfFriction;
this.optimalVoltage = optimalVoltage;
@@ -94,6 +101,7 @@ public class SwerveModulePhysicalCharacteristics
this.angleMotorCurrentLimit = angleMotorCurrentLimit;
this.driveMotorRampRate = driveMotorRampRate;
this.angleMotorRampRate = angleMotorRampRate;
this.angleMotorKV = angleMotorKV;
}
/**
@@ -134,6 +142,6 @@ public class SwerveModulePhysicalCharacteristics
driveMotorRampRate,
angleMotorRampRate,
driveEncoderPulsePerRotation,
angleEncoderPulsePerRotation);
angleEncoderPulsePerRotation, 0);
}
}