Skip to content
14 changes: 7 additions & 7 deletions src/main/java/frc/robot/BuildConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ public final class BuildConstants {
public static final String MAVEN_GROUP = "";
public static final String MAVEN_NAME = "spike-rewrite";
public static final String VERSION = "unspecified";
public static final int GIT_REVISION = -1;
public static final String GIT_SHA = "UNKNOWN";
public static final String GIT_DATE = "UNKNOWN";
public static final String GIT_BRANCH = "UNKNOWN";
public static final String BUILD_DATE = "2025-06-04 21:53:16 EDT";
public static final long BUILD_UNIX_TIME = 1749088396225L;
public static final int DIRTY = 129;
public static final int GIT_REVISION = 7;
public static final String GIT_SHA = "b527fa151ac13544d5551783631fc9ac3a2f42ba";
public static final String GIT_DATE = "2025-07-21 22:23:17 EDT";
public static final String GIT_BRANCH = "main";
public static final String BUILD_DATE = "2025-07-23 11:39:41 EDT";
public static final long BUILD_UNIX_TIME = 1753285181494L;
public static final int DIRTY = 1;

private BuildConstants() {}
}
271 changes: 149 additions & 122 deletions src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
import static edu.wpi.first.units.Units.KilogramSquareMeters;
import static edu.wpi.first.units.Units.Pounds;

import edu.wpi.first.apriltag.AprilTagFieldLayout;
import edu.wpi.first.apriltag.AprilTagFields;
import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.math.geometry.Translation2d;
import edu.wpi.first.math.geometry.Translation3d;
import edu.wpi.first.math.kinematics.SwerveDriveKinematics;
import edu.wpi.first.math.system.plant.DCMotor;
import edu.wpi.first.math.util.Units;
import edu.wpi.first.units.measure.Mass;
import edu.wpi.first.units.measure.MomentOfInertia;
Expand Down Expand Up @@ -148,6 +151,103 @@ public static final class DriveConstants {
public static final MomentOfInertia kRobotMOI = KilogramSquareMeters.of(6.5);
}

public static final class ShooterConstants {
public static final LoggedTunableNumber kIdleVoltage =
new LoggedTunableNumber("Shooter/idleVoltage", 0.0);
public static final LoggedTunableNumber kTopRPS =
new LoggedTunableNumber("Shooter/topRPS", 0.0);
public static final LoggedTunableNumber kBottomRPS =
new LoggedTunableNumber("Shooter/bottomRPS", 0.0);
public static final LoggedTunableNumber kRejectingVoltage =
new LoggedTunableNumber("Shooter/rejectingVoltage", 0.0);
public static final LoggedTunableNumber kTopAmpVelocity =
new LoggedTunableNumber("Shooter/topAmpVelocity", 0);
public static final LoggedTunableNumber kBottomAmpVelocity =
new LoggedTunableNumber("Shooter/bottomAmpVelocity", 0);

public static final LoggedTunableNumber kTopShooterP =
new LoggedTunableNumber("Shooter/TopP", 0.0);
public static final LoggedTunableNumber kTopShooterI =
new LoggedTunableNumber("Shooter/TopI", 0.0);
public static final LoggedTunableNumber kTopShooterD =
new LoggedTunableNumber("Shooter/TopD", 0.0);
public static final LoggedTunableNumber kBottomShooterP =
new LoggedTunableNumber("Shooter/BottomP", 0.0);
public static final LoggedTunableNumber kBottomShooterI =
new LoggedTunableNumber("Shooter/BottomI", 0.0);
public static final LoggedTunableNumber kBottomShooterD =
new LoggedTunableNumber("Shooter/BottomD", 0.0);

public static final LoggedTunableNumber kTopKs = new LoggedTunableNumber("Shooter/TopKs", 0.0);
public static final LoggedTunableNumber kTopKv = new LoggedTunableNumber("Shooter/TopKv", 0.0);
public static final LoggedTunableNumber kBottomKs =
new LoggedTunableNumber("Shooter/BottomKs", 0.0);
public static final LoggedTunableNumber kBottomKv =
new LoggedTunableNumber("Shooter/BottomKv", 0.0);

// sim
public static final DCMotor kTopDCMotor = DCMotor.getNEO(1);
public static final DCMotor kBottomDCMotor = DCMotor.getNEO(1);
public static final double kSimMOI = 0.0;
public static final double kSimGearing = 0.0;

public static final LoggedTunableNumber kSimTopShooterP =
new LoggedTunableNumber("Shooter/SimTopP", 0.0);
public static final LoggedTunableNumber kSimTopShooterI =
new LoggedTunableNumber("Shooter/SimTopI", 0.0);
public static final LoggedTunableNumber kSimTopShooterD =
new LoggedTunableNumber("Shooter/SimTopD", 0.0);
public static final LoggedTunableNumber kSimBottomShooterP =
new LoggedTunableNumber("Shooter/SimBottomP", 0.0);
public static final LoggedTunableNumber kSimBottomShooterI =
new LoggedTunableNumber("Shooter/SimBottomI", 0.0);
public static final LoggedTunableNumber kSimBottomShooterD =
new LoggedTunableNumber("Shooter/SimBottomD", 0.0);

public static final LoggedTunableNumber kSimTopKs =
new LoggedTunableNumber("Shooter/SimTopKs", 0.0);
public static final LoggedTunableNumber kSimTopKv =
new LoggedTunableNumber("Shooter/SimTopKv", 0.0);
public static final LoggedTunableNumber kSimBottomKs =
new LoggedTunableNumber("Shooter/SimBottomKs", 0.0);
public static final LoggedTunableNumber kSimBottomKv =
new LoggedTunableNumber("Shooter/SimBottomKv", 0.0);
}

