Skip to content

Commit

Permalink
invert turn for eamon
Browse files Browse the repository at this point in the history
  • Loading branch information
an-prata committed Oct 23, 2023
1 parent 4a67144 commit 57ea030
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public enum ControlMode {
private static Robot instance;

private ControlMode controlMode = ControlMode.DISABLED;
private boolean invertedTurn = false;

/**
* Exists only to enable static methods to gain access to non static data,
Expand Down Expand Up @@ -158,6 +159,16 @@ public void teleopPeriodic() {
);
}

if (controllerOne.getRightStickButtonReleased()) {
SwerveDrive.setTurnCurve(
invertedTurn
? Controls::defaultCurve
: Controls::invertedCurve
);

invertedTurn = !invertedTurn;
}

if (controllerOne.getRightStickButtonReleased()) {
var accelerationRate = SwerveDrive.getAccelerationRate();
SwerveDrive.setAccelerationRate(
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/frc/robot/systems/Controls.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public static double defaultCurve(double x) {
return Math.pow(x, DEFAULT_CURVE_EXPONENT);
}

public static double invertedCurve(double x) {
return -defaultCurve(x);
}

/**
* Custom turning curve for Rohan.
*/
Expand Down

0 comments on commit 57ea030

Please sign in to comment.