Skip to content

Commit

Permalink
Update SwerveDriveXboxControl.java
Browse files Browse the repository at this point in the history
  • Loading branch information
AikiKapila committed Feb 1, 2024
1 parent eab78de commit 38f0a10
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package frc.robot.commands.SwerveRemoteOperation;

import edu.wpi.first.math.kinematics.ChassisSpeeds;
import edu.wpi.first.wpilibj2.command.button.CommandGenericHID;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
import frc.robot.Constants.RobotMovementConstants;
import frc.robot.Constants.DriverConstants;
import frc.robot.subsystems.SwerveDrivetrain;
import frc.robot.utils.OptionButton;
import frc.robot.utils.OptionButton.ActivationMode;

// Here is the documentation for the xbox controller code:
// https://github.wpilib.org/allwpilib/docs/release/java/edu/wpi/first/wpilibj2/command/button/CommandXboxController.html
Expand All @@ -13,6 +16,8 @@
* This is the default command for the drivetrain, allowing for remote operation with xbox controller
*/
public class SwerveDriveXboxControl extends SwerveDriveBaseControl {
private final OptionButton preciseModeButton;
private final OptionButton boostModeButton;
/**
* Creates a new SwerveDriveXboxControl Command.
*
Expand All @@ -21,10 +26,10 @@ public class SwerveDriveXboxControl extends SwerveDriveBaseControl {
*/
public SwerveDriveXboxControl(SwerveDrivetrain drivetrain, CommandXboxController driverXboxController) {
super(drivetrain, driverXboxController);

// Create and configure buttons
// OptionButton exampleToggleButton = new OptionButton(controller::a, ActivationMode.TOGGLE);

preciseModeButton = new OptionButton(driverXboxController, 8, ActivationMode.HOLD);
boostModeButton = new OptionButton(driverXboxController, 1, ActivationMode.HOLD);
// Tell the command schedular we are using the drivetrain
addRequirements(drivetrain);
}
Expand All @@ -51,7 +56,9 @@ public void execute() {

double rightX = -applyJoystickDeadzone(xboxController.getRightX(), DriverConstants.XBOX_DEAD_ZONE);

int speedLevel = 1;
int speedLevel = 1
- preciseModeButton.getStateAsInt()
+ ;

final ChassisSpeeds speeds = new ChassisSpeeds(
leftX * DriverConstants.maxSpeedOptionsTranslation[speedLevel],
Expand Down

0 comments on commit 38f0a10

Please sign in to comment.