This repository was archived by the owner on Aug 23, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed
Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,6 @@ public class RobotContainer {
7676
7777 public CANdleSubSystem CANdle = new CANdleSubSystem ();
7878 private SwerveJoystickCommand swerveJoystickCommand ;
79- public boolean turnToAngleMode = false ;
8079
8180 /**
8281 * The container for the robot. Contain
@@ -171,7 +170,7 @@ public void initDefaultCommands_teleop() {
171170 // driverController::getR2Button, // Precision/"Sniper Button"
172171 () -> driverController .getR2Button (), // Precision mode (disabled)
173172 () -> {
174- if (turnToAngleMode ) {
173+ if (swerveDrive . getTurnToAngleMode () ) {
175174 return (
176175 driverController .getRightX () > 0.0
177176 || driverController .getRightY () > 0.0
@@ -306,6 +305,8 @@ public void configureBindings_teleop() {
306305 )
307306 );
308307
308+
309+
309310 commandOperatorController .povUp ().onTrue (
310311 Commands .runOnce (() -> superSystem .incrementOffset (0.5 ))
311312 );
@@ -317,7 +318,7 @@ public void configureBindings_teleop() {
317318 );
318319 commandDriverController .touchpad ().whileTrue (superSystem .shoot ())
319320 .whileFalse (superSystem .stow ());
320- commandDriverController .
321+ commandDriverController .triangle (). onTrue ( swerveDrive . toggleTurnToAngleMode ());
321322
322323 commandDriverController .L2 ().whileTrue (Commands .sequence (
323324 Commands .race (
Original file line number Diff line number Diff line change 1616import edu .wpi .first .math .kinematics .SwerveModuleState ;
1717import edu .wpi .first .wpilibj .smartdashboard .SmartDashboard ;
1818import edu .wpi .first .wpilibj2 .command .Command ;
19+ import edu .wpi .first .wpilibj2 .command .Commands ;
1920import frc .robot .Constants .ControllerConstants ;
2021import frc .robot .Constants .SwerveAutoConstants ;
2122import frc .robot .Constants .SwerveDriveConstants ;
2627import frc .robot .util .filters .Filter ;
2728import frc .robot .util .filters .FilterSeries ;
2829import frc .robot .util .filters .ScaleFilter ;
29-
3030public class SwerveJoystickCommand extends Command {
3131 private final SwerveDrivetrain swerveDrive ;
3232 private final Supplier <Double > xSpdFunction , ySpdFunction , turningSpdFunction ;
@@ -122,6 +122,7 @@ public void initialize() {}
122122
123123 @ Override
124124 public void execute () {
125+
125126 if (towSupplier .get ()) {
126127 swerveDrive .setModuleStates (SwerveDriveConstants .towModuleStates );
127128 return ;
@@ -199,6 +200,9 @@ public void execute() {
199200
200201 }
201202
203+
204+
205+
202206 public double getTargetAngle () {
203207 return targetAngle ;
204208 }
Original file line number Diff line number Diff line change @@ -479,6 +479,17 @@ public Command turnToSubwoofer(double angleTolerance) {
479479 command .addRequirements (this );
480480 return command ;
481481 }
482+
483+ public boolean turnToAngleMode = false ;
484+
485+ public Command toggleTurnToAngleMode () {
486+ return Commands .runOnce (() -> turnToAngleMode = !turnToAngleMode );
487+ }
488+
489+ public boolean getTurnToAngleMode () {
490+ return turnToAngleMode ;
491+ }
492+
482493 /**
483494 * Get the position of each swerve module
484495 * @return An array of swerve module positions
You can’t perform that action at this time.
0 commit comments