]> git.taranathan.com Git - FRC2026.git/commitdiff
added overrides, npe
authoriefomit <timofei.stem@gmail.com>
Fri, 20 Mar 2026 02:33:43 +0000 (19:33 -0700)
committeriefomit <timofei.stem@gmail.com>
Fri, 20 Mar 2026 02:33:43 +0000 (19:33 -0700)
src/main/java/frc/robot/commands/led_comm/ChangeModeCommand.java
src/main/java/frc/robot/commands/led_comm/DefenseLightsCommand.java
src/main/java/frc/robot/commands/led_comm/LEDDefaultCommand.java
src/main/java/frc/robot/commands/led_comm/LEDSensorCommand.java
src/main/java/frc/robot/commands/led_comm/PaintCommand.java
src/main/java/frc/robot/commands/led_comm/TurnOffLEDsCommand.java

index 79a95bc8dafd573233aeb58d5fe4460bb49f0948..fd20874c95ca2fa4eecfc72fef088775b176c64a 100644 (file)
@@ -14,10 +14,12 @@ public class ChangeModeCommand extends Command {
         addRequirements(led);
     }
 
+    @Override
     public void initialize() {
         mode++;
     }
 
+    @Override
     public void execute() {
         if (mode == 0) {
             led.setLEDs(0, 0, 0);
@@ -30,11 +32,13 @@ public class ChangeModeCommand extends Command {
         }
     }
 
+    @Override
     public boolean isFinished() {
         return false;
     }
 
-    public void end() {
+    @Override
+    public void end(boolean interrupted) {
 
     }
 }
index e6e061eec61d0fe78f608b52a13086e897b44d5d..5b42313b9b26364508ec8fae70d06520f1cc974c 100644 (file)
@@ -17,30 +17,31 @@ public class DefenseLightsCommand extends Command {
         addRequirements(led);
     }
 
+    @Override
     public void initialize() {
         counter = 0;
     }
 
+    @Override
     public void execute() {
         counter++;
 
         if (counter == 1) {
-            // setLEDs(255, 0, 0);
             led.alternate(255, 0, 0, 0, 0, 255, 5, startOffset, length);
         } else if (counter == 20) {
-            // setLEDs(0, 0, 255);
             led.alternate(0, 0, 255, 255, 0, 0, 5, startOffset, length);
         }
         if (counter >= 40) {
             counter = 0;
         }
-
     }
 
+    @Override
     public boolean isFinished() {
         return false;
     }
 
+    @Override
     public void end(boolean interrupted) {
 
     }
index f1e694eb28bbd0dfee5453cf93e358afb8aca801..84ef1e1f3b95e3c7bbe0ca1c31e8eaefbf4d5d91 100644 (file)
@@ -3,25 +3,18 @@ package frc.robot.commands.led_comm;
 import edu.wpi.first.wpilibj.DriverStation;
 import edu.wpi.first.wpilibj2.command.Command;
 import frc.robot.subsystems.LED.LED;
-import frc.robot.subsystems.drivetrain.Drivetrain;
-import frc.robot.util.Vision.Vision;
 
 public class LEDDefaultCommand extends Command {
-    private Vision vision;
     private LED led;
-    // private Outtake outtake;
-    private Drivetrain drivetrain;
     private boolean allianceIsRed = DriverStation.getAlliance().get() == DriverStation.Alliance.Red;
 
     public LEDDefaultCommand(LED led) {
         this.led = led;
-        // this.outtake = outtake;
         addRequirements(led);
     }
 
     @Override
     public void execute() {
-
         double matchTime = DriverStation.getMatchTime();
         String gameData = DriverStation.getGameSpecificMessage();
         // if (vision.oneCameraDisconnected() ||
@@ -37,40 +30,43 @@ public class LEDDefaultCommand extends Command {
             // blink alliance color and rumble if blue alliance 5 seconds before hub shifts
             led.setStrobeLights(0, 0, 255);
         } else if (playingDefense()) {
-            new DefenseLightsCommand(led, 0, 67);
+            led.alternate(255, 0, 0, 0, 0, 255, 5, 0, 67);
         } else if (DriverStation.isAutonomous() && allianceIsRed) {
             // Dimmer light for auto in red alliance
             led.setLEDs(50, 0, 0);
         } else if (DriverStation.isAutonomous()) {
             // Dimmer light for auto in blue alliance
             led.setLEDs(0, 0, 50);
-        } else if ((allianceIsRed && gameData.equals("B") && matchTime <= 105 && matchTime >= 80)
-                || (allianceIsRed && gameData.equals("B") && matchTime <= 55 && matchTime >= 30)) {
+        } else if (gameData != null && ((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("R") && matchTime <= 130 && matchTime >= 105)
-                || (allianceIsRed && gameData.equals("R") && matchTime <= 80 && matchTime >= 55)) {
+        } else if (gameData != null && ((allianceIsRed && gameData.equals("R") && matchTime <= 130 && matchTime >= 105)
+                || (allianceIsRed && gameData.equals("R") && matchTime <= 80 && matchTime >= 55))) {
             // turn light off for inactive hub if red alliance and red 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)) {
+        } else if (gameData != null && ((!allianceIsRed && gameData.equals("B") && matchTime <= 130 && matchTime >= 105)
+                || (!allianceIsRed && gameData.equals("B") && matchTime <= 80 && matchTime >= 55))) {
             // turn off lights for inactive hub if blue alliance and blue inactive first
             led.setLEDs(0, 0, 0);
-        } else if ((!allianceIsRed && gameData.equals("R") && matchTime <= 105 && matchTime >= 80)
-                || (!allianceIsRed && gameData.equals("R") && matchTime <= 55 && matchTime >= 30)) {
+        } else if (gameData != null && ((!allianceIsRed && gameData.equals("R") && matchTime <= 105 && matchTime >= 80)
+                || (!allianceIsRed && 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);
-            // led.setLEDs(255, 0, 0);
         } else {
             // Blue alliance
             led.setTwoColorWave(0, 0, 255, 255, 255, 255);
-            // led.setLEDs(0, 0, 255);
         }
     }
 
+    @Override
+    public boolean isFinished() {
+        return false;
+    }
+
     private boolean fiveSecondsBeforeChange() {
         double time = DriverStation.getMatchTime();
         if ((time <= 135 && time >= 130) || (time <= 110 && time >= 105) || (time <= 85 && time >= 80)
index 95b5b051a7bf5abaca6d659b74abf4e3289dc5ac..39ae4960aeb7cc95ef9c2f797131ec37eab1406b 100644 (file)
@@ -29,4 +29,9 @@ public class LEDSensorCommand extends Command {
         }
     }
 
+    @Override
+    public boolean isFinished() {
+        return false;
+    }
+
 }
index 04c2cd2fe5eebb5cff0cdaac165dc2915b6371f1..d10a38bc9978dfa71e54a941341966140873ddb4 100644 (file)
@@ -16,18 +16,22 @@ public class PaintCommand extends Command {
         addRequirements(led);
     }
 
+    @Override
     public void initialize() {
         led.setSection(0, 0, 255, start, end);
     }
 
+    @Override
     public void execute() {
         led.setTwoColorWave(30, 0, 80, 255, 255, 255);
     }
 
+    @Override
     public boolean isFinished() {
         return false;
     }
 
+    @Override
     public void end(boolean interrupted) {
 
     }
index 22398afc53a118c29d9de887a407782c4e798541..cd7b31f264282647e0a30e8138a43c98422858db 100644 (file)
@@ -12,18 +12,22 @@ public class TurnOffLEDsCommand extends Command {
         addRequirements(led);
     }
 
+    @Override
     public void initialize() {
         led.setLEDs(0, 0, 0);
     }
 
+    @Override
     public void execute() {
 
     }
 
+    @Override
     public boolean isFinished() {
         return false;
     }
 
+    @Override
     public void end(boolean interrupted) {
 
     }