Skip to content

Commit

Permalink
changed auton shoot, made it correct
Browse files Browse the repository at this point in the history
  • Loading branch information
PGgit08 committed Mar 27, 2024
1 parent 31469a7 commit 4d1a160
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
4 changes: 3 additions & 1 deletion src/main/java/frc/robot/commands/auto/AutonShoot.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ public AutonShoot(
new ParallelCommandGroup(
// This command will squeeze the note while revving up the shooter. It will only run if the note can't be shot right away.
new ParallelCommandGroup(
new SpinShooter(shooter, ShooterState.SHOOT, true).onlyIf(() -> !isRevved).andThen(new WaitCommand(2)),
new SpinShooter(shooter, ShooterState.SHOOT, true).andThen(new WaitCommand(2)).andThen(
() -> isRevved = true
).onlyIf(() -> !isRevved),
new FeedActuate(intake, FeedMode.INTAKE).onlyIf(() -> !isIntaked).withTimeout(1)
),

Expand Down
13 changes: 1 addition & 12 deletions src/main/java/frc/robot/commands/shooter/SpinShooter.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,11 @@ public class SpinShooter extends Command {
private final ShooterState _state;
private final boolean _runOnce;

private final Timer _revTimer;

public SpinShooter(ShooterSubsystem shooter, ShooterState state, boolean runOnce) {
_shooter = shooter;
_state = state;
_runOnce = runOnce;

_revTimer = new Timer();

// NO SHOOTER SUBSYSTEM REQUIREMENT TO NOT MESS WITH SHOOTER ANGLING COMMANDS
}

Expand All @@ -38,18 +34,11 @@ public SpinShooter(ShooterSubsystem shooter, ShooterState state) {
@Override
public void initialize() {
_shooter.setShooterState(_state);

_revTimer.start();

// If not set to shoot state then not revved (AUTON ONLY).
if (_runOnce && _state != ShooterState.SHOOT) _revTimer.stop();
}

// Called every time the scheduler runs while the command is scheduled.
@Override
public void execute() {
AutonShoot.isRevved = _revTimer.hasElapsed(2);
}
public void execute() {}

// Called once the command ends or is interrupted.
@Override
Expand Down

0 comments on commit 4d1a160

Please sign in to comment.