From 01301a359193cb93f0864f0f063753570262952d Mon Sep 17 00:00:00 2001 From: BenG49 Date: Thu, 11 Apr 2024 09:58:52 -0400 Subject: [PATCH] Add 0.5 buffer on stopping trap score button --- src/main/java/com/stuypulse/robot/RobotContainer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/stuypulse/robot/RobotContainer.java b/src/main/java/com/stuypulse/robot/RobotContainer.java index 30ea4cfe..50300101 100644 --- a/src/main/java/com/stuypulse/robot/RobotContainer.java +++ b/src/main/java/com/stuypulse/robot/RobotContainer.java @@ -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; @@ -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());