public static final class IndexerConstants {
public static final LoggedTunableNumber kIdleVoltage =
new LoggedTunableNumber("Indexer/idleVoltage", 0.0);
public static final LoggedTunableNumber kIntakingVoltage =
new LoggedTunableNumber("Indexer/intakingVoltage", 0.0);
public static final LoggedTunableNumber kIndexingVoltage =
new LoggedTunableNumber("Indexer/indexingVoltage", 0.0);
public static final LoggedTunableNumber kReversingVoltage =
new LoggedTunableNumber("Indexer/reversingVoltage", 0.0);
public static final LoggedTunableNumber kShootingVoltage =
new LoggedTunableNumber("Indexer/shootingVoltage", 0.0);
public static final LoggedTunableNumber kVomitVoltage =
new LoggedTunableNumber("Indexer/vomitVoltage", 0.0);

// sim
public static final DCMotor kDCMotor = DCMotor.getNEO(1);
public static final double kSimMOI = 0.0;
public static final double kSimGearing = 0.0;
}

public static final class IntakeConstants {
public static final LoggedTunableNumber kIdleVoltage =
new LoggedTunableNumber("Intake/idleVoltage", 0.0);
public static final LoggedTunableNumber kIntakingVoltage =
new LoggedTunableNumber("Intake/intakingVoltage", 0.0);
public static final LoggedTunableNumber kVomitVoltage =
new LoggedTunableNumber("Intake/vomitVoltage", 0.0);

// sim
public static final DCMotor kDCMotor = DCMotor.getNEO(1);
public static final double kSimMOI = 0.0;
public static final double kSimGearing = 0.0;
}

