Skip to content

Commit

Permalink
Add joystick deadband
Browse files Browse the repository at this point in the history
  • Loading branch information
BrownGenius committed Jan 19, 2024
1 parent c7a540c commit c2ad424
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

package frc.robot;

import edu.wpi.first.math.MathUtil;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.InstantCommand;
Expand All @@ -23,9 +24,10 @@ private void configureBindings() {
drive.setDefaultCommand(
new DriveCommand(
drive,
() -> -controller.getLeftY(),
() -> -controller.getLeftX(),
() -> -controller.getRightX()));
() -> MathUtil.applyDeadband(-controller.getLeftY(), 0.01),
() -> MathUtil.applyDeadband(-controller.getLeftX(), 0.01),
() -> MathUtil.applyDeadband(-controller.getRightX(), 0.01)));
// TODO: Move deadband to constants file

controller
.start()
Expand Down

0 comments on commit c2ad424

Please sign in to comment.