Skip to content

Commit

Permalink
Disable haptics in Autonomous mode
Browse files Browse the repository at this point in the history
  • Loading branch information
CoffeeCoder1 committed May 22, 2024
1 parent 3770004 commit 874928f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/frc/robot/commands/HapticController.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package frc.robot.commands;

import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.XboxController;
import edu.wpi.first.wpilibj.GenericHID.RumbleType;
import edu.wpi.first.wpilibj2.command.Command;
Expand All @@ -19,8 +20,9 @@ public HapticController(XboxController controller) {
}

/**
* Trigger rumble on the controller for a specified amount of time.
*
* Trigger rumble on the controller for a specified amount of time
* Does not trigger in Autonomous
*
* @param type
* rumble type
* @param strength
Expand All @@ -32,6 +34,7 @@ public Command HapticTap(RumbleType type, double strength, double length) {
return Commands.runOnce(() -> controller.setRumble(type, strength))
.andThen(Commands.waitSeconds(length))
.finallyDo(() -> controller.setRumble(RumbleType.kBothRumble, 0))
.unless(() -> DriverStation.isAutonomous())
.ignoringDisable(true);
}
}

0 comments on commit 874928f

Please sign in to comment.