public static final class Ports {
public static final int kFrontLeftDrive = 0;
public static final int kFrontLeftTurn = 1;
Expand All @@ -165,6 +265,15 @@ public static final class Ports {
public static final int kBackRightTurn = 10;
public static final int kBackRightCancoder = 11;

public static final int kIndexer = 0;
public static final int kPhotoelectric1 = 0;
public static final int kPhotoelectric2 = 0;

public static final int kIntake = 0;

public static final int kTopShooter = 0;
public static final int kBottomShooter = 0;

public static final int kPigeon = 22;

public static final String kDriveCanivoreName = "Drivetrain";
Expand All @@ -181,129 +290,47 @@ public static final class CurrentLimitConstants {
public static final double kTurnDefaultStatorCurrentLimit = 120.0;
}

public class FieldConstants {
public static final class FieldConstants {
// copied from frc-24 with some minor tweaks

public static final Translation2d kSource = new Translation2d(15.696, 0.701);

public static final Translation3d kTopRightSpeaker =
new Translation3d(
Units.inchesToMeters(0.0), Units.inchesToMeters(238.815), Units.inchesToMeters(83.091));

public static final Translation3d kTopLeftSpeaker =
new Translation3d(
Units.inchesToMeters(18.055),
Units.inchesToMeters(197.765),
Units.inchesToMeters(83.091));

public static final Translation3d kBottomRightSpeaker =
new Translation3d(0.0, Units.inchesToMeters(238.815), Units.inchesToMeters(78.324));
public static final Translation3d kBottomLeftSpeaker =
new Translation3d(0.0, Units.inchesToMeters(197.765), Units.inchesToMeters(78.324));

/** Center of the speaker opening (blue alliance) */
public static final Translation3d kCenterSpeakerOpening =
kBottomLeftSpeaker.interpolate(kTopRightSpeaker, 0.5);

public static final double kFieldLength = Units.inchesToMeters(651.223);
public static final double kFieldWidth = Units.inchesToMeters(323.277);
public static final double wingX = Units.inchesToMeters(229.201);
public static final double podiumX = Units.inchesToMeters(126.75);
public static final double startingLineX = Units.inchesToMeters(74.111);

public static final Translation2d ampCenter =
new Translation2d(Units.inchesToMeters(72.455), kFieldWidth);

/** Staging locations for each note */
public static final class StagingLocations {
public static final double centerlineX = kFieldLength / 2.0;

// need to update
public static final double centerlineFirstY = Units.inchesToMeters(29.638);
public static final double centerlineSeparationY = Units.inchesToMeters(66);
public static final double spikeX = Units.inchesToMeters(114);
// need
public static final double spikeFirstY = Units.inchesToMeters(161.638);
public static final double spikeSeparationY = Units.inchesToMeters(57);

public static final Translation2d[] centerlineTranslations = new Translation2d[5];
public static final Translation2d[] spikeTranslations = new Translation2d[3];

static {
for (int i = 0; i < centerlineTranslations.length; i++) {
centerlineTranslations[i] =
new Translation2d(centerlineX, centerlineFirstY + (i * centerlineSeparationY));
}
}

static {
for (int i = 0; i < spikeTranslations.length; i++) {
spikeTranslations[i] = new Translation2d(spikeX, spikeFirstY + (i * spikeSeparationY));
}
}
}

/** Each corner of the speaker * */
public static final class Speaker {

// corners (blue alliance origin)
public static final Translation3d topRightSpeaker =
new Translation3d(
Units.inchesToMeters(18.055),
Units.inchesToMeters(238.815),
Units.inchesToMeters(83.091));

public static final Translation3d topLeftSpeaker =
new Translation3d(
Units.inchesToMeters(18.055),
Units.inchesToMeters(197.765),
Units.inchesToMeters(83.091));

public static final Translation3d bottomRightSpeaker =
new Translation3d(0.0, Units.inchesToMeters(238.815), Units.inchesToMeters(78.324));
public static final Translation3d bottomLeftSpeaker =
new Translation3d(0.0, Units.inchesToMeters(197.765), Units.inchesToMeters(78.324));

/** Center of the speaker opening (blue alliance) */
public static final Translation3d centerSpeakerOpening =
bottomLeftSpeaker.interpolate(topRightSpeaker, 0.5);
}

public static final class Subwoofer {
public static final Pose2d ampFaceCorner =
new Pose2d(
Units.inchesToMeters(35.775),
Units.inchesToMeters(239.366),
Rotation2d.fromDegrees(-120));

public static final Pose2d sourceFaceCorner =
new Pose2d(
Units.inchesToMeters(35.775),
Units.inchesToMeters(197.466),
Rotation2d.fromDegrees(120));

public static final Pose2d centerFace =
new Pose2d(
Units.inchesToMeters(35.775),
Units.inchesToMeters(218.416),
Rotation2d.fromDegrees(180));
}

public static final class Stage {
public static final Pose2d podiumLeg =
new Pose2d(Units.inchesToMeters(126.75), Units.inchesToMeters(161.638), new Rotation2d());
public static final Pose2d ampLeg =
new Pose2d(
Units.inchesToMeters(220.873),
Units.inchesToMeters(212.425),
Rotation2d.fromDegrees(-30));
public static final Pose2d sourceLeg =
new Pose2d(
Units.inchesToMeters(220.873),
Units.inchesToMeters(110.837),
Rotation2d.fromDegrees(30));

public static final Pose2d centerPodiumAmpChain =
new Pose2d(
podiumLeg.getTranslation().interpolate(ampLeg.getTranslation(), 0.5),
Rotation2d.fromDegrees(120.0));
public static final Pose2d centerAmpSourceChain =
new Pose2d(
ampLeg.getTranslation().interpolate(sourceLeg.getTranslation(), 0.5),
new Rotation2d());
public static final Pose2d centerSourcePodiumChain =
new Pose2d(
sourceLeg.getTranslation().interpolate(podiumLeg.getTranslation(), 0.5),
Rotation2d.fromDegrees(240.0));
public static final Pose2d center =
new Pose2d(Units.inchesToMeters(192.55), Units.inchesToMeters(161.638), new Rotation2d());
public static final double centerToChainDistance =
center.getTranslation().getDistance(centerPodiumAmpChain.getTranslation());
}

public static final class Amp {
public static final Translation2d ampTapeTopCorner =
new Translation2d(Units.inchesToMeters(130.0), Units.inchesToMeters(305.256));
public static final double ampBottomY = kFieldWidth - Units.inchesToMeters(17.75);
}

public static final double aprilTagWidth = Units.inchesToMeters(6.50);
public static final double kWingX = Units.inchesToMeters(229.201);
public static final double kPodiumX = Units.inchesToMeters(126.75);
public static final double kStartingLineX = Units.inchesToMeters(74.111);

public static final double kAprilTagWidth = Units.inchesToMeters(6.5);
public static final AprilTagFieldLayout kAprilTagLayout =
AprilTagFields.k2024Crescendo.loadAprilTagLayoutField();

public static final Pose2d kAmpBlue = new Pose2d(1.749, 7.82, Rotation2d.fromDegrees(90));
public static final Pose2d kDailedShot = new Pose2d(2.95, 4.08, new Rotation2d(145.00));
public static final Translation2d kCorner = new Translation2d(0, 7.82);
public static final Translation2d kFeederAim = new Translation2d(1, 6.82);
public static final Translation2d kSourceMidShot = new Translation2d(8.04, kFieldWidth - 2);

// halfway between midline and wing
public static final Translation2d kFeedingSetpoint = new Translation2d(7.137, 0.872);
}
}
Loading