Skip to content

Commit

Permalink
Automated commit at 10/21/2024 19:01:33
Browse files Browse the repository at this point in the history
  • Loading branch information
avidraccoon committed Oct 21, 2024
1 parent e46a5fa commit 1b8d784
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 74 deletions.
12 changes: 12 additions & 0 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import frc.robot.constants.PhoenixDriveConstants.AlignTarget;
import frc.robot.constants.ScoringConstants;
import frc.robot.constants.VisionConstants;
import frc.robot.subsystems.LED;
import frc.robot.subsystems.drive.PhoenixDrive;
import frc.robot.subsystems.drive.PhoenixDrive.SysIdRoutineType;
import frc.robot.subsystems.intake.IntakeIO;
Expand Down Expand Up @@ -53,6 +54,7 @@ public class RobotContainer {

ScoringSubsystem scoringSubsystem;
IntakeSubsystem intakeSubsystem;
LED leds;

CommandJoystick leftJoystick = new CommandJoystick(0);
CommandJoystick rightJoystick = new CommandJoystick(1);
Expand Down Expand Up @@ -114,6 +116,12 @@ private void configureSubsystems() {
if (FeatureFlags.runIntake) {
initIntake();
}
if (FeatureFlags.runScoring
&& FeatureFlags.runIntake
&& FeatureFlags.runVision
&& FeatureFlags.runLEDS) {
initLEDs();
}
}

private void initDrive() {
Expand Down Expand Up @@ -205,6 +213,10 @@ private void initScoring() {
}
}

private void initLEDs() {
leds = new LED(scoringSubsystem, intakeSubsystem);
}

private void configureSuppliers() {
if (FeatureFlags.runScoring) {
Supplier<Pose2d> poseSupplier;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/frc/robot/constants/FeatureFlags.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ public final class FeatureFlags {
public static final boolean runLocalizer = false;
public static final boolean runIntake = true;
public static final boolean runScoring = true;
public static final boolean runLEDS = true;
}
3 changes: 1 addition & 2 deletions src/main/java/frc/robot/constants/LEDConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ public class LEDConstants {

public static final int ledPort = 0;

public static final int ledLength = 17;

public static final int ledLength = 30;
}
77 changes: 5 additions & 72 deletions src/main/java/frc/robot/subsystems/LED.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
import frc.robot.constants.LEDConstants;
import frc.robot.constants.ModeConstants;
import frc.robot.subsystems.intake.IntakeSubsystem;
import frc.robot.subsystems.scoring.ScoringSubsystem;
import java.util.function.Supplier;
import frc.robot.constants.LEDConstants;

public class LED extends SubsystemBase {

Expand Down Expand Up @@ -55,7 +56,7 @@ public void periodic() {
if (!enabled) {
// LEDs left cleared if not enabled
} else if (DriverStation.isDisabled()) {
if (Constants.currentMode == Mode.REAL) {
if (ModeConstants.currentMode == ModeConstants.Mode.REAL) {
rainbow();

if (!visionWorkingSupplier.get()) {
Expand Down Expand Up @@ -84,77 +85,9 @@ public void periodic() {
ledBuffer.setRGB(i, 0, 0, 255 / 3);
}
}

// // idle
// if (scoringSubsystem.getCurrentState() == ScoringState.IDLE) {
// if (Constants.currentMode == Mode.REAL)
// setFlashingColorSection(
// 0, ledcount, new int[] {105, 29, 16}, new int[] {255, 123, 0});
// else SmartDashboard.putString("current task", "idle");
// }

// // intake
// if (scoringSubsystem.getCurrentState() == ScoringState.INTAKE) {
// if (scoringSubsystem.hasNote()) {
// if (Constants.currentMode == Mode.REAL)
// setSolidColorSection(0, ledcount, new int[] {255, 174, 0});
// else SmartDashboard.putString("current task", "intake, has note");
// } else {
// if (Constants.currentMode == Mode.REAL)
// setFlashingColorSection(
// 0, ledcount, new int[] {255, 174, 0}, new int[] {0, 0, 0});
// else SmartDashboard.putString("current task", "intake");
// }
// }

// // shooting amp
// if (scoringSubsystem.getCurrentState() == ScoringState.AMP_PRIME) {
// if (scoringSubsystem.readyToShoot()) {
// if (Constants.currentMode == Mode.REAL)
// setSolidColorSection(0, ledcount, new int[] {32, 227, 64});
// else SmartDashboard.putString("current task", "amp, ready to shoot");
// } else {
// if (Constants.currentMode == Mode.REAL)
// setFlashingColorSection(
// 0, ledcount, new int[] {32, 227, 64}, new int[] {0, 0, 0});
// else SmartDashboard.putString("current task", "amp, preparing");
// }
// }

// // shooting speaker
// if (scoringSubsystem.getCurrentState() == ScoringState.PRIME) {
// int[] rgbCode = new int[3];
// if (DriverStation.getAlliance().isEmpty()
// || DriverStation.getAlliance().get() == DriverStation.Alliance.Blue) {
// rgbCode[0] = 0;
// rgbCode[1] = 30;
// rgbCode[2] = 225;
// } else {
// rgbCode[0] = 225;
// rgbCode[1] = 0;
// rgbCode[2] = 0;
// }

// if (scoringSubsystem.readyToShoot()) {
// if (Constants.currentMode == Mode.REAL)
// setSolidColorSection(0, ledcount, rgbCode);
// else SmartDashboard.putString("current task", "speaker, ready to shoot");
// } else {
// if (Constants.currentMode == Mode.REAL)
// setFlashingColorSection(0, ledcount, rgbCode, new int[] {0, 0, 0});
// else SmartDashboard.putString("current task", "speaker, preparing");
// }
// }

// // endgame
// if (scoringSubsystem.getCurrentState() == ScoringState.ENDGAME) {
// if (Constants.currentMode == Mode.REAL)
// setSolidColorSection(0, ledcount, new int[] {140, 0, 255});
// else SmartDashboard.putString("current task", "endgame");
// }
}

if (Constants.currentMode == Mode.REAL) {
if (ModeConstants.currentMode == ModeConstants.Mode.REAL) {
led.setData(ledBuffer);
}
}
Expand Down Expand Up @@ -197,4 +130,4 @@ private void rainbow() {
offset += rainbowSpeed;
offset %= 180;
}
}
}

0 comments on commit 1b8d784

Please sign in to comment.