From 071d02f6f03baf4b6517c507fad03f5b2f01b9ec Mon Sep 17 00:00:00 2001 From: koolpoolo Date: Mon, 14 Sep 2026 19:50:47 -0700 Subject: [PATCH 1/5] fixed stuff --- src/main/java/frc/robot/Controls.java | 67 ++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 12 deletions(-) diff --git a/src/main/java/frc/robot/Controls.java b/src/main/java/frc/robot/Controls.java index 82098a5..f370432 100644 --- a/src/main/java/frc/robot/Controls.java +++ b/src/main/java/frc/robot/Controls.java @@ -10,10 +10,14 @@ import com.ctre.phoenix6.swerve.SwerveModule.DriveRequestType; import com.ctre.phoenix6.swerve.SwerveRequest; +import com.ctre.phoenix6.swerve.SwerveRequest.SwerveDriveBrake; import edu.wpi.first.math.MathUtil; +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.generated.AlphaTunerConstants; +import frc.robot.util.GetTargetFromPose; +import frc.robot.util.tuning.WheelRadiusCharacterization; /** * This class is where the bulk of the robot should be declared. Since Command-based is a @@ -24,6 +28,7 @@ public class Controls { private static final int DRIVER_CONTROLLER_PORT = 0; + private static final int TEST_CONTROLLER_PORT = 1; private static final double JOYSTICK_DEADBAND = 0.1; private final Subsystems s; private static final double SWERVE_DEADBAND = 0.001; @@ -31,6 +36,9 @@ public class Controls { private final CommandXboxController driverController = new CommandXboxController(DRIVER_CONTROLLER_PORT); + private final CommandXboxController testController = + new CommandXboxController(TEST_CONTROLLER_PORT); + public static final double MaxSpeed = AlphaTunerConstants.kSpeedAt12Volts.in(MetersPerSecond); // kSpeedAt12Volts desired top speed @@ -41,20 +49,9 @@ public class Controls { public Controls(Subsystems subsystems) { s = subsystems; // Configure the trigger bindings - configureBindings(); + configureDrivebaseBindings(); } - /** - * Use this method to define your trigger->command mappings. Triggers can be created via the - * {@link Trigger#Trigger(java.util.function.BooleanSupplier)} constructor with an arbitrary - * predicate, or via the named factories in {@link - * edu.wpi.first.wpilibj2.command.button.CommandGenericHID}'s subclasses for {@link - * CommandXboxController Xbox}/{@link edu.wpi.first.wpilibj2.command.button.CommandPS4Controller - * PS4} controllers or {@link edu.wpi.first.wpilibj2.command.button.CommandJoystick Flight - * joysticks}. - */ - private void configureBindings() {} - // takes the X value from the joystick, and applies a deadband and input scaling private double getDriveX() { // Joystick +Y is back @@ -63,6 +60,10 @@ private double getDriveX() { return input * MaxSpeed; } + private Trigger connected(CommandXboxController controller) { + return new Trigger(() -> controller.isConnected()); + } + // takes the Y value from the joystick, and applies a deadband and input scaling private double getDriveY() { // Joystick +X is right @@ -86,4 +87,46 @@ private double getDriveRotate() { .withDeadband(SWERVE_DEADBAND) .withRotationalDeadband(SWERVE_DEADBAND) .withDriveRequestType(DriveRequestType.Velocity); + + private void configureDrivebaseBindings() { + if (s.drivebaseSubsystem == null) { + // Stop running this method + return; + } + + // readyToShoot = GetTargetFromPose.autoShoot(s.drivebaseSubsystem); + + connected(testController) + .and(testController.y()) + .whileTrue( + WheelRadiusCharacterization.wheelRadiusCharacterizationCommand(s.drivebaseSubsystem)); + // Note that X is defined as forward according to WPILib convention, + // and Y is defined as to the left according to WPILib convention. + + // the driving command for just driving around + s.drivebaseSubsystem.setDefaultCommand( + // s.drivebaseSubsystem will execute this command periodically + + // applying the request to drive with the inputs + s.drivebaseSubsystem + .applyRequest( + () -> + drive + .withVelocityX(getDriveX()) + .withVelocityY(getDriveY()) + .withRotationalRate(getDriveRotate())) + .withName("Drive")); + + driverController + .a() + .whileTrue(Commands.run(() -> s.drivebaseSubsystem.setControl(new SwerveDriveBrake()))); + + // reset pose incase vision is bugging + driverController + .back() + .onTrue( + s.drivebaseSubsystem + .runOnce(() -> s.drivebaseSubsystem.resetPose(GetTargetFromPose.getRestPose())) + .withName("Reset to Hub")); + } } From 1e8d11235bc04fb9be7380de71064fbe3dc183f0 Mon Sep 17 00:00:00 2001 From: cwkpete7383 Date: Thu, 17 Sep 2026 19:53:22 -0700 Subject: [PATCH 2/5] pr changes --- src/main/java/frc/robot/Controls.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/frc/robot/Controls.java b/src/main/java/frc/robot/Controls.java index f370432..737f967 100644 --- a/src/main/java/frc/robot/Controls.java +++ b/src/main/java/frc/robot/Controls.java @@ -32,6 +32,7 @@ public class Controls { private static final double JOYSTICK_DEADBAND = 0.1; private final Subsystems s; private static final double SWERVE_DEADBAND = 0.001; + private final SwerveRequest.SwerveDriveBrake brake = new SwerveRequest.SwerveDriveBrake(); private final CommandXboxController driverController = new CommandXboxController(DRIVER_CONTROLLER_PORT); @@ -119,7 +120,7 @@ private void configureDrivebaseBindings() { driverController .a() - .whileTrue(Commands.run(() -> s.drivebaseSubsystem.setControl(new SwerveDriveBrake()))); + .whileTrue(Commands.run(() -> s.drivebaseSubsystem.setControl(brake)).withName("Brake")); // reset pose incase vision is bugging driverController From 4b353b3027b9096713484bdefacdbc6a7a41324a Mon Sep 17 00:00:00 2001 From: cwkpete7383 Date: Thu, 17 Sep 2026 19:53:46 -0700 Subject: [PATCH 3/5] spotless --- src/main/java/frc/robot/Controls.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/frc/robot/Controls.java b/src/main/java/frc/robot/Controls.java index 737f967..d22518b 100644 --- a/src/main/java/frc/robot/Controls.java +++ b/src/main/java/frc/robot/Controls.java @@ -10,7 +10,6 @@ import com.ctre.phoenix6.swerve.SwerveModule.DriveRequestType; import com.ctre.phoenix6.swerve.SwerveRequest; -import com.ctre.phoenix6.swerve.SwerveRequest.SwerveDriveBrake; import edu.wpi.first.math.MathUtil; import edu.wpi.first.wpilibj2.command.Commands; import edu.wpi.first.wpilibj2.command.button.CommandXboxController; From 0b4efd014675fdb6a0bc2cbc276f655b1b2ddee9 Mon Sep 17 00:00:00 2001 From: cwkpete7383 Date: Thu, 17 Sep 2026 19:57:13 -0700 Subject: [PATCH 4/5] pr changes --- src/main/java/frc/robot/Controls.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/main/java/frc/robot/Controls.java b/src/main/java/frc/robot/Controls.java index d22518b..d097540 100644 --- a/src/main/java/frc/robot/Controls.java +++ b/src/main/java/frc/robot/Controls.java @@ -41,11 +41,6 @@ public class Controls { public static final double MaxSpeed = AlphaTunerConstants.kSpeedAt12Volts.in(MetersPerSecond); - // kSpeedAt12Volts desired top speed - public static double MaxAngularRate = - RotationsPerSecond.of(0.75) - .in(RadiansPerSecond); // 3/4 of a rotation per second max angular velocity - public Controls(Subsystems subsystems) { s = subsystems; // Configure the trigger bindings From 47e5ba2c682241e1b15444aaa7d1e26fffca6049 Mon Sep 17 00:00:00 2001 From: cwkpete7383 Date: Thu, 17 Sep 2026 19:57:59 -0700 Subject: [PATCH 5/5] spotless --- src/main/java/frc/robot/Controls.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/frc/robot/Controls.java b/src/main/java/frc/robot/Controls.java index d097540..1c6c0dc 100644 --- a/src/main/java/frc/robot/Controls.java +++ b/src/main/java/frc/robot/Controls.java @@ -5,8 +5,6 @@ package frc.robot; import static edu.wpi.first.units.Units.MetersPerSecond; -import static edu.wpi.first.units.Units.RadiansPerSecond; -import static edu.wpi.first.units.Units.RotationsPerSecond; import com.ctre.phoenix6.swerve.SwerveModule.DriveRequestType; import com.ctre.phoenix6.swerve.SwerveRequest;