]> git.taranathan.com Git - FRC2026.git/commitdiff
fdas
authormixxlto <maxtan0626@gmail.com>
Thu, 22 Jan 2026 00:56:05 +0000 (16:56 -0800)
committermixxlto <maxtan0626@gmail.com>
Thu, 22 Jan 2026 00:56:05 +0000 (16:56 -0800)
src/main/java/frc/robot/commands/gpm/TurretJoyStickAim.java
src/main/java/frc/robot/controls/PS5ControllerDriverConfig.java

index 6c31a36c4d254c66a5ab38a0b764a12cd47cb551..90e8be27a481d7014a7f5fd92ffbdafca93e7b09 100644 (file)
@@ -11,8 +11,9 @@ public class TurretJoyStickAim extends Command{
     private Turret turret;
     private PS5ControllerDriverConfig driver;
 
-    public TurretJoyStickAim(Turret turret){
+    public TurretJoyStickAim(Turret turret, PS5ControllerDriverConfig driver){
         this.turret = turret;
+        this.driver = driver;
     }
 
     Rotation2d rotation2d = new Rotation2d(driver.getRawSideTranslation(), driver.getRawForwardTranslation());
index 037efb8c1a595a363e38ecb5da4f5269bf56c242..3f1a13624d5a778b5da30f3a75ece33af1b99461 100644 (file)
@@ -92,14 +92,16 @@ public class PS5ControllerDriverConfig extends BaseDriverConfig {
 
         driver.get(PS5Button.CROSS).onTrue(
             new InstantCommand(()->{
-                        if (turretJoyStickAim == null || !turretJoyStickAim.isScheduled()){
-                            turretJoyStickAim = new TurretJoyStickAim(turret, this.driver);
-                            CommandScheduler.getInstance().schedule(turretAutoShoot);
-                        }
-                    })
+                    if (turretJoyStickAim == null || !turretJoyStickAim.isScheduled()){
+                        turretJoyStickAim = new TurretJoyStickAim(turret, this);
+                        CommandScheduler.getInstance().schedule(turretAutoShoot);
+                    }
+                })
         ).onFalse(
             new InstantCommand(()->{
-                turretJoyStickAim.cancel();
+                if(turretJoyStickAim.isScheduled()){
+                    turretJoyStickAim.cancel();
+                }
             })
         );
     }