Skip to content

Commit

Permalink
Add 0.5 buffer on stopping trap score button
Browse files Browse the repository at this point in the history
  • Loading branch information
BenG49 committed Apr 11, 2024
1 parent 431d5ab commit 01301a3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/com/stuypulse/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.ConditionalCommand;
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
import edu.wpi.first.wpilibj2.command.WaitCommand;
import edu.wpi.first.wpilibj2.command.WaitUntilCommand;
import edu.wpi.first.wpilibj2.command.button.Trigger;
Expand Down Expand Up @@ -176,7 +177,10 @@ private void configureDriverBindings() {
// score trap
driver.getLeftButton()
.onTrue(new AmperScoreTrap())
.whileTrue(new WaitUntilCommand(() -> !Amper.getInstance().hasNote())
// when 0.5 seconds have passed AND amper has no note, stop rollers
.whileTrue(new ParallelCommandGroup(
new WaitCommand(0.5),
new WaitUntilCommand(() -> !Amper.getInstance().hasNote()))
.andThen(new AmperStop()))
.onFalse(new AmperStop());

Expand Down

0 comments on commit 01301a3

Please sign in to comment.