Skip to content

Commit

Permalink
changed angle gear ratio and angle offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
Gael Valdez committed Dec 6, 2024
1 parent 35efb88 commit 1f981bf
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 12 deletions.
14 changes: 7 additions & 7 deletions src/main/java/frc/lib/util/swerve/SwerveModuleIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ public static class SwerveModuleInputs {
// public double angleMotorTemp;
}

public default void setModNumber(int number) {}
public void setModNumber(int number);

public default void updateInputs(SwerveModuleInputs inputs) {}
public void updateInputs(SwerveModuleInputs inputs);

public default void setDriveMotor(double mps) {}
public void setDriveMotor(double mps);

public default void setDriveMotorPower(double power) {}
public void setDriveMotorPower(double power);

public default void setAngleMotor(double angle) {}
public void setAngleMotor(double angle);

public default void setAngleSelectedSensorPosition(double angle) {}
public void setAngleSelectedSensorPosition(double angle);

public default void setPositionAngleMotor(double absolutePosition) {}
public void setPositionAngleMotor(double absolutePosition);

}
19 changes: 19 additions & 0 deletions src/main/java/frc/lib/util/swerve/SwerveModuleReal.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,23 @@ public void setPositionAngleMotor(double absolutePosition) {
mAngleMotor.setPosition(absolutePosition);
}

@Override
public void setModNumber(int number) {
// TODO Auto-generated method stub

Check warning on line 163 in src/main/java/frc/lib/util/swerve/SwerveModuleReal.java

View check run for this annotation

codefactor.io / CodeFactor

src/main/java/frc/lib/util/swerve/SwerveModuleReal.java#L163

Resolve unexpected comment. (com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck)
throw new UnsupportedOperationException("Unimplemented method 'setModNumber'");
}

@Override
public void setDriveMotorPower(double power) {
// TODO Auto-generated method stub

Check warning on line 169 in src/main/java/frc/lib/util/swerve/SwerveModuleReal.java

View check run for this annotation

codefactor.io / CodeFactor

src/main/java/frc/lib/util/swerve/SwerveModuleReal.java#L169

Resolve unexpected comment. (com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck)
throw new UnsupportedOperationException("Unimplemented method 'setDriveMotorPower'");
}

@Override
public void setAngleSelectedSensorPosition(double angle) {
// TODO Auto-generated method stub

Check warning on line 175 in src/main/java/frc/lib/util/swerve/SwerveModuleReal.java

View check run for this annotation

codefactor.io / CodeFactor

src/main/java/frc/lib/util/swerve/SwerveModuleReal.java#L175

Resolve unexpected comment. (com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck)
throw new UnsupportedOperationException(
"Unimplemented method 'setAngleSelectedSensorPosition'");
}

}
19 changes: 19 additions & 0 deletions src/main/java/frc/lib/util/swerve/SwerveModuleSim.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,23 @@ public void setDriveVoltage(double volts) {
driveAppliedVolts = MathUtil.clamp(volts, -12.0, 12.0);
driveSim.setInputVoltage(driveAppliedVolts);
}

@Override
public void setDriveMotorPower(double power) {
// TODO Auto-generated method stub

Check warning on line 95 in src/main/java/frc/lib/util/swerve/SwerveModuleSim.java

View check run for this annotation

codefactor.io / CodeFactor

src/main/java/frc/lib/util/swerve/SwerveModuleSim.java#L95

Resolve unexpected comment. (com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck)
throw new UnsupportedOperationException("Unimplemented method 'setDriveMotorPower'");
}

@Override
public void setAngleSelectedSensorPosition(double angle) {
// TODO Auto-generated method stub

Check warning on line 101 in src/main/java/frc/lib/util/swerve/SwerveModuleSim.java

View check run for this annotation

codefactor.io / CodeFactor

src/main/java/frc/lib/util/swerve/SwerveModuleSim.java#L101

Resolve unexpected comment. (com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck)
throw new UnsupportedOperationException(
"Unimplemented method 'setAngleSelectedSensorPosition'");
}

@Override
public void setPositionAngleMotor(double absolutePosition) {
// TODO Auto-generated method stub

Check warning on line 108 in src/main/java/frc/lib/util/swerve/SwerveModuleSim.java

View check run for this annotation

codefactor.io / CodeFactor

src/main/java/frc/lib/util/swerve/SwerveModuleSim.java#L108

Resolve unexpected comment. (com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck)
throw new UnsupportedOperationException("Unimplemented method 'setPositionAngleMotor'");
}
}
10 changes: 5 additions & 5 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public static final class Swerve {

/* Module Gear Ratios */
public static final double driveGearRatio = (8.14 / 1.0); // MK4i L1
public static final double angleGearRatio = ((150.0 / 7.0) / 1.0); // (150 / 7) : 1
public static final double angleGearRatio = (12.8 / 1.0); // (150 / 7) : 1

/* Motor Inverts */
public static final InvertedValue angleMotorInvert = InvertedValue.Clockwise_Positive;
Expand Down Expand Up @@ -278,7 +278,7 @@ public static final class Mod0 {
public static final int angleMotorID = 6;
public static final int canCoderID = 4;
// public static final Rotation2d angleOffset = Rotation2d.fromDegrees(183.955078125);
public static final Rotation2d angleOffset = Rotation2d.fromRotations(0.376953 + 0.5);
public static final Rotation2d angleOffset = Rotation2d.fromRotations(0.376221 + 0.75);

}

Expand All @@ -290,7 +290,7 @@ public static final class Mod1 {
public static final int angleMotorID = 5;
public static final int canCoderID = 3;
// public static final Rotation2d angleOffset = Rotation2d.fromDegrees(325.01953125);
public static final Rotation2d angleOffset = Rotation2d.fromRotations(-0.357178);
public static final Rotation2d angleOffset = Rotation2d.fromRotations(-0.355957 + 0.25);

}

Expand All @@ -302,7 +302,7 @@ public static final class Mod2 {
public static final int angleMotorID = 7;
public static final int canCoderID = 2;
// public static final Rotation2d angleOffset = Rotation2d.fromDegrees(124.62890625);
public static final Rotation2d angleOffset = Rotation2d.fromRotations(0.278809);
public static final Rotation2d angleOffset = Rotation2d.fromRotations(-0.223145 + 0.75);

}

Expand All @@ -314,7 +314,7 @@ public static final class Mod3 {
public static final int angleMotorID = 8;
public static final int canCoderID = 1;
// public static final Rotation2d angleOffset = Rotation2d.fromDegrees(295.400390625);
public static final Rotation2d angleOffset = Rotation2d.fromRotations(-0.409180 + 0.5);
public static final Rotation2d angleOffset = Rotation2d.fromRotations(0.095459 + 0.25);
}

public static final HolonomicPathFollowerConfig pathFollowerConfig =
Expand Down

0 comments on commit 1f981bf

Please sign in to comment.