Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver-Cushman committed Oct 25, 2024
2 parents 3027438 + e5dd4d1 commit 067d2c4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import edu.wpi.first.wpilibj2.command.CommandScheduler;
import frc.robot.util.Constants.AutoConstants;
import frc.robot.util.Constants.DriveConstants;
import frc.robot.util.Constants.FieldConstants;
import frc.robot.util.Constants.NeoMotorConstants;
import frc.robot.util.Constants.LoggingConstants;
import frc.robot.util.rev.Neo;
Expand Down Expand Up @@ -125,7 +126,11 @@ public void disabledPeriodic() {
// Now while this may not necessarily be a constant...
// it needs to be updated.
DriverStation.refreshData();
if (!Robot.alliance.equals(Optional.of(DriverStation.getAlliance()))) {
robotContainer.set3GPriorityTagID(FieldConstants.SPEAKER_MID_TAGS[Robot.isRedAlliance() ? 0 : 1]);
}
Robot.alliance = DriverStation.getAlliance();

}

@Override
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ public RobotContainer() {

pdh.setSwitchableChannel(false);

set3GPriorityTagID(FieldConstants.SPEAKER_MID_TAGS[Robot.isRedAlliance() ? 0 : 1]);

}

private void configureButtonBindings() {
Expand Down Expand Up @@ -908,6 +910,10 @@ private Command enableVision() {
return Commands.runOnce(() -> enableVision = true).ignoringDisable(true);
}

public void set3GPriorityTagID(int id) {
limelight3g.setPriorityTagID(id);
}

private void registerPathToPathCommands() {
for (int i = 1; i <= FieldConstants.CENTER_NOTE_COUNT; i++) {
for (int j = 1; j <= FieldConstants.CENTER_NOTE_COUNT; j++) {
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/frc/robot/subsystems/vision/Limelight.java
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,10 @@ public void disableLEDS() {
LimelightHelpers.setLEDMode_ForceOff(limelightName);
}

public void setPriorityTagID(int id) {
LimelightHelpers.setPriorityTagID(limelightName, id);
}

@Override
public void updateInputs(LimelightIOInputs inputs) {
Results results = getResults();
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/frc/robot/util/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,8 @@ public static final class FieldConstants {

public static final double PASS_HEIGHT_METERS = Units.feetToMeters(9.5);

public static final int[] SPEAKER_MID_TAGS = {4, 7};

// Field:
// https://cad.onshape.com/documents/dcbe49ce579f6342435bc298/w/b93673f5b2ec9c9bdcfec487/e/6ecb2d6b7590f4d1c820d5e3
// Chain Positions: Blue alliance left
Expand Down

0 comments on commit 067d2c4

Please sign in to comment.