Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/main/java/org/team5924/frc2025/BuildConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ public final class BuildConstants {
public static final String MAVEN_GROUP = "";
public static final String MAVEN_NAME = "GoldenGateRobotics2025";
public static final String VERSION = "unspecified";
public static final int GIT_REVISION = 284;
public static final String GIT_SHA = "95991a1e70b64e70023f2056ce1dd0e9a78f855f";
public static final String GIT_DATE = "2025-04-05 18:55:27 EDT";
public static final String GIT_BRANCH = "auto_align_branching_fix";
public static final String BUILD_DATE = "2025-04-05 19:18:51 EDT";
public static final long BUILD_UNIX_TIME = 1743895131176L;
public static final int DIRTY = 1;
public static final int GIT_REVISION = 291;
public static final String GIT_SHA = "cf6643bd2f22632c4ca95dbeed64be17df411994";
public static final String GIT_DATE = "2025-04-05 20:39:13 EDT";
public static final String GIT_BRANCH = "LED-code";
public static final String BUILD_DATE = "2025-04-05 21:13:08 EDT";
public static final long BUILD_UNIX_TIME = 1743901988846L;
public static final int DIRTY = 0;

private BuildConstants() {}
}
3 changes: 3 additions & 0 deletions src/main/java/org/team5924/frc2025/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ public static enum Mode {
public static final boolean ALGAE_BRAKE = true; // Adjust value as needed
public static final double ALGAE_REDUCTION = 1.0; // Adjust value as needed

/*Lights */
public static final int CANDLE_ID = 41;

/* # Vision # */
public static String APRIL_TAG_LIMELIGHT_NAME_FRONTL = "limelight-frontl";
public static String APRIL_TAG_LIMELIGHT_NAME_FRONTR = "limelight-frontr";
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/org/team5924/frc2025/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import org.littletonrobotics.junction.wpilog.WPILOGReader;
import org.littletonrobotics.junction.wpilog.WPILOGWriter;
import org.team5924.frc2025.generated.TunerConstantsGamma;
import org.team5924.frc2025.subsystems.lights.Lights;
import org.team5924.frc2025.subsystems.lights.Lights.LEDSegment;
import org.team5924.frc2025.util.Elastic;

/**
Expand Down Expand Up @@ -142,7 +144,9 @@ public void disabledInit() {}

/** This function is called periodically when disabled. */
@Override
public void disabledPeriodic() {}
public void disabledPeriodic() {
LEDSegment.MainStrip.setFadeAnimation(Lights.red, 0.5);
}

/** This autonomous runs the autonomous command selected by your {@link RobotContainer} class. */
@Override
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/org/team5924/frc2025/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.team5924.frc2025;

import static edu.wpi.first.units.Units.Seconds;
import static org.team5924.frc2025.Constants.CANDLE_ID;

import com.pathplanner.lib.auto.AutoBuilder;
import com.pathplanner.lib.auto.NamedCommands;
Expand All @@ -36,6 +37,7 @@
import org.team5924.frc2025.commands.coralInAndOut.TeleopShoot;
import org.team5924.frc2025.commands.drive.DriveCommands;
import org.team5924.frc2025.commands.elevator.RunElevator;
import org.team5924.frc2025.commands.lights.SetLEDColorCommand;
import org.team5924.frc2025.generated.TunerConstantsGamma;
import org.team5924.frc2025.subsystems.climber.Climber;
import org.team5924.frc2025.subsystems.climber.ClimberIO;
Expand All @@ -50,6 +52,7 @@
import org.team5924.frc2025.subsystems.elevator.Elevator;
import org.team5924.frc2025.subsystems.elevator.ElevatorIO;
import org.team5924.frc2025.subsystems.elevator.ElevatorIOTalonFXGamma;
import org.team5924.frc2025.subsystems.lights.LEDSubsystem;
import org.team5924.frc2025.subsystems.rollers.CoralInAndOut.CoralInAndOut;
import org.team5924.frc2025.subsystems.rollers.CoralInAndOut.CoralInAndOut.CoralState;
import org.team5924.frc2025.subsystems.rollers.CoralInAndOut.CoralInAndOutIO;
Expand All @@ -72,6 +75,8 @@ public class RobotContainer {
private final CoralInAndOut coralInAndOut;
private final Elevator elevator;
private final Vision vision;
// private final Lights lights;
private final LEDSubsystem ledSubsystem;

// Controller
private final CommandXboxController driveController = new CommandXboxController(0);
Expand All @@ -97,6 +102,8 @@ public RobotContainer() {
coralInAndOut = new CoralInAndOut(new CoralInAndOutIOKrakenFOC());
elevator = new Elevator(new ElevatorIOTalonFXGamma() {});
vision = new Vision(new VisionIOLimelight());
ledSubsystem = new LEDSubsystem(CANDLE_ID);
// lights = new Lights();
break;

case SIM:
Expand All @@ -112,6 +119,8 @@ public RobotContainer() {
coralInAndOut = new CoralInAndOut(new CoralInAndOutIOSim());
elevator = new Elevator(new ElevatorIO() {});
vision = new Vision(new VisionIO() {});
ledSubsystem = new LEDSubsystem(CANDLE_ID);
// lights = new Lights();
break;

default:
Expand All @@ -127,6 +136,8 @@ public RobotContainer() {
coralInAndOut = new CoralInAndOut(new CoralInAndOutIO() {});
elevator = new Elevator(new ElevatorIO() {});
vision = new Vision(new VisionIO() {});
ledSubsystem = new LEDSubsystem(CANDLE_ID);
// lights = new Lights();
break;
}

Expand Down Expand Up @@ -321,6 +332,12 @@ private void configureButtonBindings() {
.pov(180)
.or(driveController.pov(0))
.onFalse(Commands.runOnce(() -> climber.handleNoInputState()));

// lights.defaultCommand();
ledSubsystem.setDefaultCommand(
new SetLEDColorCommand(
ledSubsystem, 240, 74, 0) // default: golden gate international orange
);
}

/**
Expand Down
56 changes: 56 additions & 0 deletions src/main/java/org/team5924/frc2025/commands/lights/LEDStatus.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* LEDStatus.java
*/

/*
* Copyright (C) 2024-2025 Team 5924 - Golden Gate Robotics and/or its affiliates.
*
* This file, and the associated project, are offered under the GNU General
* Public License v3.0. A copy of this license can be found in LICENSE.md
* at the root of this project.
*
* If this file has been separated from the original project, you should have
* received a copy of the GNU General Public License along with it.
* If you did not, see <https://www.gnu.org/licenses>.
*/

package org.team5924.frc2025.commands.lights;

import edu.wpi.first.wpilibj2.command.Command;
import org.team5924.frc2025.RobotState;
import org.team5924.frc2025.subsystems.lights.Lights;

public class LEDStatus extends Command {
/** Creates a new LEDstatus. */
private Lights leds;

double limeErrorTolerance = 1.5; // in degrees

public LEDStatus(Lights leds) {
this.leds = leds;
// addRequirements(leds);
}

// Called when the command is initially scheduled.
@Override
public void initialize() {}

// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
switch (RobotState.getInstance().getElevatorState()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get rid of the default command and move this into the periodic call of LED subsytem

case L3 -> Lights.LEDSegment.MainStrip.setColor(Lights.blue);
default -> Lights.LEDSegment.MainStrip.disableLEDs();
}
}

// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {}

// Returns true when the command should end.
@Override
public boolean isFinished() {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* SetLEDColorCommand.java
*/

/*
* Copyright (C) 2024-2025 Team 5924 - Golden Gate Robotics and/or its affiliates.
*
* This file, and the associated project, are offered under the GNU General
* Public License v3.0. A copy of this license can be found in LICENSE.md
* at the root of this project.
*
* If this file has been separated from the original project, you should have
* received a copy of the GNU General Public License along with it.
* If you did not, see <https://www.gnu.org/licenses>.
*/

package org.team5924.frc2025.commands.lights;

import edu.wpi.first.wpilibj2.command.Command;
import org.team5924.frc2025.subsystems.lights.LEDSubsystem;

public class SetLEDColorCommand extends Command {
private final LEDSubsystem led;
private final int r, g, b;

public SetLEDColorCommand(LEDSubsystem led, int r, int g, int b) {
this.led = led;
this.r = r;
this.g = g;
this.b = b;
addRequirements(led);
}

@Override
public void initialize() {
led.setColor(r, g, b);
}

@Override
public boolean isFinished() {
return true; // run once and done
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* LEDSubsystem.java
*/

/*
* Copyright (C) 2024-2025 Team 5924 - Golden Gate Robotics and/or its affiliates.
*
* This file, and the associated project, are offered under the GNU General
* Public License v3.0. A copy of this license can be found in LICENSE.md
* at the root of this project.
*
* If this file has been separated from the original project, you should have
* received a copy of the GNU General Public License along with it.
* If you did not, see <https://www.gnu.org/licenses>.
*/

package org.team5924.frc2025.subsystems.lights;

import com.ctre.phoenix.led.CANdle;
import com.ctre.phoenix.led.CANdleConfiguration;

import edu.wpi.first.wpilibj2.command.SubsystemBase;

public class LEDSubsystem extends SubsystemBase {
private final CANdle candle;

public LEDSubsystem(int canId) {
candle = new CANdle(canId);

CANdleConfiguration config = new CANdleConfiguration();

}

public void setColor(int r, int g, int b) {
candle.setLEDs(r, g, b);
}
}
Loading