From 77ca57d678c0a2e4455911d20d3b137881bcd0f9 Mon Sep 17 00:00:00 2001 From: Shikhar Date: Sat, 21 Feb 2026 15:55:29 -0700 Subject: [PATCH] Autos --- .../pathplanner/autos/Quick Shoot test.auto | 31 +++++++ .../deploy/pathplanner/paths/Quick Shoot.path | 81 +++++++++++++++++++ .../java/frc4388/robot/RobotContainer.java | 19 +++++ .../robot/constants/BuildConstants.java | 10 +-- .../frc4388/robot/constants/Constants.java | 3 +- .../java/frc4388/robot/subsystems/LED.java | 2 +- .../robot/subsystems/shooter/Shooter.java | 5 +- 7 files changed, 143 insertions(+), 8 deletions(-) create mode 100644 src/main/deploy/pathplanner/autos/Quick Shoot test.auto create mode 100644 src/main/deploy/pathplanner/paths/Quick Shoot.path diff --git a/src/main/deploy/pathplanner/autos/Quick Shoot test.auto b/src/main/deploy/pathplanner/autos/Quick Shoot test.auto new file mode 100644 index 0000000..1828ee3 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/Quick Shoot test.auto @@ -0,0 +1,31 @@ +{ + "version": "2025.0", + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "Robot Intake Down" + } + }, + { + "type": "path", + "data": { + "pathName": "Quick Shoot" + } + }, + { + "type": "named", + "data": { + "name": "Robot Shoot" + } + } + ] + } + }, + "resetOdom": true, + "folder": null, + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/paths/Quick Shoot.path b/src/main/deploy/pathplanner/paths/Quick Shoot.path new file mode 100644 index 0000000..69333b6 --- /dev/null +++ b/src/main/deploy/pathplanner/paths/Quick Shoot.path @@ -0,0 +1,81 @@ +{ + "version": "2025.0", + "waypoints": [ + { + "anchor": { + "x": 3.48951566951567, + "y": 5.107378917378918 + }, + "prevControl": null, + "nextControl": { + "x": 2.908105413105413, + "y": 6.205598290598291 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 1.616082621082621, + "y": 5.107378917378918 + }, + "prevControl": { + "x": 0.44392059766331804, + "y": 6.342550994319343 + }, + "nextControl": { + "x": 2.234130952380953, + "y": 4.456107142857142 + }, + "isLocked": false, + "linkedName": null + }, + { + "anchor": { + "x": 2.8064047619047625, + "y": 3.8622380952380952 + }, + "prevControl": { + "x": 2.8172023809523816, + "y": 4.132178571428572 + }, + "nextControl": null, + "isLocked": false, + "linkedName": null + } + ], + "rotationTargets": [], + "constraintZones": [], + "pointTowardsZones": [ + { + "fieldPosition": { + "x": 4.612, + "y": 4.0213534 + }, + "rotationOffset": 0.0, + "minWaypointRelativePos": 0.9140287769784197, + "maxWaypointRelativePos": 2, + "name": "Point Towards Zone" + } + ], + "eventMarkers": [], + "globalConstraints": { + "maxVelocity": 0.5, + "maxAcceleration": 3.0, + "maxAngularVelocity": 540.0, + "maxAngularAcceleration": 720.0, + "nominalVoltage": 12.0, + "unlimited": false + }, + "goalEndState": { + "velocity": 0, + "rotation": -1.591140271194531 + }, + "reversed": false, + "folder": null, + "idealStartingState": { + "velocity": 0, + "rotation": 178.40885972880554 + }, + "useDefaultConstraints": false +} \ No newline at end of file diff --git a/src/main/java/frc4388/robot/RobotContainer.java b/src/main/java/frc4388/robot/RobotContainer.java index 2604350..cd4ec83 100644 --- a/src/main/java/frc4388/robot/RobotContainer.java +++ b/src/main/java/frc4388/robot/RobotContainer.java @@ -9,6 +9,7 @@ package frc4388.robot; import java.io.File; +import com.pathplanner.lib.auto.NamedCommands; import com.pathplanner.lib.commands.PathPlannerAuto; import com.pathplanner.lib.trajectory.PathPlannerTrajectory; @@ -25,6 +26,7 @@ import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.InstantCommand; import edu.wpi.first.wpilibj2.command.RunCommand; import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; +import edu.wpi.first.wpilibj2.command.WaitCommand; import edu.wpi.first.wpilibj2.command.button.JoystickButton; import edu.wpi.first.wpilibj2.command.button.Trigger; import frc4388.robot.commands.MoveForTimeCommand; @@ -91,6 +93,20 @@ public class RobotContainer { private SendableChooser autoChooser; private Command autoCommand; + + private Command RobotIntakeDown = new SequentialCommandGroup( + new InstantCommand(() -> m_robotIntake.setMode(IntakeMode.Extended)) + ); + + private Command RobotShoot = new SequentialCommandGroup( + new InstantCommand(() -> m_robotShooter.setShooterReady()), + new InstantCommand(()->m_robotIntake.setMode(IntakeMode.Idle)), + new WaitCommand(5), + new InstantCommand(()->m_robotShooter.setShooterShoot()), + new WaitCommand(10), + new InstantCommand(()->m_robotShooter.setShooterNOTShoot()) + ); + // private Command RobotShoot = new SequentialCommandGroup( // new InstantCommand(() -> System.out.println(m_robotLED.getMode())), // new InstantCommand(() -> m_robotLED.setMode(LEDPatterns.PARTY_TWINKLES), m_robotLED), @@ -126,6 +142,9 @@ public class RobotContainer { m_robotShooter.io.updateGains(); }, true); + NamedCommands.registerCommand("Robot Shoot", RobotShoot); + NamedCommands.registerCommand("Robot Intake Down", RobotIntakeDown); + DriverStation.silenceJoystickConnectionWarning(true); diff --git a/src/main/java/frc4388/robot/constants/BuildConstants.java b/src/main/java/frc4388/robot/constants/BuildConstants.java index a85bcb5..ebec1b4 100644 --- a/src/main/java/frc4388/robot/constants/BuildConstants.java +++ b/src/main/java/frc4388/robot/constants/BuildConstants.java @@ -7,12 +7,12 @@ public final class BuildConstants { public static final String MAVEN_GROUP = ""; public static final String MAVEN_NAME = "2026KPopRobotHunters"; public static final String VERSION = "unspecified"; - public static final int GIT_REVISION = 72; - public static final String GIT_SHA = "9c7159ba3b2fd669f9781f1315cb481b7a1b8d57"; - public static final String GIT_DATE = "2026-02-20 21:59:06 MST"; + public static final int GIT_REVISION = 75; + public static final String GIT_SHA = "4907e0c8a0fc7dade91b2075d70a2b38213f9cab"; + public static final String GIT_DATE = "2026-02-21 15:08:32 MST"; public static final String GIT_BRANCH = "operator-controls"; - public static final String BUILD_DATE = "2026-02-21 13:54:02 MST"; - public static final long BUILD_UNIX_TIME = 1771707242280L; + public static final String BUILD_DATE = "2026-02-21 15:52:02 MST"; + public static final long BUILD_UNIX_TIME = 1771714322479L; public static final int DIRTY = 1; private BuildConstants(){} diff --git a/src/main/java/frc4388/robot/constants/Constants.java b/src/main/java/frc4388/robot/constants/Constants.java index 2231807..12b87b6 100644 --- a/src/main/java/frc4388/robot/constants/Constants.java +++ b/src/main/java/frc4388/robot/constants/Constants.java @@ -99,13 +99,14 @@ public final class Constants { public static final class LEDConstants { public static final int LED_SPARK_ID = 9; - public static final LEDPatterns DEFAULT_PATTERN = LEDPatterns.FOREST_TWINKLES; + public static final LEDPatterns DEFAULT_PATTERN = LEDPatterns.FOREST_RAINBOW; // LED color for when the intake is out public static final LEDPatterns INTAKE_OUT = LEDPatterns.SOLID_RED; // LED color for when the intake is out, but the driver conditions are bad public static final LEDPatterns INTAKE_OUT_BADPHYS = LEDPatterns.RED_STROBE; + // LED color for when the flywheel speed isn't in tolarance public static final LEDPatterns BAD_FLYWEEL = LEDPatterns.SOLID_GOLD; // LED color for when the flywheel speed isn't in tolarance, but the driver conditions are bad diff --git a/src/main/java/frc4388/robot/subsystems/LED.java b/src/main/java/frc4388/robot/subsystems/LED.java index 28e1dcf..58a4591 100644 --- a/src/main/java/frc4388/robot/subsystems/LED.java +++ b/src/main/java/frc4388/robot/subsystems/LED.java @@ -36,7 +36,7 @@ public class LED extends SubsystemBase implements Queryable { m_pwm.setPeriodMultiplier(PWM.PeriodMultiplier.k1X); m_pwm.setSpeed(0.0); m_pwm.setZeroLatch(); - + update(); } private LEDPatterns mode = LEDConstants.DEFAULT_PATTERN; diff --git a/src/main/java/frc4388/robot/subsystems/shooter/Shooter.java b/src/main/java/frc4388/robot/subsystems/shooter/Shooter.java index 8e1c255..90c594a 100644 --- a/src/main/java/frc4388/robot/subsystems/shooter/Shooter.java +++ b/src/main/java/frc4388/robot/subsystems/shooter/Shooter.java @@ -158,7 +158,10 @@ public class Shooter extends SubsystemBase { ShooterMode.Ready ); - } + } else { + m_robotLED.setMode(Constants.LEDConstants.DEFAULT_PATTERN); + + }