]> git.taranathan.com Git - FRC2026.git/commitdiff
removed default ps5 rumbles, fixed warnings
authoriefomit <timofei.stem@gmail.com>
Fri, 6 Mar 2026 01:38:55 +0000 (17:38 -0800)
committeriefomit <timofei.stem@gmail.com>
Fri, 6 Mar 2026 01:38:55 +0000 (17:38 -0800)
controller-tester.html [deleted file]
src/main/java/frc/robot/RobotContainer.java
src/main/java/frc/robot/controls/GameControllerDriverConfig.java
src/main/java/frc/robot/controls/PS5ControllerDriverConfig.java
src/main/java/frc/robot/controls/PS5XboxModeDriverConfig.java
src/main/java/lib/controllers/PS5Controller.java

diff --git a/controller-tester.html b/controller-tester.html
deleted file mode 100644 (file)
index dc5c6c0..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-    <title>DualSense rumble test</title>
-    <style>
-        body { font-family: sans-serif; padding: 20px; background: #1a1a1a; color: #fff; }
-        button { padding: 15px 30px; font-size: 16px; margin: 10px; cursor: pointer; }
-        #status { margin: 20px 0; padding: 10px; background: #333; }
-    </style>
-</head>
-<body>
-    <h1>DualSense rumble test</h1>
-    <div id="status">Not connected</div>
-    <button onclick="connect()">connect controller</button>
-    <button onclick="rumble()" id="rumbleBtn" disabled>test rumble</button>
-
-    <script>
-        const SONY_VENDOR_ID = 0x054c;
-        const DUALSENSE_PRODUCT_ID = 0x0ce6;
-        let device = null;
-
-        async function connect() {
-            const devices = await navigator.hid.requestDevice({
-                filters: [{ vendorId: SONY_VENDOR_ID, productId: DUALSENSE_PRODUCT_ID }]
-            });
-            if (devices.length === 0) return;
-
-            device = devices[0];
-            await device.open();
-            document.getElementById('status').textContent = 'connected: ' + device.productName;
-            document.getElementById('rumbleBtn').disabled = false;
-        }
-
-        async function sendRumble(left, right) {
-            if (!device) return;
-
-            // get report size from device
-            let size = 47;
-            if (device.collections?.[0]?.outputReports?.[0]?.items?.[0]) {
-                const item = device.collections[0].outputReports[0].items[0];
-                size = (item.reportSize * item.reportCount) / 8;
-            }
-
-            const report = new Uint8Array(size);
-            report[0] = 0x03;  // enable rumble
-            report[1] = 0xF7;
-            report[2] = right;
-            report[3] = left;
-
-            await device.sendReport(0x02, report);
-        }
-
-        async function rumble() {
-            await sendRumble(255, 255);
-            setTimeout(() => sendRumble(0, 0), 500);
-        }
-
-        // auto-connect if already paired
-        navigator.hid.getDevices().then(async devices => {
-            const ds = devices.find(d => d.vendorId === SONY_VENDOR_ID && d.productId === DUALSENSE_PRODUCT_ID);
-            if (ds) {
-                device = ds;
-                await device.open();
-                document.getElementById('status').textContent = 'connected: ' + device.productName;
-                document.getElementById('rumbleBtn').disabled = false;
-            }
-        });
-    </script>
-</body>
-</html>
index 06f6323c98c0c9a560d83adbbe28ff9d7f26f224..1b6e2ebe14fa2a1894a191f9ad934480061719ff 100644 (file)
@@ -24,7 +24,6 @@ import frc.robot.constants.AutoConstants;
 import frc.robot.constants.Constants;
 import frc.robot.controls.BaseDriverConfig;
 import frc.robot.controls.Operator;
-import frc.robot.controls.PS5ControllerDriverConfig;
 import frc.robot.controls.PS5XboxModeDriverConfig;
 import frc.robot.subsystems.Climb.LinearClimb;
 import frc.robot.subsystems.Intake.Intake;
index e30d47c4468fda2c35c632444276a1c86c103bdd..9c1fdbd777c4d93c4a54014369245b5dcba66d27 100644 (file)
@@ -6,8 +6,6 @@ import edu.wpi.first.math.geometry.Rotation2d;
 import edu.wpi.first.wpilibj.DriverStation.Alliance;
 import edu.wpi.first.wpilibj2.command.CommandScheduler;
 import edu.wpi.first.wpilibj2.command.InstantCommand;
-import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
-import edu.wpi.first.wpilibj2.command.WaitCommand;
 import frc.robot.Robot;
 import frc.robot.constants.Constants;
 import frc.robot.subsystems.drivetrain.Drivetrain;
@@ -38,12 +36,6 @@ public class GameControllerDriverConfig extends BaseDriverConfig {
       getDrivetrain().setDesiredPose(() -> null);
       CommandScheduler.getInstance().cancelAll();
     }));
-
-   // rumble test
-    driver.get(Button.A).onTrue(new SequentialCommandGroup(
-        new InstantCommand(() -> driver.setRumble(GameController.RumbleStatus.RUMBLE_ON)),
-        new WaitCommand(0.5),
-        new InstantCommand(() -> driver.setRumble(GameController.RumbleStatus.RUMBLE_OFF))));
   }
 
   @Override
