From: Ethan Mortensen Date: Sun, 22 Feb 2026 20:08:16 +0000 (-0800) Subject: lots of things not working for some reason X-Git-Url: https://git.taranathan.com/?a=commitdiff_plain;h=0324d8a3a99bf57eceaccf7584034e1c9a8a3680;p=FRC2026.git lots of things not working for some reason need to be fixed --- diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 4d74321..499204f 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -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 autoChooser = new SendableChooser<>(); @@ -77,6 +80,8 @@ public class RobotContainer { break; case TestBed2: + led = new LED(); + led.setDefaultCommand(new LEDDefaultCommand(led)); break; default: diff --git a/src/main/java/frc/robot/commands/led_comm/LEDDefaultCommand.java b/src/main/java/frc/robot/commands/led_comm/LEDDefaultCommand.java index a0b06dc..1f6df8c 100644 --- a/src/main/java/frc/robot/commands/led_comm/LEDDefaultCommand.java +++ b/src/main/java/frc/robot/commands/led_comm/LEDDefaultCommand.java @@ -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(); diff --git a/src/main/java/frc/robot/subsystems/LED/LED.java b/src/main/java/frc/robot/subsystems/LED/LED.java index 427369a..db90352 100644 --- a/src/main/java/frc/robot/subsystems/LED/LED.java +++ b/src/main/java/frc/robot/subsystems/LED/LED.java @@ -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; + } } /**