]> git.taranathan.com Git - FRC2026.git/commitdiff
lots of things not working for some reason
authorEthan Mortensen <ethanmortensen20@gmail.com>
Sun, 22 Feb 2026 20:08:16 +0000 (12:08 -0800)
committerEthan Mortensen <ethanmortensen20@gmail.com>
Sun, 22 Feb 2026 20:08:16 +0000 (12:08 -0800)
need to be fixed

src/main/java/frc/robot/RobotContainer.java
src/main/java/frc/robot/commands/led_comm/LEDDefaultCommand.java
src/main/java/frc/robot/subsystems/LED/LED.java

index 4d743216c2118640e3c3c487fa608a527034269e..499204fb94bd61e4b75dec3ee70dc366623f9bfe 100644 (file)
@@ -19,6 +19,7 @@ import edu.wpi.first.wpilibj2.command.Command;
 import edu.wpi.first.wpilibj2.command.InstantCommand;
 import frc.robot.commands.DoNothing;
 import frc.robot.commands.drive_comm.DefaultDriveCommand;
+import frc.robot.commands.led_comm.LEDDefaultCommand;
 import frc.robot.commands.vision.ShutdownAllPis;
 import frc.robot.constants.AutoConstants;
 import frc.robot.constants.Constants;
@@ -28,6 +29,7 @@ import frc.robot.controls.Operator;
 import frc.robot.controls.PS5ControllerDriverConfig;
 import frc.robot.subsystems.Climb.LinearClimb;
 import frc.robot.subsystems.Intake.Intake;
+import frc.robot.subsystems.LED.LED;
 import frc.robot.subsystems.drivetrain.Drivetrain;
 import frc.robot.subsystems.drivetrain.GyroIOPigeon2;
 import frc.robot.util.PathGroupLoader;
@@ -54,6 +56,7 @@ public class RobotContainer {
   private Operator operator = null;
   private LinearClimb linearClimb = null;
   private Intake intake = null;
+  private LED led = null;
 
   // Auto Command selection
   private final SendableChooser<Command> autoChooser = new SendableChooser<>();
@@ -77,6 +80,8 @@ public class RobotContainer {
         break;
 
       case TestBed2:
+        led = new LED();
+        led.setDefaultCommand(new LEDDefaultCommand(led));
         break;
 
       default:
index a0b06dc72abae30aae360629ab2230af3977581b..1f6df8cbd84473122399787dd3409b6624b27285 100644 (file)
@@ -20,22 +20,20 @@ public class LEDDefaultCommand extends Command {
 
     private String gameData = DriverStation.getGameSpecificMessage();
 
-    public LEDDefaultCommand(LED led, Drivetrain drivetrain, Vision vision, PS5Controller controller) {
+    public LEDDefaultCommand(LED led) {
         this.led = led;
         // this.outtake = outtake;
-        this.drivetrain = drivetrain;
-        this.vision = vision;
-        this.controller = controller;
         addRequirements(led);
     }
 
     @Override
     public void execute() {
         double matchTime = DriverStation.getMatchTime();
-        if (vision.oneCameraDisconnected()) {
-            // flash if camera disconnected
-            led.setStrobeLights(255, 100, 0);
-        } else if (fiveSecondsBeforeChange() && allianceIsRed) {
+        // if (vision.oneCameraDisconnected()) {
+        //     // flash if camera disconnected
+        //     led.setStrobeLights(255, 100, 0);
+        // } else 
+        if (fiveSecondsBeforeChange() && allianceIsRed) {
             // blink alliance color and rumble if red alliance 5 seconds before hub shifts
             led.setStrobeLights(255, 0, 0);
             controller.setRumble(GenericHID.RumbleType.kBothRumble, 1.0);
@@ -43,10 +41,14 @@ public class LEDDefaultCommand extends Command {
             // blink alliance color and rumble if blue alliance 5 seconds before hub shifts
             led.setStrobeLights(0, 0, 255);
             controller.setRumble(GenericHID.RumbleType.kBothRumble, 1.0);
-        } else if (playingDefense()) {
-            // When playing defense
-            led.defenseLights();
-        } else if (DriverStation.isAutonomous() && allianceIsRed){
+        } else 
+        // if (playingDefense()) {
+        //     // When playing defense
+        //     //  TODO Need to remake defense lights, for some reason not there anymore
+        //     // led.defenseLights();
+        //     led.alternate(255, 0, 0, 0, 0, 255, 4, 0, 67);
+        // } else 
+        if (DriverStation.isAutonomous() && allianceIsRed){
             // Dimmer light for auto in red alliance
             led.setLEDs(100, 0, 0);
         } else if (DriverStation.isAutonomous()){
@@ -66,23 +68,27 @@ public class LEDDefaultCommand extends Command {
             led.setLEDs(0, 0, 0);
         } else if (allianceIsRed) {
             // Red alliance
-            led.setTwoColorWave(255, 0, 0, 255, 255, 255);
+            // TODO need to fix 2 color wave
+            //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.setTwoColorWave(0, 0, 255, 255, 255, 255);
+            // TODO remake 2 color wave
+            led.setLEDs(0, 0, 255);
         }
     }
 
-    private boolean playingDefense() {
-        double xCoordinate = drivetrain.getPose().getX();
-        double xCoordinateHalfway = 50;
-        if (allianceIsRed) {
-            return xCoordinate > xCoordinateHalfway;
-        } else if (!allianceIsRed) {
-            return xCoordinate < xCoordinateHalfway;
-        }
-        return false;
-    }
+    // private boolean playingDefense() {
+    //     double xCoordinate = drivetrain.getPose().getX();
+    //     double xCoordinateHalfway = 50;
+    //     if (allianceIsRed) {
+    //         return xCoordinate > xCoordinateHalfway;
+    //     } else if (!allianceIsRed) {
+    //         return xCoordinate < xCoordinateHalfway;
+    //     }
+    //     return false;
+    // }
 
     private boolean fiveSecondsBeforeChange() {
         double time = DriverStation.getMatchTime();
index 427369a8886222aba68a23c68e90c77852001f4c..db90352c3a2fcf7aaf8544434a43c1ab4a6e7788 100644 (file)
@@ -1,10 +1,12 @@
 package frc.robot.subsystems.LED;
 
+import com.ctre.phoenix.led.RainbowAnimation;
 import com.ctre.phoenix6.configs.CANdleConfigurator;
 import com.ctre.phoenix6.configs.CANdleFeaturesConfigs;
 import com.ctre.phoenix6.configs.LEDConfigs;
 import com.ctre.phoenix6.controls.ControlRequest;
 import com.ctre.phoenix6.controls.SolidColor;
+import com.ctre.phoenix6.controls.StrobeAnimation;
 import com.ctre.phoenix6.hardware.CANdle;
 import com.ctre.phoenix6.signals.Enable5VRailValue;
 import com.ctre.phoenix6.signals.LossOfSignalBehaviorValue;
@@ -20,6 +22,7 @@ public class LED extends SubsystemBase {
 
        private CANdle candle;
        public static final int stripLength = 67;
+       private double counter = 0;
 
        // Constructor
        public LED() {
@@ -130,7 +133,14 @@ public class LED extends SubsystemBase {
         * @param blue  Blue value (0-255)
         */
        public void setStrobeLights(int red, int green, int blue) {
-
+               counter++;
+               if (counter == 1) {
+                       setLEDs(red, green, blue);
+               } else if (counter == 20) {
+                       setLEDs(0, 0, 0);
+               } else if (counter >= 40) {
+                       counter = 0;
+               }
        }
 
        /**