Skip to content

Commit

Permalink
Made swerve work, modules mirrored
Browse files Browse the repository at this point in the history
  • Loading branch information
NoraZitnick committed Oct 12, 2024
1 parent 82283f0 commit a523103
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,12 @@ public static final class Modules {
public static final class Params {
public static final double WHEEL_RADIUS = 2; // also in INCHES
public static final double COUPLING_GEAR_RATIO = 3.125;
public static final double DRIVE_GEAR_RATIO = 6.12;
public static final double STEER_GEAR_RATIO = 12.8;
public static final double DRIVE_GEAR_RATIO = 5.357142857142857;
public static final double STEER_GEAR_RATIO = 21.428571428571427;
public static final Slot0Configs DRIVE_MOTOR_GAINS =
new Slot0Configs().withKP(0.1).withKI(0).withKD(0).withKS(0.21).withKV(0.694).withKA(0);
new Slot0Configs().withKP(3).withKI(0).withKD(0).withKS(0.21).withKV(0.694).withKA(0);
public static final Slot0Configs STEER_MOTOR_GAINS =
new Slot0Configs().withKP(0.2).withKI(0).withKD(0).withKS(0.17).withKV(2.5).withKA(0);
new Slot0Configs().withKP(11).withKI(0).withKD(0).withKS(0.17).withKV(2.5).withKA(0);
public static final ClosedLoopOutputType DRIVE_CLOSED_LOOP_OUTPUT =
ClosedLoopOutputType.Voltage;
public static final ClosedLoopOutputType STEER_CLOSED_LOOP_OUTPUT =
Expand All @@ -180,7 +180,7 @@ public static final class Params {
public static final SteerRequestType steerRequestType = SteerRequestType.MotionMagic;
}

public static final class Module1 { // front right
public static final class Module2 { // front left
public static final int DRIVE_MOTOR = CAN.at(6, "module 1 drive motor");
public static final int STEER_MOTOR = CAN.at(5, "module 1 steer motor");
public static final int STEER_ENCODER = CAN.at(1, "module 1 steer encoder");
Expand All @@ -191,7 +191,7 @@ public static final class Module1 { // front right
: -0.185302734375; // practice bot offset
}

public static final class Module2 { // front left
public static final class Module1 { // front right
public static final int DRIVE_MOTOR = CAN.at(7, "module 2 drive motor");
public static final int STEER_MOTOR = CAN.at(8, "module 2 steer motor");
public static final int STEER_ENCODER = CAN.at(2, "module 2 steer encoder");
Expand All @@ -202,25 +202,25 @@ public static final class Module2 { // front left
: -0.127685546875; // practice bot offset
}

public static final class Module3 { // back right
public static final class Module4 { // back left
public static final int DRIVE_MOTOR = CAN.at(12, "module 3 drive motor");
public static final int STEER_MOTOR = CAN.at(11, "module 3 steer motor");
public static final int STEER_ENCODER = CAN.at(3, "module 3 steer encoder");

public static final double STEER_OFFSET =
IS_COMP_BOT
? -0.2255859375 // comp bot offset
? -0.227783203125 // comp bot offset
: -0.228759765625; // practice bot offset
}

public static final class Module4 { // back left
public static final class Module3 { // back right
public static final int DRIVE_MOTOR = CAN.at(10, "module 4 drive motor");
public static final int STEER_MOTOR = CAN.at(9, "module 4 steer motor");
public static final int STEER_ENCODER = CAN.at(4, "module 4 steer encoder");

public static final double STEER_OFFSET =
IS_COMP_BOT
? 0.291259765625 // comp bot offset
? 0.294189453125 // comp bot offset
: 0.2939453125; // practice bot offset
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/frc/robot/subsystems/DrivebaseSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public DrivebaseSubsystem(VisionSubsystem visionSubsystem) {
Modules.Module2.STEER_OFFSET,
Dims.TRACKWIDTH_METERS / 2.0,
Dims.TRACKWIDTH_METERS / 2.0,
true);
false);

// module wheel positions taken from kinematics object
final SwerveModuleConstants frontRight =
Expand All @@ -174,7 +174,7 @@ public DrivebaseSubsystem(VisionSubsystem visionSubsystem) {
Modules.Module1.STEER_OFFSET,
Dims.TRACKWIDTH_METERS / 2.0,
-Dims.TRACKWIDTH_METERS / 2.0,
false);
true);

// module wheel positions taken from kinematics object
final SwerveModuleConstants backLeft =
Expand All @@ -185,7 +185,7 @@ public DrivebaseSubsystem(VisionSubsystem visionSubsystem) {
Modules.Module4.STEER_OFFSET,
-Dims.TRACKWIDTH_METERS / 2.0,
Dims.TRACKWIDTH_METERS / 2.0,
true);
false);

// module wheel positions taken from kinematics object
final SwerveModuleConstants backRight =
Expand All @@ -196,7 +196,7 @@ public DrivebaseSubsystem(VisionSubsystem visionSubsystem) {
Modules.Module3.STEER_OFFSET,
-Dims.TRACKWIDTH_METERS / 2.0,
-Dims.TRACKWIDTH_METERS / 2.0,
false);
true);

swerveDrivetrain =
new SwerveDrivetrain(
Expand Down

0 comments on commit a523103

Please sign in to comment.