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
9 changes: 5 additions & 4 deletions src/main/java/frc/robot/auto/AutoRoutines.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import frc.robot.commands.ForceBrakesInAuto;
import frc.robot.commands.GripperCommand;
import frc.robot.commands.GripperCommand.GRIPPER_INSTRUCTION;
import frc.robot.commands.SetBlingCommand.BLING_COLOUR;
import frc.robot.commands.SetBlingCommand;
import frc.robot.commands.TranslationCommand;
import frc.robot.config.ArmConfig.ArmSetpoint;
Expand Down Expand Up @@ -94,10 +95,10 @@ public AutoRoutines() {
Map<String, Command> eventMap = new HashMap<String, Command>();

eventMap.put("intake", new InstantCommand());
eventMap.put("Bling Purple", new SetBlingCommand(1));
eventMap.put("Bling Blue", new SetBlingCommand(2));
eventMap.put("Bling Red", new SetBlingCommand(3));
eventMap.put("Bling Honeydew", new SetBlingCommand(4));
eventMap.put("Bling Purple", new SetBlingCommand(BLING_COLOUR.PURPLE));
eventMap.put("Bling Blue", new SetBlingCommand(BLING_COLOUR.BLUE));
eventMap.put("Bling Red", new SetBlingCommand(BLING_COLOUR.RED));
eventMap.put("Bling Honeydew", new SetBlingCommand(BLING_COLOUR.HONEYDEW));
eventMap.put("charge", new TranslationCommand(-1.9, 0).andThen(
Commands.run(() -> SwerveSubsystem.getInstance().setModuleStatesAuto(new SwerveModuleState[]{
new SwerveModuleState(0.1, Rotation2d.fromDegrees(-45)),
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/frc/robot/commands/DriveArmAgainstBackstop.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import edu.wpi.first.wpilibj2.command.CommandBase;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import edu.wpi.first.wpilibj2.command.WaitCommand;
import frc.robot.commands.SetBlingCommand.BLING_COLOUR;
import frc.robot.subsystems.ArmSubsystem;
import frc.robot.subsystems.BlingSubsystem;

Expand Down Expand Up @@ -55,9 +56,9 @@ public void end(boolean interrupted) {
ArmSubsystem.getInstance().stopMotors();

new SequentialCommandGroup(
new SetBlingCommand(13),
new SetBlingCommand(BLING_COLOUR.PURPLESTROBE),
(new WaitCommand(2)),
(new SetBlingCommand(0))
(new SetBlingCommand(BLING_COLOUR.DISABLED))
).schedule();
}

Expand Down
53 changes: 35 additions & 18 deletions src/main/java/frc/robot/commands/SetBlingCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,29 @@
// https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html

public class SetBlingCommand extends InstantCommand {
public int m_blingPatternId;
public enum BLING_COLOUR
{
DISABLED,
PURPLE,
BLUE,
RED,
YELLOW,
HONEYDEW,
RAINBOW,
FIRE,
RGBFADE,
WHITESTROBE,
REDSTROBE,
YELLOWSTROBE,
BLUESTROBE,
PURPLESTROBE
}
public BLING_COLOUR m_blingPatternId;
public BlingSubsystem bling = BlingSubsystem.getINSTANCE();

public SetBlingCommand(int patternId) {
public SetBlingCommand(BLING_COLOUR patternId) {
m_blingPatternId = patternId;


// Use addRequirements() here to declare subsystem dependencies.
if( bling != null )
addRequirements(bling);
Expand All @@ -34,51 +51,51 @@ public SetBlingCommand(int patternId) {
public void initialize() {
if (bling != null)
{
if (m_blingPatternId!= 0) {
if (m_blingPatternId != BLING_COLOUR.DISABLED) {
bling.setBrightness();
}
switch( m_blingPatternId )
{
case 0:
case DISABLED:
bling.setDisabled();
break;
case 1:
case PURPLE:
bling.setPurple();
break;
case 2:
case BLUE:
bling.setBlue();
break;
case 3:
case RED:
bling.setRed();
break;
case 4:
case YELLOW:
bling.setYellow();
break;
case 5:
case HONEYDEW:
bling.setHoneydew();
break;
case 6:
case RAINBOW:
setRainbow();
break;
case 7:
case FIRE:
setFire();
break;
case 8:
case RGBFADE:
setRgbFade();
break;
case 9:
case WHITESTROBE:
setWhiteStrobe();
break;
case 10:
case REDSTROBE:
setRedStrobe();
break;
case 11:
case YELLOWSTROBE:
setYellowStrobe();
break;
case 12:
case BLUESTROBE:
setBlueStrobe();
break;
case 13:
case PURPLESTROBE:
setPurpleStrobe();
break;
default:
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/frc/robot/subsystems/BlingSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

package frc.robot.subsystems;
import frc.robot.commands.SetBlingCommand;
import frc.robot.commands.SetBlingCommand.BLING_COLOUR;
import frc.robot.config.Config;

import edu.wpi.first.wpilibj2.command.SubsystemBase;
Expand Down Expand Up @@ -105,18 +106,18 @@ public void noEncodersSynced() {
public void armEncodersSynced() {
armEncodersSynced = true;
if (steerEncodersSynced) {
new SetBlingCommand(1).schedule(); // purple
new SetBlingCommand(BLING_COLOUR.PURPLE).schedule(); // purple
} else {
new SetBlingCommand(2).schedule(); // blue
new SetBlingCommand(BLING_COLOUR.BLUE).schedule(); // blue
}
}

public void steerEncodersSynced() {
steerEncodersSynced = true;
if (armEncodersSynced) {
new SetBlingCommand(1).schedule(); // purple
new SetBlingCommand(BLING_COLOUR.PURPLE).schedule(); // purple
} else {
new SetBlingCommand(4).schedule(); // yellow
new SetBlingCommand(BLING_COLOUR.YELLOW).schedule(); // yellow
}
}

Expand Down