-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge of 2024 Drivetrain code with 2025 Phoenix 6 library changes. TODO: Verify all swerve constants
- Loading branch information
1 parent
2a615fd
commit e5deec0
Showing
9 changed files
with
1,385 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package frc.robot.constants; | ||
|
||
public class CAN { | ||
public static final String rioCanbus = "rio"; | ||
public static String driveBaseCanbus = "drivebase"; | ||
|
||
public static final int pigeon = 9; | ||
|
||
public static final int frontLeftCanCoder = 10; | ||
public static final int frontRightCanCoder = 11; | ||
public static final int backLeftCanCoder = 12; | ||
public static final int backRightCanCoder = 13; | ||
|
||
public static final int frontLeftDriveMotor = 20; | ||
public static final int frontLeftTurnMotor = 21; | ||
public static final int frontRightDriveMotor = 22; | ||
public static final int frontRightTurnMotor = 23; | ||
public static final int backLeftDriveMotor = 24; | ||
public static final int backLeftTurnMotor = 25; | ||
public static final int backRightDriveMotor = 26; | ||
public static final int backRightTurnMotor = 27; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package frc.robot.constants; | ||
|
||
import edu.wpi.first.math.geometry.Translation2d; | ||
import edu.wpi.first.math.util.Units; | ||
|
||
public class SWERVE { | ||
public static double kTrackWidth = Units.inchesToMeters(21); | ||
public static final double kWheelBase = Units.inchesToMeters(19); | ||
public static final double kDriveBaseRadius = | ||
Math.sqrt(Math.pow(kTrackWidth / 2.0, 2) + Math.pow(kWheelBase / 2.0, 2)); | ||
|
||
// TODO: Reimplement/add to team library | ||
// public static final Map<MODULE_POSITION, Translation2d> kModuleTranslations = | ||
// Map.of( | ||
// MODULE_POSITION.FRONT_LEFT, | ||
// new Translation2d(kWheelBase / 2.0, kTrackWidth / 2.0), | ||
// MODULE_POSITION.FRONT_RIGHT, | ||
// new Translation2d(kWheelBase / 2.0, -kTrackWidth / 2.0), | ||
// MODULE_POSITION.BACK_LEFT, | ||
// new Translation2d(-kWheelBase / 2.0, kTrackWidth / 2.0), | ||
// MODULE_POSITION.BACK_RIGHT, | ||
// new Translation2d(-kWheelBase / 2.0, -kTrackWidth / 2.0)); | ||
// | ||
// public static final SwerveDriveKinematics kSwerveKinematics = | ||
// new SwerveDriveKinematics( | ||
// ModuleMap.orderedValues(kModuleTranslations, new Translation2d[0])); | ||
public static final Translation2d kFrontLeftPosition = | ||
new Translation2d(kWheelBase / 2.0, kTrackWidth / 2.0); | ||
public static final Translation2d kFrontRightPosition = | ||
new Translation2d(kWheelBase / 2.0, -kTrackWidth / 2.0); | ||
public static final Translation2d kBackLeftPosition = | ||
new Translation2d(-kWheelBase / 2.0, kTrackWidth / 2.0); | ||
public static final Translation2d kBackRightPosition = | ||
new Translation2d(-kWheelBase / 2.0, -kTrackWidth / 2.0); | ||
|
||
public static final double kMaxSpeedMetersPerSecond = Units.feetToMeters(18); | ||
public static final double kMaxRotationRadiansPerSecond = Math.PI * 2.0; | ||
|
||
// TODO: Verify values | ||
public static final double kDriveMotorGearRatio = 6.12; | ||
public static final double kTurnMotorGearRatio = 150.0 / 7.0; | ||
public static final double kCoupleRatio = 3.5714285714285716; // TODO: Verify | ||
public static final double kWheelRadiusInches = 1.95; | ||
public static final double kWheelDiameterMeters = 2.0 * Units.inchesToMeters(kWheelRadiusInches); | ||
|
||
public static final boolean[] kTurnInversions = {true, false, false, false}; | ||
public static final boolean[] kDriveInversions = {false, false, false, true}; | ||
|
||
// In rotations | ||
public static double kFrontLeftEncoderOffset = 0.219970703125; | ||
public static double kFrontRightEncoderOffset = 0.265380859375; | ||
public static double kBackLeftEncoderOffset = -0.046875; | ||
public static double kBackRightEncoderOffset = 0.328125; | ||
|
||
public static double kTurnKP = 100; | ||
public static double kTurnKI = 0; | ||
public static double kTurnKD = 0.5; | ||
public static double kTurnKS = 0.1; | ||
public static double kTurnKV = 1.91; | ||
public static double kTurnKA = 0; | ||
|
||
public static double kDriveKP = 0.1; | ||
public static double kDriveKI = 0; | ||
public static double kDriveKD = 0; | ||
public static double kDriveKS = 0; | ||
public static double kDriveKV = 0.124; | ||
public static double kDriveKA = 0; | ||
|
||
public static final double kTurnSatorCurrentLimit = 60; | ||
|
||
public static final double kSlipCurrent = 120.0; | ||
public static final double kDriveInertia = 0.01; | ||
public static final double kTurnInertia = 0.01; | ||
public static final double kDriveFrictionVoltage = 0.2; | ||
public static final double kTurnFrictionVoltage = 0.2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package frc.robot.constants; | ||
|
||
public final class USB { | ||
public static final int leftJoystick = 0; | ||
public static final int rightJoystick = 1; | ||
public static final int xBoxController = 2; | ||
|
||
public static final int testController = 3; | ||
} |
Oops, something went wrong.