From ce28294cb12de954767b19cda02d79f4690541db Mon Sep 17 00:00:00 2001 From: atlanticbomber Date: Fri, 27 Mar 2026 14:27:57 -0700 Subject: [PATCH 01/17] added double swipe auto --- .../pathplanner/autos/left center 2 pass.auto | 235 ++++++++++++++++++ .../paths/center pass 2-bump-midfield.path | 68 +++++ .../paths/left mid neutral - left trench.path | 2 +- .../paths/left trench - left mid neutral.path | 12 +- .../paths/midfield-center pass 2.path | 75 ++++++ .../paths/netural zone-left midfield.path | 4 +- .../paths/neutral zone-left trench-hub.path | 2 +- 7 files changed, 388 insertions(+), 10 deletions(-) create mode 100644 src/main/deploy/pathplanner/autos/left center 2 pass.auto create mode 100644 src/main/deploy/pathplanner/paths/center pass 2-bump-midfield.path create mode 100644 src/main/deploy/pathplanner/paths/midfield-center pass 2.path diff --git a/src/main/deploy/pathplanner/autos/left center 2 pass.auto b/src/main/deploy/pathplanner/autos/left center 2 pass.auto new file mode 100644 index 00000000..d52d3182 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/left center 2 pass.auto @@ -0,0 +1,235 @@ +{ + "version": "2025.0", + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "race", + "data": { + "commands": [ + { + "type": "sequential", + "data": { + "commands": [ + { + "type": "parallel", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "left trench - left mid neutral" + } + }, + { + "type": "named", + "data": { + "name": "ExtendIntake" + } + }, + { + "type": "named", + "data": { + "name": "SpinRollerIntake" + } + } + ] + } + }, + { + "type": "parallel", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "netural zone-left midfield" + } + }, + { + "type": "named", + "data": { + "name": "StopRoller" + } + } + ] + } + }, + { + "type": "parallel", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "TrenchShot" + } + }, + { + "type": "sequential", + "data": { + "commands": [ + { + "type": "wait", + "data": { + "waitTime": 1.0 + } + }, + { + "type": "named", + "data": { + "name": "HalfwayIntake" + } + }, + { + "type": "wait", + "data": { + "waitTime": 0.5 + } + }, + { + "type": "named", + "data": { + "name": "RetractIntake" + } + } + ] + } + } + ] + } + } + ] + } + }, + { + "type": "wait", + "data": { + "waitTime": 9.5 + } + } + ] + } + }, + { + "type": "race", + "data": { + "commands": [ + { + "type": "sequential", + "data": { + "commands": [ + { + "type": "parallel", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "midfield-center pass 2" + } + }, + { + "type": "named", + "data": { + "name": "ExtendIntake" + } + }, + { + "type": "named", + "data": { + "name": "SpinRollerIntake" + } + } + ] + } + }, + { + "type": "parallel", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "center pass 2-bump-midfield" + } + }, + { + "type": "named", + "data": { + "name": "StopRoller" + } + } + ] + } + }, + { + "type": "parallel", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "TrenchShot" + } + }, + { + "type": "sequential", + "data": { + "commands": [ + { + "type": "wait", + "data": { + "waitTime": 1.0 + } + }, + { + "type": "named", + "data": { + "name": "HalfwayIntake" + } + }, + { + "type": "wait", + "data": { + "waitTime": 1.0 + } + }, + { + "type": "named", + "data": { + "name": "RetractIntake" + } + } + ] + } + } + ] + } + } + ] + } + }, + { + "type": "wait", + "data": { + "waitTime": 10.0 + } + } + ] + } + }, + { + "type": "named", + "data": { + "name": "ExtendIntake" + } + } + ] + } + }, + "resetOdom": true, + "folder": null, + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/paths/center pass 2-bump-midfield.path b/src/main/deploy/pathplanner/paths/center pass 2-bump-midfield.path new file mode 100644 index 00000000..272e5322 --- /dev/null +++ b/src/main/deploy/pathplanner/paths/center pass 2-bump-midfield.path @@ -0,0 +1,68 @@ +{ + "version": "2025.0", + "waypoints": [ + { + "anchor": { + "x": 6.810753311258278, + "y": 4.775513245033112 + }, + "prevControl": null, + "nextControl": { + "x": 6.033940397350993, + "y": 6.183940397350994 + }, + "isLocked": false, + "linkedName": "center pass 2" + }, + { + "anchor": { + "x": 3.1009271523228215, + "y": 6.677615894038647 + }, + "prevControl": { + "x": 2.875869205298013, + "y": 5.051390728476821 + }, + "nextControl": null, + "isLocked": false, + "linkedName": "left midfield" + } + ], + "rotationTargets": [], + "constraintZones": [ + { + "name": "Constraints Zone", + "minWaypointRelativePos": 0.08935064935064813, + "maxWaypointRelativePos": 0.6316883116883086, + "constraints": { + "maxVelocity": 6.0, + "maxAcceleration": 10.0, + "maxAngularVelocity": 540.0, + "maxAngularAcceleration": 720.0, + "nominalVoltage": 12.0, + "unlimited": false + } + } + ], + "pointTowardsZones": [], + "eventMarkers": [], + "globalConstraints": { + "maxVelocity": 3.0, + "maxAcceleration": 3.0, + "maxAngularVelocity": 540.0, + "maxAngularAcceleration": 720.0, + "nominalVoltage": 12.0, + "unlimited": false + }, + "goalEndState": { + "velocity": 0, + "rotation": -70.0 + }, + "reversed": false, + "folder": null, + "idealStartingState": { + "velocity": 0, + "rotation": -90.0 + }, + "useDefaultConstraints": true +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/paths/left mid neutral - left trench.path b/src/main/deploy/pathplanner/paths/left mid neutral - left trench.path index 46b761b0..e70e54a5 100644 --- a/src/main/deploy/pathplanner/paths/left mid neutral - left trench.path +++ b/src/main/deploy/pathplanner/paths/left mid neutral - left trench.path @@ -64,7 +64,7 @@ "folder": null, "idealStartingState": { "velocity": 0, - "rotation": -57.00000000000001 + "rotation": -70.0 }, "useDefaultConstraints": true } \ No newline at end of file diff --git a/src/main/deploy/pathplanner/paths/left trench - left mid neutral.path b/src/main/deploy/pathplanner/paths/left trench - left mid neutral.path index c9b99ade..5944429a 100644 --- a/src/main/deploy/pathplanner/paths/left trench - left mid neutral.path +++ b/src/main/deploy/pathplanner/paths/left trench - left mid neutral.path @@ -20,12 +20,12 @@ "y": 7.236630794701986 }, "prevControl": { - "x": 7.404075333981382, - "y": 7.438706879568271 + "x": 7.455112710137546, + "y": 7.467400025471218 }, "nextControl": { - "x": 7.9796026490066225, - "y": 6.648576158940396 + "x": 7.805364238410595, + "y": 6.626796357615893 }, "isLocked": false, "linkedName": null @@ -47,7 +47,7 @@ "rotationTargets": [ { "waypointRelativePos": 1.1341350601295181, - "rotationDegrees": -57.00000000000001 + "rotationDegrees": -70.0 } ], "constraintZones": [], @@ -63,7 +63,7 @@ }, "goalEndState": { "velocity": 0, - "rotation": -57.00000000000001 + "rotation": -70.0 }, "reversed": false, "folder": null, diff --git a/src/main/deploy/pathplanner/paths/midfield-center pass 2.path b/src/main/deploy/pathplanner/paths/midfield-center pass 2.path new file mode 100644 index 00000000..2f427471 --- /dev/null +++ b/src/main/deploy/pathplanner/paths/midfield-center pass 2.path @@ -0,0 +1,75 @@ +{ + "version": "2025.0", + "waypoints": [ + { + "anchor": { + "x": 3.1009271523228215, + "y": 6.677615894038647 + }, + "prevControl": null, + "nextControl": { + "x": 2.5491721854286395, + "y": 7.396349337751505 + }, + "isLocked": false, + "linkedName": "left midfield" + }, + { + "anchor": { + "x": 4.552913907282945, + "y": 7.476208609274684 + }, + "prevControl": { + "x": 3.093304172211311, + "y": 7.481348080172824 + }, + "nextControl": { + "x": 6.614735099335925, + "y": 7.468948675499848 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 6.810753311258278, + "y": 4.775513245033112 + }, + "prevControl": { + "x": 6.78171357615894, + "y": 6.590496688741721 + }, + "nextControl": null, + "isLocked": false, + "linkedName": "center pass 2" + } + ], + "rotationTargets": [ + { + "waypointRelativePos": 0.83996299722478, + "rotationDegrees": 0.0 + } + ], + "constraintZones": [], + "pointTowardsZones": [], + "eventMarkers": [], + "globalConstraints": { + "maxVelocity": 3.0, + "maxAcceleration": 3.0, + "maxAngularVelocity": 540.0, + "maxAngularAcceleration": 720.0, + "nominalVoltage": 12.0, + "unlimited": false + }, + "goalEndState": { + "velocity": 0, + "rotation": -90.0 + }, + "reversed": false, + "folder": null, + "idealStartingState": { + "velocity": 0, + "rotation": -70.0 + }, + "useDefaultConstraints": true +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/paths/netural zone-left midfield.path b/src/main/deploy/pathplanner/paths/netural zone-left midfield.path index 2b65e1ed..cfe643df 100644 --- a/src/main/deploy/pathplanner/paths/netural zone-left midfield.path +++ b/src/main/deploy/pathplanner/paths/netural zone-left midfield.path @@ -74,13 +74,13 @@ }, "goalEndState": { "velocity": 0, - "rotation": -62.0 + "rotation": -70.0 }, "reversed": false, "folder": null, "idealStartingState": { "velocity": 0, - "rotation": -57.00000000000001 + "rotation": -70.0 }, "useDefaultConstraints": true } \ No newline at end of file diff --git a/src/main/deploy/pathplanner/paths/neutral zone-left trench-hub.path b/src/main/deploy/pathplanner/paths/neutral zone-left trench-hub.path index 683b01ed..e71ecef4 100644 --- a/src/main/deploy/pathplanner/paths/neutral zone-left trench-hub.path +++ b/src/main/deploy/pathplanner/paths/neutral zone-left trench-hub.path @@ -101,7 +101,7 @@ "folder": null, "idealStartingState": { "velocity": 0, - "rotation": -57.00000000000001 + "rotation": -70.0 }, "useDefaultConstraints": true } \ No newline at end of file From 2403a51993f1238449e55048e97eb08940d13186 Mon Sep 17 00:00:00 2001 From: Spderman3333 <118777573+spderman3333@users.noreply.github.com> Date: Fri, 27 Mar 2026 18:30:28 -0700 Subject: [PATCH 02/17] Deleted bad autos --- .../left trench-mid intake-trenchshot.auto | 107 ---------- .../autos/left-mid double trench cycle.auto | 191 ------------------ 2 files changed, 298 deletions(-) delete mode 100644 src/main/deploy/pathplanner/autos/left trench-mid intake-trenchshot.auto delete mode 100644 src/main/deploy/pathplanner/autos/left-mid double trench cycle.auto diff --git a/src/main/deploy/pathplanner/autos/left trench-mid intake-trenchshot.auto b/src/main/deploy/pathplanner/autos/left trench-mid intake-trenchshot.auto deleted file mode 100644 index bb6a88c6..00000000 --- a/src/main/deploy/pathplanner/autos/left trench-mid intake-trenchshot.auto +++ /dev/null @@ -1,107 +0,0 @@ -{ - "version": "2025.0", - "command": { - "type": "sequential", - "data": { - "commands": [ - { - "type": "named", - "data": { - "name": "TrenchShot" - } - }, - { - "type": "parallel", - "data": { - "commands": [ - { - "type": "path", - "data": { - "pathName": "left trench - left mid neutral" - } - }, - { - "type": "named", - "data": { - "name": "ExtendIntake" - } - }, - { - "type": "named", - "data": { - "name": "SpinRollerIntake" - } - } - ] - } - }, - { - "type": "parallel", - "data": { - "commands": [ - { - "type": "path", - "data": { - "pathName": "left mid neutral - left trench" - } - }, - { - "type": "named", - "data": { - "name": "StopRoller" - } - } - ] - } - }, - { - "type": "parallel", - "data": { - "commands": [ - { - "type": "named", - "data": { - "name": "TrenchShot" - } - }, - { - "type": "sequential", - "data": { - "commands": [ - { - "type": "wait", - "data": { - "waitTime": 1.0 - } - }, - { - "type": "named", - "data": { - "name": "HalfwayIntake" - } - }, - { - "type": "named", - "data": { - "name": "RetractIntake" - } - } - ] - } - } - ] - } - }, - { - "type": "named", - "data": { - "name": "ExtendIntake" - } - } - ] - } - }, - "resetOdom": true, - "folder": null, - "choreoAuto": false -} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/left-mid double trench cycle.auto b/src/main/deploy/pathplanner/autos/left-mid double trench cycle.auto deleted file mode 100644 index dc80b411..00000000 --- a/src/main/deploy/pathplanner/autos/left-mid double trench cycle.auto +++ /dev/null @@ -1,191 +0,0 @@ -{ - "version": "2025.0", - "command": { - "type": "sequential", - "data": { - "commands": [ - { - "type": "named", - "data": { - "name": "TrenchShot" - } - }, - { - "type": "race", - "data": { - "commands": [ - { - "type": "sequential", - "data": { - "commands": [ - { - "type": "parallel", - "data": { - "commands": [ - { - "type": "path", - "data": { - "pathName": "left trench - left mid neutral" - } - }, - { - "type": "named", - "data": { - "name": "ExtendIntake" - } - }, - { - "type": "named", - "data": { - "name": "SpinRollerIntake" - } - } - ] - } - }, - { - "type": "parallel", - "data": { - "commands": [ - { - "type": "path", - "data": { - "pathName": "left mid neutral - left trench" - } - }, - { - "type": "named", - "data": { - "name": "StopRoller" - } - } - ] - } - }, - { - "type": "race", - "data": { - "commands": [ - { - "type": "named", - "data": { - "name": "TrenchShot" - } - }, - { - "type": "named", - "data": { - "name": "WalleMode" - } - } - ] - } - } - ] - } - }, - { - "type": "wait", - "data": { - "waitTime": 9.0 - } - } - ] - } - }, - { - "type": "race", - "data": { - "commands": [ - { - "type": "sequential", - "data": { - "commands": [ - { - "type": "parallel", - "data": { - "commands": [ - { - "type": "path", - "data": { - "pathName": "left trench - left mid neutral" - } - }, - { - "type": "named", - "data": { - "name": "ExtendIntake" - } - }, - { - "type": "named", - "data": { - "name": "SpinRollerIntake" - } - } - ] - } - }, - { - "type": "parallel", - "data": { - "commands": [ - { - "type": "path", - "data": { - "pathName": "left mid neutral - left trench" - } - }, - { - "type": "named", - "data": { - "name": "StopRoller" - } - } - ] - } - }, - { - "type": "race", - "data": { - "commands": [ - { - "type": "named", - "data": { - "name": "TrenchShot" - } - }, - { - "type": "named", - "data": { - "name": "WalleMode" - } - } - ] - } - } - ] - } - }, - { - "type": "wait", - "data": { - "waitTime": 10.0 - } - } - ] - } - }, - { - "type": "named", - "data": { - "name": "ExtendIntake" - } - } - ] - } - }, - "resetOdom": true, - "folder": null, - "choreoAuto": false -} \ No newline at end of file From d134778a2966fdbc2cf0d2b65635b5eacb8cb9c0 Mon Sep 17 00:00:00 2001 From: Spderman3333 <118777573+spderman3333@users.noreply.github.com> Date: Fri, 27 Mar 2026 18:31:42 -0700 Subject: [PATCH 03/17] Increased kicker voltage --- .../java/com/team2813/subsystems/kicker/KickerConstants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/team2813/subsystems/kicker/KickerConstants.java b/src/main/java/com/team2813/subsystems/kicker/KickerConstants.java index 083bbb49..d794715f 100644 --- a/src/main/java/com/team2813/subsystems/kicker/KickerConstants.java +++ b/src/main/java/com/team2813/subsystems/kicker/KickerConstants.java @@ -21,6 +21,6 @@ class KickerConstants { static final double KICKER_MOTOR_TO_FLYWHEEL_GEARING = 2.0 / 5.0; - static final double SHOOT_VOLTAGE = 7; + static final double SHOOT_VOLTAGE = 9; static final double RESIST_FUEL_VOLTAGE = -3; } From 6cb429dec410d87954df8e3465eb38b87460f9a2 Mon Sep 17 00:00:00 2001 From: Spderman3333 <118777573+spderman3333@users.noreply.github.com> Date: Fri, 27 Mar 2026 19:01:22 -0700 Subject: [PATCH 04/17] Refactored kicker preferences to be more readable, and not update preferences until needed. --- .../team2813/subsystems/kicker/Kicker.java | 51 ++----------------- .../subsystems/kicker/KickerConstants.java | 22 ++++++-- 2 files changed, 21 insertions(+), 52 deletions(-) diff --git a/src/main/java/com/team2813/subsystems/kicker/Kicker.java b/src/main/java/com/team2813/subsystems/kicker/Kicker.java index 042c7325..a7a2fcee 100644 --- a/src/main/java/com/team2813/subsystems/kicker/Kicker.java +++ b/src/main/java/com/team2813/subsystems/kicker/Kicker.java @@ -3,8 +3,6 @@ import static edu.wpi.first.units.Units.Volts; import edu.wpi.first.units.measure.Voltage; -import edu.wpi.first.wpilibj.Alert; -import edu.wpi.first.wpilibj.Preferences; import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.StartEndCommand; import edu.wpi.first.wpilibj2.command.SubsystemBase; @@ -20,49 +18,25 @@ public class Kicker extends SubsystemBase implements AutoCloseable { private final KickerIO io; private final KickerIOInputsAutoLogged replayedInputs; - /** - * @see #shootCommand() - */ - private double shootVoltage = KickerConstants.SHOOT_VOLTAGE; - - /** - * @see #resistFuelCommand() - */ - private double resistFuelVoltage = KickerConstants.RESIST_FUEL_VOLTAGE; - - // note: could put alerts in a kicker-specific location, but it will be easier for seeing alerts - // to put them all in the same place - // also, the default behavior is to not show the alert - private final Alert shootVoltageWarning = - new Alert(createAlertMessage("shoot voltage"), Alert.AlertType.kInfo); - private final Alert resistFuelVoltageWarning = - new Alert(createAlertMessage("resist fuel voltage"), Alert.AlertType.kInfo); - public Kicker(KickerIO io) { - this.io = Objects.requireNonNull(io, "io"); + this.io = Objects.requireNonNull(io, "[Kicker] \"io\" cannot be null!"); this.replayedInputs = new KickerIOInputsAutoLogged(); - - Preferences.initDouble(KickerConstants.SHOOT_PREFERENCE_NT, shootVoltage); - Preferences.initDouble(KickerConstants.RESIST_FUEL_PREFERENCE_NT, resistFuelVoltage); - shootVoltageWarning.set(false); - resistFuelVoltageWarning.set(false); } @Override public void periodic() { // could put somewhere else, but all the other code updates preferences once per cycle anyway - updatePreferences(); io.updateState(replayedInputs); Logger.processInputs("Kicker", replayedInputs); } private void shoot() { - io.setMotorVoltage(Volts.of(shootVoltage)); + io.setMotorVoltage(KickerConstants.getShootVoltage()); } private void resistFuel() { - io.setMotorVoltage(Volts.of(resistFuelVoltage)); + io.setMotorVoltage(KickerConstants.getResistFuelVoltage()); } public void stop() { @@ -102,25 +76,6 @@ public Command customVoltageCommand(Voltage voltageToRun) { return new StartEndCommand(() -> io.setMotorVoltage(voltageToRun), this::stop, this); } - /** - * Refresh all values from preferences. This will also put alerts onto NetworkTables if the value - * from preferences does not match the value in code to encourage keeping the code up-to-date. - */ - // note: if we update preferences somewhere else, we may need to change the visibility of this. - private void updatePreferences() { - shootVoltage = Preferences.getDouble(KickerConstants.SHOOT_PREFERENCE_NT, shootVoltage); - shootVoltageWarning.set(shootVoltage != KickerConstants.SHOOT_VOLTAGE); - resistFuelVoltage = - Preferences.getDouble(KickerConstants.RESIST_FUEL_PREFERENCE_NT, resistFuelVoltage); - resistFuelVoltageWarning.set(resistFuelVoltage != KickerConstants.RESIST_FUEL_VOLTAGE); - } - - private static String createAlertMessage(String preference) { - return String.format( - "[KICKER] The %s was changed in Preferences! Once you are done tuning, please update the code!", - preference); - } - @Override public void close() { io.close(); diff --git a/src/main/java/com/team2813/subsystems/kicker/KickerConstants.java b/src/main/java/com/team2813/subsystems/kicker/KickerConstants.java index d794715f..4edc11f4 100644 --- a/src/main/java/com/team2813/subsystems/kicker/KickerConstants.java +++ b/src/main/java/com/team2813/subsystems/kicker/KickerConstants.java @@ -1,13 +1,14 @@ package com.team2813.subsystems.kicker; -import static edu.wpi.first.units.Units.Amps; -import static edu.wpi.first.units.Units.KilogramSquareMeters; +import static edu.wpi.first.units.Units.*; import com.ctre.phoenix6.configs.CurrentLimitsConfigs; import com.ctre.phoenix6.configs.MotorOutputConfigs; import com.ctre.phoenix6.configs.TalonFXConfiguration; import com.ctre.phoenix6.signals.InvertedValue; import edu.wpi.first.units.measure.MomentOfInertia; +import edu.wpi.first.units.measure.Voltage; +import edu.wpi.first.wpilibj.Preferences; class KickerConstants { static final MomentOfInertia KICKER_SIM_MOI = KilogramSquareMeters.of(0.0000535531); @@ -21,6 +22,19 @@ class KickerConstants { static final double KICKER_MOTOR_TO_FLYWHEEL_GEARING = 2.0 / 5.0; - static final double SHOOT_VOLTAGE = 9; - static final double RESIST_FUEL_VOLTAGE = -3; + static final double SHOOT_VOLTAGE_DEFAULT = 9; + static final double RESIST_FUEL_VOLTAGE_DEFAULT = -3; + + static { + Preferences.initDouble(SHOOT_PREFERENCE_NT, SHOOT_VOLTAGE_DEFAULT); + Preferences.initDouble(RESIST_FUEL_PREFERENCE_NT, RESIST_FUEL_VOLTAGE_DEFAULT); + } + + public static Voltage getShootVoltage() { + return Volts.of(Preferences.getDouble(SHOOT_PREFERENCE_NT, SHOOT_VOLTAGE_DEFAULT)); + } + + public static Voltage getResistFuelVoltage() { + return Volts.of(Preferences.getDouble(RESIST_FUEL_PREFERENCE_NT, RESIST_FUEL_VOLTAGE_DEFAULT)); + } } From 64104be416c75fce9d2c26e814b89d0f76c191a0 Mon Sep 17 00:00:00 2001 From: Spderman3333 <118777573+spderman3333@users.noreply.github.com> Date: Fri, 27 Mar 2026 21:55:15 -0700 Subject: [PATCH 05/17] Fixed autos --- .../pathplanner/paths/center pass 2-bump-midfield.path | 10 +++++----- .../pathplanner/paths/midfield-center pass 2.path | 10 +++++----- .../pathplanner/paths/netural zone-left midfield.path | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/deploy/pathplanner/paths/center pass 2-bump-midfield.path b/src/main/deploy/pathplanner/paths/center pass 2-bump-midfield.path index 272e5322..b573c16d 100644 --- a/src/main/deploy/pathplanner/paths/center pass 2-bump-midfield.path +++ b/src/main/deploy/pathplanner/paths/center pass 2-bump-midfield.path @@ -16,12 +16,12 @@ }, { "anchor": { - "x": 3.1009271523228215, - "y": 6.677615894038647 + "x": 2.8228555555555555, + "y": 6.198266666666666 }, "prevControl": { - "x": 2.875869205298013, - "y": 5.051390728476821 + "x": 2.597797608530747, + "y": 4.57204150110484 }, "nextControl": null, "isLocked": false, @@ -56,7 +56,7 @@ }, "goalEndState": { "velocity": 0, - "rotation": -70.0 + "rotation": -54.32359177813802 }, "reversed": false, "folder": null, diff --git a/src/main/deploy/pathplanner/paths/midfield-center pass 2.path b/src/main/deploy/pathplanner/paths/midfield-center pass 2.path index 2f427471..7b25eeac 100644 --- a/src/main/deploy/pathplanner/paths/midfield-center pass 2.path +++ b/src/main/deploy/pathplanner/paths/midfield-center pass 2.path @@ -3,13 +3,13 @@ "waypoints": [ { "anchor": { - "x": 3.1009271523228215, - "y": 6.677615894038647 + "x": 2.8228555555555555, + "y": 6.198266666666666 }, "prevControl": null, "nextControl": { - "x": 2.5491721854286395, - "y": 7.396349337751505 + "x": 2.2711005886613735, + "y": 6.917000110379524 }, "isLocked": false, "linkedName": "left midfield" @@ -69,7 +69,7 @@ "folder": null, "idealStartingState": { "velocity": 0, - "rotation": -70.0 + "rotation": -54.32359177813802 }, "useDefaultConstraints": true } \ No newline at end of file diff --git a/src/main/deploy/pathplanner/paths/netural zone-left midfield.path b/src/main/deploy/pathplanner/paths/netural zone-left midfield.path index cfe643df..a529cd51 100644 --- a/src/main/deploy/pathplanner/paths/netural zone-left midfield.path +++ b/src/main/deploy/pathplanner/paths/netural zone-left midfield.path @@ -32,12 +32,12 @@ }, { "anchor": { - "x": 3.1009271523228215, - "y": 6.677615894038647 + "x": 2.8228555555555555, + "y": 6.198266666666666 }, "prevControl": { - "x": 2.273294701991696, - "y": 7.7738658940386465 + "x": 1.9952231052244298, + "y": 7.294516666666666 }, "nextControl": null, "isLocked": false, @@ -74,7 +74,7 @@ }, "goalEndState": { "velocity": 0, - "rotation": -70.0 + "rotation": -54.32359177813802 }, "reversed": false, "folder": null, From c5f029f190fa762b69ae0cad2649356b7e3dfdbf Mon Sep 17 00:00:00 2001 From: Spderman3333 <118777573+spderman3333@users.noreply.github.com> Date: Sat, 28 Mar 2026 09:34:38 -0700 Subject: [PATCH 06/17] Added VariableShot named command. --- src/main/java/com/team2813/RobotContainer.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/com/team2813/RobotContainer.java b/src/main/java/com/team2813/RobotContainer.java index 86af2b2e..ffe3441d 100644 --- a/src/main/java/com/team2813/RobotContainer.java +++ b/src/main/java/com/team2813/RobotContainer.java @@ -384,6 +384,18 @@ private void namedCommandsRegistration() { new ParallelCommandGroup(kicker.shootCommand(), hopper.intakeCommand()))), new WaitCommand(6))); + NamedCommands.registerCommand( + "VariableShot", + new ParallelRaceGroup( + new ParallelCommandGroup( + VariableShooterCommand.shootBasedOnDistanceCommand( + shooter, + () -> HubPositionUtil.getBotToHubDistance(drive.getPose(), currentAlliance)), + new SequentialCommandGroup( + new WaitCommand(0.5), + new ParallelCommandGroup(kicker.shootCommand(), hopper.intakeCommand()))), + new WaitCommand(6))); + NamedCommands.registerCommand( "ExtendIntake", intakeExtension From 9ad67ef8b113182146609a4a48d008e27b26b99c Mon Sep 17 00:00:00 2001 From: Spderman3333 <118777573+spderman3333@users.noreply.github.com> Date: Sat, 28 Mar 2026 09:38:45 -0700 Subject: [PATCH 07/17] Updated paths. --- .../pathplanner/autos/left center 2 pass.auto | 4 +-- .../paths/left trench - left mid neutral.path | 25 ++++++++----------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/main/deploy/pathplanner/autos/left center 2 pass.auto b/src/main/deploy/pathplanner/autos/left center 2 pass.auto index d52d3182..fb80ac87 100644 --- a/src/main/deploy/pathplanner/autos/left center 2 pass.auto +++ b/src/main/deploy/pathplanner/autos/left center 2 pass.auto @@ -63,7 +63,7 @@ { "type": "named", "data": { - "name": "TrenchShot" + "name": "VariableShot" } }, { @@ -171,7 +171,7 @@ { "type": "named", "data": { - "name": "TrenchShot" + "name": "VariableShot" } }, { diff --git a/src/main/deploy/pathplanner/paths/left trench - left mid neutral.path b/src/main/deploy/pathplanner/paths/left trench - left mid neutral.path index 5944429a..dbbe0544 100644 --- a/src/main/deploy/pathplanner/paths/left trench - left mid neutral.path +++ b/src/main/deploy/pathplanner/paths/left trench - left mid neutral.path @@ -16,16 +16,16 @@ }, { "anchor": { - "x": 7.551266556291392, - "y": 7.236630794701986 + "x": 6.028777777777779, + "y": 7.426066666666667 }, "prevControl": { - "x": 7.455112710137546, - "y": 7.467400025471218 + "x": 5.817328286803404, + "y": 7.559442499435121 }, "nextControl": { - "x": 7.805364238410595, - "y": 6.626796357615893 + "x": 6.662166666666667, + "y": 7.026544444444443 }, "isLocked": false, "linkedName": null @@ -44,18 +44,13 @@ "linkedName": "left mid neutral" } ], - "rotationTargets": [ - { - "waypointRelativePos": 1.1341350601295181, - "rotationDegrees": -70.0 - } - ], + "rotationTargets": [], "constraintZones": [], "pointTowardsZones": [], "eventMarkers": [], "globalConstraints": { - "maxVelocity": 3.0, - "maxAcceleration": 3.0, + "maxVelocity": 6.0, + "maxAcceleration": 4.0, "maxAngularVelocity": 540.0, "maxAngularAcceleration": 720.0, "nominalVoltage": 12.0, @@ -71,5 +66,5 @@ "velocity": 0, "rotation": -90.0 }, - "useDefaultConstraints": true + "useDefaultConstraints": false } \ No newline at end of file From c623f27621dd591bf95c0d6f0ba583cba51ac8c4 Mon Sep 17 00:00:00 2001 From: Spderman3333 <118777573+spderman3333@users.noreply.github.com> Date: Sat, 28 Mar 2026 11:16:03 -0700 Subject: [PATCH 08/17] Update at 'Sat Mar 28 11:16:03 PDT 2026' --- src/main/java/com/team2813/commands/VariableShooterCommand.java | 2 +- .../team2813/subsystems/intakeroller/IntakeRollerConstants.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/team2813/commands/VariableShooterCommand.java b/src/main/java/com/team2813/commands/VariableShooterCommand.java index 9128a3ff..a8768f07 100644 --- a/src/main/java/com/team2813/commands/VariableShooterCommand.java +++ b/src/main/java/com/team2813/commands/VariableShooterCommand.java @@ -19,7 +19,7 @@ public class VariableShooterCommand { RotationsPerSecond.of(100); // 3.5 meters from hub speed. public static final Distance MIN_DIST = Meters.of(1.5); - public static final Distance MAX_DIST = Meters.of(3.5); + public static final Distance MAX_DIST = Meters.of(3.33); /** * Calculates the speed to shoot at if between the 1.5/3.1 MIN/MAX distance. diff --git a/src/main/java/com/team2813/subsystems/intakeroller/IntakeRollerConstants.java b/src/main/java/com/team2813/subsystems/intakeroller/IntakeRollerConstants.java index 7e55afcb..63c8372c 100644 --- a/src/main/java/com/team2813/subsystems/intakeroller/IntakeRollerConstants.java +++ b/src/main/java/com/team2813/subsystems/intakeroller/IntakeRollerConstants.java @@ -29,7 +29,7 @@ public class IntakeRollerConstants { public static final double INTAKE_SIM_MOI = 0.00011331; // In kg*m^2 static { - Preferences.initFloat(INTAKE_PREFERENCE_NT, 8); + Preferences.initFloat(INTAKE_PREFERENCE_NT, 9); Preferences.initFloat(OUTTAKE_PREFERENCE_NT, -6); } From c239399c08bdd7d4e18a13c437bc8a649769cc2c Mon Sep 17 00:00:00 2001 From: Spderman3333 <118777573+spderman3333@users.noreply.github.com> Date: Sat, 28 Mar 2026 13:35:13 -0700 Subject: [PATCH 09/17] Split controls, and gave driver spooling priority --- src/main/java/com/team2813/RobotContainer.java | 18 +++++++++--------- .../commands/VariableShooterCommand.java | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/team2813/RobotContainer.java b/src/main/java/com/team2813/RobotContainer.java index ffe3441d..bd02e2de 100644 --- a/src/main/java/com/team2813/RobotContainer.java +++ b/src/main/java/com/team2813/RobotContainer.java @@ -299,15 +299,15 @@ private void configureButtonBindings() { driveController .a() .whileTrue( - Commands.parallel( - DriveCommands.joystickDriveAtAngle( - drive, - () -> -driveController.getLeftY(), - () -> -driveController.getLeftX(), - () -> HubPositionUtil.getBotToHubAngle(drive.getPose(), currentAlliance)), - VariableShooterCommand.shootBasedOnDistanceCommand( - shooter, - () -> HubPositionUtil.getBotToHubDistance(drive.getPose(), currentAlliance)))); + DriveCommands.joystickDriveAtAngle( + drive, + () -> -driveController.getLeftY(), + () -> -driveController.getLeftX(), + () -> HubPositionUtil.getBotToHubAngle(drive.getPose(), currentAlliance))) + .whileTrue( + VariableShooterCommand.shootBasedOnDistanceCommand( + shooter, + () -> HubPositionUtil.getBotToHubDistance(drive.getPose(), currentAlliance))); } // controller rumble diff --git a/src/main/java/com/team2813/commands/VariableShooterCommand.java b/src/main/java/com/team2813/commands/VariableShooterCommand.java index a8768f07..e806eb6f 100644 --- a/src/main/java/com/team2813/commands/VariableShooterCommand.java +++ b/src/main/java/com/team2813/commands/VariableShooterCommand.java @@ -41,6 +41,6 @@ private static void shootBasedOnDistance(Shooter shooter, Supplier dis public static Command shootBasedOnDistanceCommand( Shooter shooter, Supplier distanceSupplier) { return new RunCommand(() -> shootBasedOnDistance(shooter, distanceSupplier), shooter) - .finallyDo(shooter::stop); + .finallyDo(shooter::stop).withInterruptBehavior(Command.InterruptionBehavior.kCancelIncoming); } } From 50219b6b4bbefb7467fad82f856e3188e931038d Mon Sep 17 00:00:00 2001 From: Spderman3333 <118777573+spderman3333@users.noreply.github.com> Date: Sat, 28 Mar 2026 13:46:40 -0700 Subject: [PATCH 10/17] Introduced greedy autos --- .../autos/greedy left center 2 pass.auto | 235 ++++++++++++++++++ .../greedy center pass 2-bump-midfield.path | 70 ++++++ ...greedy left trench - left mid neutral.path | 70 ++++++ .../paths/greedy midfield-center pass 2.path | 89 +++++++ .../greedy netural zone-left midfield.path | 86 +++++++ 5 files changed, 550 insertions(+) create mode 100644 src/main/deploy/pathplanner/autos/greedy left center 2 pass.auto create mode 100644 src/main/deploy/pathplanner/paths/greedy center pass 2-bump-midfield.path create mode 100644 src/main/deploy/pathplanner/paths/greedy left trench - left mid neutral.path create mode 100644 src/main/deploy/pathplanner/paths/greedy midfield-center pass 2.path create mode 100644 src/main/deploy/pathplanner/paths/greedy netural zone-left midfield.path diff --git a/src/main/deploy/pathplanner/autos/greedy left center 2 pass.auto b/src/main/deploy/pathplanner/autos/greedy left center 2 pass.auto new file mode 100644 index 00000000..9a2bc29e --- /dev/null +++ b/src/main/deploy/pathplanner/autos/greedy left center 2 pass.auto @@ -0,0 +1,235 @@ +{ + "version": "2025.0", + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "race", + "data": { + "commands": [ + { + "type": "sequential", + "data": { + "commands": [ + { + "type": "parallel", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "greedy left trench - left mid neutral" + } + }, + { + "type": "named", + "data": { + "name": "ExtendIntake" + } + }, + { + "type": "named", + "data": { + "name": "SpinRollerIntake" + } + } + ] + } + }, + { + "type": "parallel", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "greedy netural zone-left midfield" + } + }, + { + "type": "named", + "data": { + "name": "StopRoller" + } + } + ] + } + }, + { + "type": "parallel", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "VariableShot" + } + }, + { + "type": "sequential", + "data": { + "commands": [ + { + "type": "wait", + "data": { + "waitTime": 1.0 + } + }, + { + "type": "named", + "data": { + "name": "HalfwayIntake" + } + }, + { + "type": "wait", + "data": { + "waitTime": 0.5 + } + }, + { + "type": "named", + "data": { + "name": "RetractIntake" + } + } + ] + } + } + ] + } + } + ] + } + }, + { + "type": "wait", + "data": { + "waitTime": 9.5 + } + } + ] + } + }, + { + "type": "race", + "data": { + "commands": [ + { + "type": "sequential", + "data": { + "commands": [ + { + "type": "parallel", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "greedy midfield-center pass 2" + } + }, + { + "type": "named", + "data": { + "name": "ExtendIntake" + } + }, + { + "type": "named", + "data": { + "name": "SpinRollerIntake" + } + } + ] + } + }, + { + "type": "parallel", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "greedy center pass 2-bump-midfield" + } + }, + { + "type": "named", + "data": { + "name": "StopRoller" + } + } + ] + } + }, + { + "type": "parallel", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "VariableShot" + } + }, + { + "type": "sequential", + "data": { + "commands": [ + { + "type": "wait", + "data": { + "waitTime": 1.0 + } + }, + { + "type": "named", + "data": { + "name": "HalfwayIntake" + } + }, + { + "type": "wait", + "data": { + "waitTime": 1.0 + } + }, + { + "type": "named", + "data": { + "name": "RetractIntake" + } + } + ] + } + } + ] + } + } + ] + } + }, + { + "type": "wait", + "data": { + "waitTime": 10.0 + } + } + ] + } + }, + { + "type": "named", + "data": { + "name": "ExtendIntake" + } + } + ] + } + }, + "resetOdom": true, + "folder": null, + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/paths/greedy center pass 2-bump-midfield.path b/src/main/deploy/pathplanner/paths/greedy center pass 2-bump-midfield.path new file mode 100644 index 00000000..4f620411 --- /dev/null +++ b/src/main/deploy/pathplanner/paths/greedy center pass 2-bump-midfield.path @@ -0,0 +1,70 @@ +{ + "version": "2025.0", + "waypoints": [ + { + "anchor": { + "x": 7.403109843081312, + "y": 2.9287446504992873 + }, + "prevControl": null, + "nextControl": { + "x": 6.872624821682827, + "y": 4.494322396569266 + }, + "isLocked": false, + "linkedName": "greedy center pass 2" + }, + { + "anchor": { + "x": 6.2515691868754075, + "y": 5.904636233944443 + }, + "prevControl": { + "x": 7.196077088227971, + "y": 5.832306433544779 + }, + "nextControl": { + "x": 5.307061285522844, + "y": 5.976966034344108 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 2.8228555555555555, + "y": 6.198266666666666 + }, + "prevControl": { + "x": 4.090813124107933, + "y": 5.231825962903074 + }, + "nextControl": null, + "isLocked": false, + "linkedName": "left midfield" + } + ], + "rotationTargets": [], + "constraintZones": [], + "pointTowardsZones": [], + "eventMarkers": [], + "globalConstraints": { + "maxVelocity": 7.0, + "maxAcceleration": 5.0, + "maxAngularVelocity": 540.0, + "maxAngularAcceleration": 720.0, + "nominalVoltage": 12.0, + "unlimited": false + }, + "goalEndState": { + "velocity": 0, + "rotation": -54.32359177813802 + }, + "reversed": false, + "folder": null, + "idealStartingState": { + "velocity": 0, + "rotation": -90.0 + }, + "useDefaultConstraints": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/paths/greedy left trench - left mid neutral.path b/src/main/deploy/pathplanner/paths/greedy left trench - left mid neutral.path new file mode 100644 index 00000000..658ff293 --- /dev/null +++ b/src/main/deploy/pathplanner/paths/greedy left trench - left mid neutral.path @@ -0,0 +1,70 @@ +{ + "version": "2025.0", + "waypoints": [ + { + "anchor": { + "x": 4.478972895863052, + "y": 7.625477888730385 + }, + "prevControl": null, + "nextControl": { + "x": 5.402326158940398, + "y": 7.577847682119204 + }, + "isLocked": true, + "linkedName": "left trench" + }, + { + "anchor": { + "x": 7.157275320970041, + "y": 7.314950071326677 + }, + "prevControl": { + "x": 6.945825829995666, + "y": 7.44832590409513 + }, + "nextControl": { + "x": 7.790664209858929, + "y": 6.915427849104453 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 8.20530670470756, + "y": 4.2484878744650505 + }, + "prevControl": { + "x": 8.169007035833388, + "y": 5.03256072214717 + }, + "nextControl": null, + "isLocked": false, + "linkedName": "greedy left mid neutral" + } + ], + "rotationTargets": [], + "constraintZones": [], + "pointTowardsZones": [], + "eventMarkers": [], + "globalConstraints": { + "maxVelocity": 7.0, + "maxAcceleration": 5.0, + "maxAngularVelocity": 540.0, + "maxAngularAcceleration": 720.0, + "nominalVoltage": 12.0, + "unlimited": false + }, + "goalEndState": { + "velocity": 0, + "rotation": -70.0 + }, + "reversed": false, + "folder": null, + "idealStartingState": { + "velocity": 0, + "rotation": -90.0 + }, + "useDefaultConstraints": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/paths/greedy midfield-center pass 2.path b/src/main/deploy/pathplanner/paths/greedy midfield-center pass 2.path new file mode 100644 index 00000000..50cef083 --- /dev/null +++ b/src/main/deploy/pathplanner/paths/greedy midfield-center pass 2.path @@ -0,0 +1,89 @@ +{ + "version": "2025.0", + "waypoints": [ + { + "anchor": { + "x": 2.8228555555555555, + "y": 6.198266666666666 + }, + "prevControl": null, + "nextControl": { + "x": 2.2711005886613735, + "y": 6.917000110379524 + }, + "isLocked": false, + "linkedName": "left midfield" + }, + { + "anchor": { + "x": 4.595420827389443, + "y": 7.521968616262482 + }, + "prevControl": { + "x": 3.1361699403833514, + "y": 7.554738139434656 + }, + "nextControl": { + "x": 7.743205921533032, + "y": 7.451280691723889 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 7.403109843081312, + "y": 2.9287446504992873 + }, + "prevControl": { + "x": 7.374070107981974, + "y": 4.743728094207896 + }, + "nextControl": null, + "isLocked": false, + "linkedName": "greedy center pass 2" + } + ], + "rotationTargets": [ + { + "waypointRelativePos": 1.0366886171213492, + "rotationDegrees": 0.0 + } + ], + "constraintZones": [ + { + "name": "Constraints Zone", + "minWaypointRelativePos": 0.0, + "maxWaypointRelativePos": 1.0652801848642368, + "constraints": { + "maxVelocity": 4.0, + "maxAcceleration": 3.0, + "maxAngularVelocity": 540.0, + "maxAngularAcceleration": 720.0, + "nominalVoltage": 12.0, + "unlimited": false + } + } + ], + "pointTowardsZones": [], + "eventMarkers": [], + "globalConstraints": { + "maxVelocity": 7.0, + "maxAcceleration": 5.0, + "maxAngularVelocity": 540.0, + "maxAngularAcceleration": 720.0, + "nominalVoltage": 12.0, + "unlimited": false + }, + "goalEndState": { + "velocity": 0, + "rotation": -90.0 + }, + "reversed": false, + "folder": null, + "idealStartingState": { + "velocity": 0, + "rotation": -54.32359177813802 + }, + "useDefaultConstraints": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/paths/greedy netural zone-left midfield.path b/src/main/deploy/pathplanner/paths/greedy netural zone-left midfield.path new file mode 100644 index 00000000..8567d393 --- /dev/null +++ b/src/main/deploy/pathplanner/paths/greedy netural zone-left midfield.path @@ -0,0 +1,86 @@ +{ + "version": "2025.0", + "waypoints": [ + { + "anchor": { + "x": 8.20530670470756, + "y": 4.2484878744650505 + }, + "prevControl": null, + "nextControl": { + "x": 8.03165852704063, + "y": 5.233295627477259 + }, + "isLocked": false, + "linkedName": "greedy left mid neutral" + }, + { + "anchor": { + "x": 5.082889072852621, + "y": 7.367309602647918 + }, + "prevControl": { + "x": 7.0976264784777765, + "y": 7.353414861919472 + }, + "nextControl": { + "x": 4.030198675501628, + "y": 7.374569536422751 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 2.8228555555555555, + "y": 6.198266666666666 + }, + "prevControl": { + "x": 1.9952231052244298, + "y": 7.294516666666666 + }, + "nextControl": null, + "isLocked": false, + "linkedName": "left midfield" + } + ], + "rotationTargets": [ + { + "waypointRelativePos": 1.3876040703052817, + "rotationDegrees": 0.0 + } + ], + "constraintZones": [], + "pointTowardsZones": [ + { + "fieldPosition": { + "x": 4.75, + "y": 4.0 + }, + "rotationOffset": 0.0, + "minWaypointRelativePos": 1.7974025974026056, + "maxWaypointRelativePos": 2.0, + "name": "Point Towards Zone" + } + ], + "eventMarkers": [], + "globalConstraints": { + "maxVelocity": 3.0, + "maxAcceleration": 3.0, + "maxAngularVelocity": 540.0, + "maxAngularAcceleration": 720.0, + "nominalVoltage": 12.0, + "unlimited": false + }, + "goalEndState": { + "velocity": 0, + "rotation": -54.32359177813802 + }, + "reversed": false, + "folder": null, + "idealStartingState": { + "velocity": 0, + "rotation": -70.0 + }, + "useDefaultConstraints": true +} \ No newline at end of file From 52dce2b39c79fb835644f7ee035e769002eb3626 Mon Sep 17 00:00:00 2001 From: Spderman3333 <118777573+spderman3333@users.noreply.github.com> Date: Sat, 28 Mar 2026 13:47:46 -0700 Subject: [PATCH 11/17] Spotless --- .../java/com/team2813/commands/VariableShooterCommand.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/team2813/commands/VariableShooterCommand.java b/src/main/java/com/team2813/commands/VariableShooterCommand.java index e806eb6f..0f35de2b 100644 --- a/src/main/java/com/team2813/commands/VariableShooterCommand.java +++ b/src/main/java/com/team2813/commands/VariableShooterCommand.java @@ -41,6 +41,7 @@ private static void shootBasedOnDistance(Shooter shooter, Supplier dis public static Command shootBasedOnDistanceCommand( Shooter shooter, Supplier distanceSupplier) { return new RunCommand(() -> shootBasedOnDistance(shooter, distanceSupplier), shooter) - .finallyDo(shooter::stop).withInterruptBehavior(Command.InterruptionBehavior.kCancelIncoming); + .finallyDo(shooter::stop) + .withInterruptBehavior(Command.InterruptionBehavior.kCancelIncoming); } } From b138e0357cb7fa18f62e2cb853fec7422aa2e374 Mon Sep 17 00:00:00 2001 From: Spderman3333 <118777573+spderman3333@users.noreply.github.com> Date: Sat, 28 Mar 2026 14:25:43 -0700 Subject: [PATCH 12/17] Changed drive motors to brake in neutral mode. --- .../java/com/team2813/generated/cartacus/TunerConstants.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/team2813/generated/cartacus/TunerConstants.java b/src/main/java/com/team2813/generated/cartacus/TunerConstants.java index 21a879f0..cf47be8d 100644 --- a/src/main/java/com/team2813/generated/cartacus/TunerConstants.java +++ b/src/main/java/com/team2813/generated/cartacus/TunerConstants.java @@ -60,7 +60,8 @@ public class TunerConstants { // Some configs will be overwritten; check the `with*InitialConfigs()` API documentation. private static final TalonFXConfiguration driveInitialConfigs = new TalonFXConfiguration() - .withCurrentLimits(new CurrentLimitsConfigs().withSupplyCurrentLimit(Amps.of(50))); + .withCurrentLimits(new CurrentLimitsConfigs().withSupplyCurrentLimit(Amps.of(50))) + .withMotorOutput(new MotorOutputConfigs().withNeutralMode(NeutralModeValue.Brake)); private static final TalonFXConfiguration steerInitialConfigs = new TalonFXConfiguration() .withCurrentLimits( From 11f718b43abb5ed29ddc0f9c7ec7e0a069c365d8 Mon Sep 17 00:00:00 2001 From: cuttestkittensrule Date: Sat, 28 Mar 2026 15:05:18 -0700 Subject: [PATCH 13/17] Add command to lock the drivetrain, while supporting full movement capabilities --- .../commands/LockDrivetrainCommand.java | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 src/main/java/com/team2813/commands/LockDrivetrainCommand.java diff --git a/src/main/java/com/team2813/commands/LockDrivetrainCommand.java b/src/main/java/com/team2813/commands/LockDrivetrainCommand.java new file mode 100644 index 00000000..db940a29 --- /dev/null +++ b/src/main/java/com/team2813/commands/LockDrivetrainCommand.java @@ -0,0 +1,72 @@ +package com.team2813.commands; + +import com.team2813.subsystems.drive.Drive; +import com.team2813.util.HubPositionUtil; +import edu.wpi.first.math.MathUtil; +import edu.wpi.first.wpilibj.DriverStation; +import edu.wpi.first.wpilibj2.command.Command; +import java.util.Optional; +import java.util.function.BooleanSupplier; +import java.util.function.DoubleSupplier; + +public class LockDrivetrainCommand extends Command { + private final DoubleSupplier vxSupplier; + private final DoubleSupplier vySupplier; + private final DoubleSupplier omegaSupplier; + private final BooleanSupplier faceHub; + private final Drive drive; + private boolean crossed; + private final Command facingCommand; + private final Command normalCommand; + + public LockDrivetrainCommand( + Drive drive, + DoubleSupplier vxSupplier, + DoubleSupplier vySupplier, + DoubleSupplier omegaSupplier, + BooleanSupplier faceHub, + Optional alliance) { + this.drive = drive; + this.vxSupplier = vxSupplier; + this.vySupplier = vySupplier; + this.omegaSupplier = omegaSupplier; + + this.faceHub = faceHub; + + facingCommand = + DriveCommands.joystickDriveAtAngle( + drive, + vxSupplier, + vySupplier, + () -> HubPositionUtil.getBotToHubAngle(drive.getPose(), alliance)); + + normalCommand = DriveCommands.joystickDrive(drive, vxSupplier, vySupplier, omegaSupplier); + } + + @Override + public void initialize() { + crossed = false; + } + + @Override + public void execute() { + double vx = vxSupplier.getAsDouble(); + double vy = vySupplier.getAsDouble(); + double omega = vxSupplier.getAsDouble(); + + if (MathUtil.isNear(0, vx, 0.1) + || MathUtil.isNear(0, vy, 0.1) + || MathUtil.isNear(0, omega, 0.1)) { + // we have a requested movement + crossed = false; + if (faceHub.getAsBoolean()) { + facingCommand.execute(); + } else { + normalCommand.execute(); + } + } else if (!crossed) { + drive.stopWithX(); + crossed = true; + } + } +} From 1f0484056a6c4b96bcaa31fbc7a486793dfc8daa Mon Sep 17 00:00:00 2001 From: cuttestkittensrule Date: Sat, 28 Mar 2026 15:14:44 -0700 Subject: [PATCH 14/17] Properly handle stopping the shooter in the lock drivetrain command and actually use the lock drivetrain command --- .../java/com/team2813/RobotContainer.java | 14 +++++++++++++- .../commands/LockDrivetrainCommand.java | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/team2813/RobotContainer.java b/src/main/java/com/team2813/RobotContainer.java index bd02e2de..6cf09c35 100644 --- a/src/main/java/com/team2813/RobotContainer.java +++ b/src/main/java/com/team2813/RobotContainer.java @@ -12,6 +12,7 @@ import com.pathplanner.lib.auto.AutoBuilder; import com.pathplanner.lib.auto.NamedCommands; import com.team2813.commands.DriveCommands; +import com.team2813.commands.LockDrivetrainCommand; import com.team2813.commands.VariableShooterCommand; import com.team2813.subsystems.drive.AllTunerConstants; import com.team2813.subsystems.drive.Drive; @@ -249,7 +250,17 @@ private void configureButtonBindings() { // intakeRoller.intakeCommand())); // Defensive Stop. - operatorController.rightBumper().onTrue(new InstantCommand(drive::stopWithX)); + operatorController + .rightBumper() + .whileTrue( + new LockDrivetrainCommand( + drive, + shooter, + () -> -driveController.getLeftY(), + () -> -driveController.getLeftX(), + () -> -driveController.getRightX(), + driveController.a(), + currentAlliance)); // Feeder controls operatorController.leftBumper().whileTrue(hopper.outtakeCommand()); @@ -298,6 +309,7 @@ private void configureButtonBindings() { driveController .a() + .and(operatorController.rightBumper().negate()) // lock drivetrain handles this .whileTrue( DriveCommands.joystickDriveAtAngle( drive, diff --git a/src/main/java/com/team2813/commands/LockDrivetrainCommand.java b/src/main/java/com/team2813/commands/LockDrivetrainCommand.java index db940a29..0d29e72f 100644 --- a/src/main/java/com/team2813/commands/LockDrivetrainCommand.java +++ b/src/main/java/com/team2813/commands/LockDrivetrainCommand.java @@ -1,6 +1,7 @@ package com.team2813.commands; import com.team2813.subsystems.drive.Drive; +import com.team2813.subsystems.shooter.Shooter; import com.team2813.util.HubPositionUtil; import edu.wpi.first.math.MathUtil; import edu.wpi.first.wpilibj.DriverStation; @@ -16,11 +17,14 @@ public class LockDrivetrainCommand extends Command { private final BooleanSupplier faceHub; private final Drive drive; private boolean crossed; + private boolean wasFacingHub = false; private final Command facingCommand; private final Command normalCommand; + private final Command prepareShooter; public LockDrivetrainCommand( Drive drive, + Shooter shooter, DoubleSupplier vxSupplier, DoubleSupplier vySupplier, DoubleSupplier omegaSupplier, @@ -41,11 +45,16 @@ public LockDrivetrainCommand( () -> HubPositionUtil.getBotToHubAngle(drive.getPose(), alliance)); normalCommand = DriveCommands.joystickDrive(drive, vxSupplier, vySupplier, omegaSupplier); + + prepareShooter = + VariableShooterCommand.shootBasedOnDistanceCommand( + shooter, () -> HubPositionUtil.getBotToHubDistance(drive.getPose(), alliance)); } @Override public void initialize() { crossed = false; + wasFacingHub = false; } @Override @@ -61,11 +70,21 @@ public void execute() { crossed = false; if (faceHub.getAsBoolean()) { facingCommand.execute(); + if (wasFacingHub) { + wasFacingHub = false; + prepareShooter.end(true); + } } else { + wasFacingHub = true; normalCommand.execute(); + prepareShooter.execute(); } } else if (!crossed) { drive.stopWithX(); + if (wasFacingHub) { + prepareShooter.end(true); + wasFacingHub = false; + } crossed = true; } } From 3f02d0c4180d8ba94cea65403e819b648430bd67 Mon Sep 17 00:00:00 2001 From: cuttestkittensrule Date: Sat, 28 Mar 2026 15:18:44 -0700 Subject: [PATCH 15/17] End properly --- .../java/com/team2813/commands/LockDrivetrainCommand.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/com/team2813/commands/LockDrivetrainCommand.java b/src/main/java/com/team2813/commands/LockDrivetrainCommand.java index 0d29e72f..fe309f51 100644 --- a/src/main/java/com/team2813/commands/LockDrivetrainCommand.java +++ b/src/main/java/com/team2813/commands/LockDrivetrainCommand.java @@ -88,4 +88,12 @@ public void execute() { crossed = true; } } + + @Override + public void end(boolean interrupted) { + if (wasFacingHub) { + prepareShooter.end(interrupted); + } + drive.stop(); + } } From 68daede7e492a8d1e4d69657358343c3691b37ca Mon Sep 17 00:00:00 2001 From: cuttestkittensrule Date: Sat, 28 Mar 2026 15:35:35 -0700 Subject: [PATCH 16/17] Actually use omegaSupplier --- src/main/java/com/team2813/commands/LockDrivetrainCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/team2813/commands/LockDrivetrainCommand.java b/src/main/java/com/team2813/commands/LockDrivetrainCommand.java index fe309f51..46a3f59b 100644 --- a/src/main/java/com/team2813/commands/LockDrivetrainCommand.java +++ b/src/main/java/com/team2813/commands/LockDrivetrainCommand.java @@ -61,7 +61,7 @@ public void initialize() { public void execute() { double vx = vxSupplier.getAsDouble(); double vy = vySupplier.getAsDouble(); - double omega = vxSupplier.getAsDouble(); + double omega = omegaSupplier.getAsDouble(); if (MathUtil.isNear(0, vx, 0.1) || MathUtil.isNear(0, vy, 0.1) From 1c76a316787a28aece1d062bde3dd6735d246d56 Mon Sep 17 00:00:00 2001 From: cuttestkittensrule Date: Sat, 28 Mar 2026 16:00:38 -0700 Subject: [PATCH 17/17] Make LockDrivetrainCommand depend on the Drive subsystem --- src/main/java/com/team2813/commands/LockDrivetrainCommand.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/team2813/commands/LockDrivetrainCommand.java b/src/main/java/com/team2813/commands/LockDrivetrainCommand.java index 46a3f59b..898fb3f2 100644 --- a/src/main/java/com/team2813/commands/LockDrivetrainCommand.java +++ b/src/main/java/com/team2813/commands/LockDrivetrainCommand.java @@ -49,6 +49,9 @@ public LockDrivetrainCommand( prepareShooter = VariableShooterCommand.shootBasedOnDistanceCommand( shooter, () -> HubPositionUtil.getBotToHubDistance(drive.getPose(), alliance)); + + addRequirements(drive); + // Don't require the shooter, so you can still spool up normally } @Override