Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Team334/R2024
Browse files Browse the repository at this point in the history
  • Loading branch information
cherriae committed Mar 28, 2024
2 parents 0d92362 + 60b432d commit 4d51116
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/main/java/frc/robot/commands/auto/NoteAlign.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ public void execute() {
noteX = noteAngles.get()[0];
}

if (_headingController.atSetpoint()) {

} else {

}

double rotationVelocity = MathUtil.clamp(
_headingController.calculate(noteX, 0),
-Speeds.SWERVE_DRIVE_MAX_ANGULAR_SPEED,
Expand All @@ -76,6 +82,6 @@ public void end(boolean interrupted) {
// Returns true when the command should end.
@Override
public boolean isFinished() {
return _headingController.atSetpoint();
return false;
}
}
5 changes: 5 additions & 0 deletions src/main/java/frc/robot/commands/leds/DefaultLED.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public void execute() {
switch (UtilFuncs.GetLEDs()) {
case DEFAULT:
_leds.setColor(UtilFuncs.GetAlliance() == Alliance.Red ? LEDColors.RED : LEDColors.BLUE);
// 16 side | 19 back
// leds.rainbow();
break;

Expand All @@ -55,6 +56,10 @@ public void execute() {

default:
break;

case BRAKE:
_leds.blink(Constants.LEDColors.RED, Constants.LEDColors.NOTHING, 0.1);
break;
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/main/java/frc/robot/commands/swerve/BrakeSwerve.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import frc.robot.Constants;
import frc.robot.subsystems.LEDSubsystem;
import frc.robot.subsystems.SwerveDriveSubsystem;
import frc.robot.subsystems.LEDSubsystem.LEDState;
import frc.robot.utils.UtilFuncs;

/**
* Creates a natural brake on the swerve drive by facing the modules so they
Expand Down Expand Up @@ -47,6 +49,7 @@ public BrakeSwerve(SwerveDriveSubsystem swerveDrive, LEDSubsystem leds, double t
@Override
public void initialize() {
_timer.start();
UtilFuncs.SetLEDs(LEDState.BRAKE);
}

// Called every time the scheduler runs while the command is scheduled.
Expand All @@ -58,13 +61,14 @@ public void execute() {
new SwerveModuleState(0, Rotation2d.fromDegrees(-45))};

_swerveDrive.setStates(states);
_leds.blink(Constants.LEDColors.RED, Constants.LEDColors.NOTHING, 0.2); // TESTING ONLY!!!!!!!
// _leds.blink(Constants.LEDColors.RED, Constants.LEDColors.NOTHING, 0.2); // TESTING ONLY!!!!!!!
}

// Called once the command ends or is interrupted.
@Override
public void end(boolean interrupted) {
_timer.stop();
UtilFuncs.SetLEDs((LEDState.DEFAULT));
}

// Returns true when the command should end.
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/frc/robot/subsystems/LEDSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public class LEDSubsystem extends SubsystemBase {

public enum LEDState {
DEFAULT,
AIM
AIM,
BRAKE
}

/** Creates a new LEDSubsystem. */
Expand Down

0 comments on commit 4d51116

Please sign in to comment.