]> git.taranathan.com Git - FRC2026.git/commitdiff
hopefully made inactive hub stuff
authorEthan Mortensen <ethanmortensen20@gmail.com>
Fri, 20 Feb 2026 19:00:08 +0000 (11:00 -0800)
committerEthan Mortensen <ethanmortensen20@gmail.com>
Fri, 20 Feb 2026 19:00:08 +0000 (11:00 -0800)
hopefully it works

src/main/java/frc/robot/commands/led_comm/LEDDefaultCommand.java

index 21d284035da804cbd4e243f31f7d18d9ace7fcb1..47e4ca5508e123b0a6d6cc6577e2a35ed5b4043e 100644 (file)
@@ -17,17 +17,19 @@ public class LEDDefaultCommand extends Command {
     private double climbYCoordinate = 1.08;
     private boolean allianceIsRed = DriverStation.getAlliance().get() == DriverStation.Alliance.Red;
 
+    private String gameData = DriverStation.getGameSpecificMessage();
+
     public LEDDefaultCommand(LED led, Drivetrain drivetrain, Vision vision) {
         this.led = led;
         // this.outtake = outtake;
         this.drivetrain = drivetrain;
         this.vision = vision;
-
         addRequirements(led);
     }
 
     @Override
     public void execute() {
+        double matchTime = DriverStation.getMatchTime();
         if (vision.oneCameraDisconnected()) {
             // flash if camera disconnected
             led.setStrobeLights(255, 100, 0);
@@ -40,6 +42,18 @@ public class LEDDefaultCommand extends Command {
         } else if (DriverStation.isAutonomous()){
             // Dimmer light for auto in blue alliance
             led.setLEDs(0, 0, 100);
+        } else if ((allianceIsRed && gameData.equals("B") && matchTime <= 105 && matchTime >= 80) || (allianceIsRed && gameData.equals("B") && matchTime <= 55 && matchTime >= 30)) {
+            // turn light off for inactive hub if red alliance and blue inactive first
+            led.setLEDs(0, 0, 0);
+        } else if ((allianceIsRed && gameData.equals("B") && matchTime <= 130 && matchTime >= 105) || (allianceIsRed && gameData.equals("B") && matchTime <= 80 && matchTime >= 55)) {
+            // turn light off for inactive hub if red alliance and red inactive first
+            led.setLEDs(0, 0, 0);
+        } else if ((gameData.equals("R") && matchTime <= 130 && matchTime >= 105) || (gameData.equals("R") && matchTime <= 80 && matchTime >= 55)) {
+            // turn off lights for inactive hub if blue alliance and blue inactive first
+            led.setLEDs(0, 0, 0);
+        } else if ((gameData.equals("R") && matchTime <= 105 && matchTime >= 80) || (gameData.equals("R") && matchTime <= 55 && matchTime >= 30)) {
+            // turn light off for inactive hub if blue alliance and red inactive first
+            led.setLEDs(0, 0, 0);
         } else if (allianceIsRed) {
             // Red alliance
             led.setTwoColorWave(255, 0, 0, 255, 255, 255);
@@ -49,10 +63,10 @@ public class LEDDefaultCommand extends Command {
         }
     }
 
-    private boolean climbAligned() {
-        double yCoordinate = drivetrain.getPose().getY();
-        return Math.abs(yCoordinate - climbYCoordinate) < 0.03;
-    }
+    // private boolean climbAligned() {
+    //     double yCoordinate = drivetrain.getPose().getY();
+    //     return Math.abs(yCoordinate - climbYCoordinate) < 0.03;
+    // }
 
     private boolean playingDefense() {
         double xCoordinate = drivetrain.getPose().getX();