@@ -85,13 +77,4 @@ public class GameControllerDriverConfig extends BaseDriverConfig {
   public GameController getGameController() {
     return driver;
   }
-
-  public void startRumble() {
-    driver.setRumble(GameController.RumbleStatus.RUMBLE_ON);
-  }
-
-  public void endRumble() {
-    driver.setRumble(GameController.RumbleStatus.RUMBLE_OFF);
-  }
-
 }
index e8919a110a52e11caec0439748d623d20d6e2f99..127a2bee58201b8b9671d547c3cb80efe33e750e 100644 (file)
@@ -8,8 +8,6 @@ import edu.wpi.first.wpilibj2.command.Command;
 import edu.wpi.first.wpilibj2.command.CommandScheduler;
 import edu.wpi.first.wpilibj2.command.FunctionalCommand;
 import edu.wpi.first.wpilibj2.command.InstantCommand;
-import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
-import edu.wpi.first.wpilibj2.command.WaitCommand;
 import frc.robot.Robot;
 import frc.robot.commands.gpm.AutoShootCommand;
 import frc.robot.commands.gpm.ClimbDriveCommand;
@@ -93,7 +91,7 @@ public class PS5ControllerDriverConfig extends BaseDriverConfig {
         if (intake != null && spindexer != null && shooter != null) {
             controller.get(PS5Button.CIRCLE).onTrue(new InstantCommand(() -> {
                 reverseMotors = new ReverseMotors(intake, spindexer);
-                reverseMotors.schedule();
+                CommandScheduler.getInstance().schedule(reverseMotors);
             })).onFalse(new InstantCommand(() -> {
                 if (reverseMotors != null) {
                     reverseMotors.cancel();
@@ -164,12 +162,8 @@ public class PS5ControllerDriverConfig extends BaseDriverConfig {
                 climb.retract();
             }));
 
-            // Drive to climb position and rumble
-            controller.get(PS5Button.TRIANGLE).onTrue(new SequentialCommandGroup(
-                    new ClimbDriveCommand(climb, getDrivetrain()),
-                    new InstantCommand(() -> this.startRumble()),
-                    new WaitCommand(1),
-                    new InstantCommand(() -> this.endRumble())));
+            // Drive to climb position
+            controller.get(PS5Button.TRIANGLE).onTrue(new ClimbDriveCommand(climb, getDrivetrain()));
         }
 
         // Hood
@@ -217,14 +211,4 @@ public class PS5ControllerDriverConfig extends BaseDriverConfig {
     public boolean getIsAlign() {
         return false;
     }
-
-    // doesn't work on ps5 controllers, use PS5XboxModeDriverConfig instead
-    public void startRumble() {
-        controller.rumbleOn();
-    }
-
-    // doesn't work on ps5 controllers, use PS5XboxModeDriverConfig instead
-    public void endRumble() {
-        controller.rumbleOff();
-    }
 }
index adb696e4f4a1e8e7482e5c3d22a5d906c976f1ea..e2f6879bd77bc31a0ef52561ee83afc46406fcbb 100644 (file)
@@ -126,7 +126,7 @@ public class PS5XboxModeDriverConfig extends BaseDriverConfig {
         if (intake != null && spindexer != null && shooter != null) {
             controller.get(CIRCLE).onTrue(new InstantCommand(() -> {
                 reverseMotors = new ReverseMotors(intake, spindexer);
-                reverseMotors.schedule();
+                CommandScheduler.getInstance().schedule(reverseMotors);
             })).onFalse(new InstantCommand(() -> {
                 if (reverseMotors != null) {
                     reverseMotors.cancel();
index 3f6b9c2a24c3a6b3e4aceb10f8f697aff4ebe169..ea65f055f8b7822589daaed661cb3a83ee926d6d 100644 (file)
@@ -1,7 +1,6 @@
 package lib.controllers;
 
 import edu.wpi.first.wpilibj.Joystick;
-import edu.wpi.first.wpilibj.GenericHID.RumbleType;
 import edu.wpi.first.wpilibj2.command.button.Trigger;
 
 import java.util.function.BooleanSupplier;
@@ -57,11 +56,13 @@ public class PS5Controller extends Controller {
         LEFT_Y(1),
         RIGHT_X(2),
         /**
-         * note: ps5 controller trigger goes from -1 when unpressed, to 1 when fully pressed
+         * note: ps5 controller trigger goes from -1 when unpressed, to 1 when fully
+         * pressed
          */
         LEFT_TRIGGER(3),
         /**
-         * note: ps5 controller trigger goes from -1 when unpressed, to 1 when fully pressed
+         * note: ps5 controller trigger goes from -1 when unpressed, to 1 when fully
+         * pressed
          */
         RIGHT_TRIGGER(4),
         RIGHT_Y(5);
@@ -106,14 +107,4 @@ public class PS5Controller extends Controller {
     public Joystick get() {
         return controller;
     }
-
-    public void rumbleOn() {
-        controller.setRumble(Joystick.RumbleType.kLeftRumble, 1.0);
-        controller.setRumble(Joystick.RumbleType.kRightRumble, 1.0);
-    }
-
-    public void rumbleOff() {
-        controller.setRumble(Joystick.RumbleType.kLeftRumble, 0.0);
-        controller.setRumble(Joystick.RumbleType.kRightRumble, 0.0);
-    }
 }
\ No newline at end of file