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

@@ -199,6 +199,7 @@ public class SparkMaxSwerve extends SwerveMotor
{
int pidSlot =
isDriveMotor ? SparkMAX_slotIdx.Velocity.ordinal() : SparkMAX_slotIdx.Position.ordinal();
pidSlot = 0;
pid.setP(config.p, pidSlot);
pid.setI(config.i, pidSlot);
pid.setD(config.d, pidSlot);
@@ -293,8 +294,11 @@ public class SparkMaxSwerve extends SwerveMotor
@Override
public void setReference(double setpoint, double feedforward)
{
boolean possibleBurnOutIssue = true;
int pidSlot =
isDriveMotor ? SparkMAX_slotIdx.Velocity.ordinal() : SparkMAX_slotIdx.Position.ordinal();
pidSlot = 0;
if (isDriveMotor)
{
pid.setReference(
@@ -306,7 +310,8 @@ public class SparkMaxSwerve extends SwerveMotor
{
pid.setReference(
setpoint,
ControlType.kPosition);
ControlType.kPosition,
pidSlot);
}
}