Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add some triggers with HID instead #152

Merged
merged 10 commits into from
Feb 16, 2024
5 changes: 2 additions & 3 deletions src/main/java/frc/robot/RobotContainer.java
Jacob1010-h marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ public RobotContainer() {
driver::getLeftY,
driver::getLeftX,
() -> -driver.getRightX(),
() -> !driver.y().getAsBoolean(),
() -> (driver.y().getAsBoolean()
() -> !driver.getYButton(),
() -> (driver.getYButton()
&& Robot.isBlueAlliance())));

configureButtonBindings();
Expand Down Expand Up @@ -245,7 +245,6 @@ private void configureDriverBindings(PatriBoxController controller) {
swerve.resetHDC(),
swerve.getDriveCommand(
() -> {
;
return new ChassisSpeeds(
-controller.getLeftY(),
-controller.getLeftX(),
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/frc/robot/util/PatriBoxController.java
Jacob1010-h marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package frc.robot.util;

import java.util.function.BooleanSupplier;
import java.util.function.DoubleSupplier;
import edu.wpi.first.math.MathUtil;
import edu.wpi.first.math.geometry.Rotation2d;
Expand All @@ -8,6 +9,7 @@
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
import edu.wpi.first.wpilibj2.command.button.Trigger;
import frc.robot.util.Constants.OIConstants;

public class PatriBoxController extends CommandXboxController {
Expand All @@ -25,6 +27,10 @@ public double getLeftX() {
return getLeftAxis().getX();
}

public boolean getYButton() {
return super.getHID().getYButton();
}
Jacob1010-h marked this conversation as resolved.
Show resolved Hide resolved

@Override
// This is inverted because for some reason when you
// go forward on the controller, it returns a negative value
Expand All @@ -38,6 +44,10 @@ public Translation2d getLeftAxis() {
return driverLeftAxis;
}

public double getRightTriggerAxis() {
return super.getHID().getRightTriggerAxis();
}
Jacob1010-h marked this conversation as resolved.
Show resolved Hide resolved

@Override
public double getRightX() {
return getRightAxis().getX();
Expand Down