-
Notifications
You must be signed in to change notification settings - Fork 0
Shooter subsystem #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Introduces a new shooter subsystem, including core classes, simulation IO, and constants. Integrates the shooter into RobotContainer and updates Robot to support periodic output application for all FullSubsystems. Controller bindings are updated to control the shooter velocity.
Replaces the monolithic Shooter subsystem with separate Flywheel and Hood subsystems, including new IO interfaces and implementations. Removes ShooterModel and shooter_data.json in favor of hardcoded interpolation maps in ShotCalculator. Updates RobotContainer and Drive to use the new subsystems and RobotState. Cleans up related constants and code structure.
Replaces the AlignedDrive command with direct integration of shot alignment and shooter parameter calculation in RobotContainer. Updates button bindings for shooter and drive controls, adjusts flywheel speed mappings for simulation, and improves lookahead logic in ShotCalculator. Also fixes field velocity calculation in Drive and sets the default robot type to SIMBOT.
Introduces a ramp mode to the Vision subsystem, allowing vision updates to be paused while crossing a ramp and enabling aggressive correction upon exit. Updates RobotContainer to enable or disable ramp mode based on controller input, and adds logging for ramp mode state.
Switched team number and robot type to 1466/COMPBOT, enabled tuning mode, and updated AprilTag layout for 2026 field. Reworked vision subsystem to remove ramp mode logic and simplify camera configuration. Made drive angle PID constants tunable, updated swerve and shooter parameters, and added manual flywheel control/testing commands. Updated PhotonLib vendordep to v2026.1.1-rc-3.
Set robotToShooter transform translation to zero in ShotCalculator. Increased linear and angular standard deviation baselines in VisionConstants to 0.2 meters and 0.15 radians, respectively, to adjust vision measurement trust.
Adjusted robot dimensions, mass, gearing, and module positions in settings.json for new hardware configuration. Changed Constants to use DEVBOT and disabled tuning mode. Updated drive subsystem to use SwerveSetpointGenerator for improved velocity control. Applied slew rate limiters to joystick inputs in RobotContainer. Increased theoretical free speed in TunerConstants.
…otCode into ShooterSubsystem
Adjusted robot mass, moment of inertia, max drive speed, and current limits in settings.json and Drive.java to reflect new robot specifications. Updated slip current and theoretical free speed in TunerConstants.java for improved accuracy and tuning.
Eliminated the use of SlewRateLimiter for joystick axes in RobotContainer, allowing direct input from the controller. Also performed minor formatting and comment improvements in Vision.java for clarity.
Added 2026 field JSON files for andymark and welded variants, including official and none layouts. Updated FieldConstants to use new AprilTag layouts, expanded field geometry and element definitions, and improved documentation. Updated ShotCalculator and copyright headers to match new team and repository. Changed default robot type to SIMBOT in Constants.
Introduces the DriveToPose command for driving to a specific pose with tunable parameters. Refactors the flywheel subsystem to support voltage and velocity control modes, adds SysId routines, and updates simulation and TalonFX IO to handle the new control modes. Updates Hood subsystem copyright, logging, and tunable parameters.
Added an internal Bang-Bang control mode to the flywheel subsystem, including logic for toggling between velocity and Bang-Bang modes, shot counting, and debounced at-goal detection. Updated FlywheelIO, FlywheelIOSim, and FlywheelIOTalonFX to support the new control mode. Also updated copyright headers and moved AprilTag JSON files to a new directory.
Refactored flywheel and hood subsystems to improve brake/coast handling and goal management. Added HoodIOSim and HoodIOTalonFX implementations for simulation and hardware support. Updated FlywheelIO and HoodIO interfaces to support brake mode and open/closed loop control. Cleaned up RobotContainer to use new HoodIO implementations and removed unused zeroing logic.
Reformats code for improved readability in several files. Adds dynamic updating of angle controller PID and constraints in DriveCommands when tuning parameters change, allowing for real-time adjustments without redeployment.
Introduced the Choreographer class to coordinate drive, flywheel, and hood subsystems via a high-level state machine. Updated RobotContainer to use Choreographer for goal management and target heading, replacing direct shooter commands. Adjusted flywheel and hood control logic for simulation and real modes, updated hood angle limits, and made related changes to ShotCalculator and HoodIOSim for consistency.
Introduces a LoggedNetworkBoolean for 'CoastOverride' in RobotContainer and passes it to Choreographer. Choreographer now supports setting a coast override for both flywheel and hood subsystems, allowing runtime control via network tables.
Tuning mode is now enabled in Constants. The hood simulation uses DCMotorSim with updated moment of inertia for more responsive behavior, and position clamping is added. ShotCalculator includes a new hood angle mapping. Flywheel follower logic is updated to use the new Follower class with MotorAlignmentValue.Opposed. Minor formatting and cleanup applied in RobotContainer and Flywheel.
…otCode into ShooterSubsystem
Updated the HoodIOSim simulation to use SingleJointedArmSim instead of DCMotorSim. Adjusted method calls to match the new simulation class, improving simulation accuracy for the hood subsystem.
- Add PID controllers (x, y, heading) to Drive subsystem - Add followTrajectory(SwerveSample) method for Choreo integration - Create Autos class with AutoFactory for managing Choreo routines - Add depot auto routine using existing depotAuto.chor trajectory - Integrate Choreo autos into RobotContainer auto chooser - Maintain compatibility with existing PathPlanner autos
- Replace manual .schedule() with RobotModeTriggers.teleop().whileTrue() for debug logger - Replace toggle flywheel logic with Commands.either() for cleaner command composition - Fixes all deprecation warnings for WPILib 2026
Renamed trajectory and choreo files to new deploy path. Updated robot mass, moment of inertia, wheel coefficient of friction, gearing, and module positions in depotAuto.chor, TunerConstants.java, and Drive.java to match latest robot configuration. Cleaned up comments and improved consistency with physical robot measurements.
Replaced references to fieldLengthMeters and fieldWidthMeters in Constants with fieldLength and fieldWidth from FieldConstants in AllianceFlipUtil. This improves code organization by centralizing field dimension constants.
Remove obsolete DepotAuto.traj and add NewPath.traj; apply edits to OutputAuto.traj. Update pathplanner assets (Center to Climb.path) and pathplanner settings.json. Regenerate frc/robot/generated/TunerConstants.java to reflect updated tuning values.
Introduce Spindexer and Kicker subsystems (IO, TalonFX, and sim implementations) and wire them into the robot. RobotContainer now constructs these subsystems for real/sim/dev modes and passes them to Choreographer. Choreographer was refactored to manage spindexer/kicker lifecycle (stop/run, stall/reverse logic, shooting state) and to use tunable drive-alignment thresholds and additional logging. ShotCalculator gains a "use defaults" mode with tunable default flywheel/hood values and a controller Y-button toggle to flip that mode; some old filtering/velocity fields were removed. Hood max angle reduced from 32.0 to 31.0. Add HubShiftUtil for timed hub-shifting logic and initialize it on teleop/autonomous start. Overall changes add ball-handling hardware support, simulation models, logging, and small tuning/refactor improvements.
Add choreo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Introduces a new shooter “superstructure” (flywheel + hood + spindexer + kicker) coordinated by a Choreographer, adds a pose-based ShotCalculator, and integrates Choreo trajectory following / updated field constants and AprilTag layouts.
Changes:
- Adds new shooter subsystems (Flywheel, Hood, Spindexer, Kicker) plus
Choreographerstate machine andShotCalculator. - Adds Choreo support (vendordep + autos + trajectory follower) and updates drive/pathplanner configuration and field constants/layout assets.
- Refactors various utilities (e.g.,
FullSubsystem,RobotState, new transform helpers) and updates CI workflow.
Reviewed changes
Copilot reviewed 49 out of 51 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| vendordeps/photonlib.json | Bumps PhotonLib vendordep version. |
| vendordeps/ChoreoLib2026.json | Adds ChoreoLib vendordep for 2026. |
| src/main/java/frc/robot/util/ShooterModel.java | Removes old JSON/spline-based shooter model utility. |
| src/main/java/frc/robot/util/HubShiftUtil.java | Adds hub shift timing/schedule utility. |
| src/main/java/frc/robot/util/GeomUtil.java | Adds Transform3d→Transform2d conversion; removes withCoords. |
| src/main/java/frc/robot/util/FullSubsystem.java | Adds “after scheduler” periodic hook + global runner. |
| src/main/java/frc/robot/util/AllianceFlipUtil.java | Switches field dimensions source to FieldConstants. |
| src/main/java/frc/robot/subsystems/vision/VisionConstants.java | Reworks vision constants + AprilTag layout loading and camera transforms. |
| src/main/java/frc/robot/subsystems/vision/Vision.java | Adds ramp mode gating + aggressive correction behavior and logging. |
| src/main/java/frc/robot/subsystems/spindexer/SpindexerIOTalonFX.java | Adds TalonFX IO impl for spindexer. |
| src/main/java/frc/robot/subsystems/spindexer/SpindexerIOSim.java | Adds sim IO impl for spindexer. |
| src/main/java/frc/robot/subsystems/spindexer/SpindexerIO.java | Adds AdvantageKit IO interface for spindexer. |
| src/main/java/frc/robot/subsystems/spindexer/Spindexer.java | Adds spindexer subsystem w/ stall detect + auto-reverse. |
| src/main/java/frc/robot/subsystems/shooter/hood/HoodIOTalonFX.java | Adds TalonFX + CANcoder hood IO impl. |
| src/main/java/frc/robot/subsystems/shooter/hood/HoodIOSim.java | Adds hood sim IO impl. |
| src/main/java/frc/robot/subsystems/shooter/hood/HoodIO.java | Adds AdvantageKit IO interface for hood. |
| src/main/java/frc/robot/subsystems/shooter/hood/Hood.java | Adds hood subsystem logic and goal control. |
| src/main/java/frc/robot/subsystems/shooter/flywheel/FlywheelIOTalonFX.java | Adds TalonFX flywheel IO impl (leader/follower). |
| src/main/java/frc/robot/subsystems/shooter/flywheel/FlywheelIOSim.java | Adds flywheel sim IO impl. |
| src/main/java/frc/robot/subsystems/shooter/flywheel/FlywheelIO.java | Adds AdvantageKit IO interface for flywheel. |
| src/main/java/frc/robot/subsystems/shooter/flywheel/Flywheel.java | Adds flywheel control (velocity/voltage/bang-bang) + sysid. |
| src/main/java/frc/robot/subsystems/shooter/ShotCalculator.java | Adds pose-based shooting parameter calculation and caching. |
| src/main/java/frc/robot/subsystems/kicker/KickerIOTalonFX.java | Adds TalonFX IO impl for kicker. |
| src/main/java/frc/robot/subsystems/kicker/KickerIOSim.java | Adds sim IO impl for kicker. |
| src/main/java/frc/robot/subsystems/kicker/KickerIO.java | Adds AdvantageKit IO interface for kicker. |
| src/main/java/frc/robot/subsystems/kicker/Kicker.java | Adds kicker subsystem logic. |
| src/main/java/frc/robot/subsystems/drive/Drive.java | Adds Choreo sample following + PP setpoint generation + RobotState updates. |
| src/main/java/frc/robot/subsystems/Choreographer.java | Adds superstructure state machine coordinating shooter subsystems. |
| src/main/java/frc/robot/generated/TunerConstants.java | Updates swerve config constants (gains, module positions, etc.). |
| src/main/java/frc/robot/commands/DriveToPose.java | Adds command to drive to a pose using profiled/PID control. |
| src/main/java/frc/robot/commands/DriveCommands.java | Makes angle PID params tunable via LoggedTunableNumber. |
| src/main/java/frc/robot/commands/AlignedDrive.java | Removes old aligned-drive command factory. |
| src/main/java/frc/robot/RobotState.java | Adds singleton for estimated pose + field velocity. |
| src/main/java/frc/robot/RobotContainer.java | Wires in new subsystems, choreographer controls, ramp mode triggers, choreo auto option. |
| src/main/java/frc/robot/Robot.java | Clears shot params each loop; runs FullSubsystem after-scheduler periodic; adds hardware-alert gating. |
| src/main/java/frc/robot/FieldConstants.java | Adds field geometry + AprilTag layout loading helpers and constants. |
| src/main/java/frc/robot/Constants.java | Changes default robot/tuning config (and removes old field dimensions). |
| src/main/java/frc/robot/Autos.java | Adds Choreo AutoFactory routine scaffolding and depot auto routine. |
| src/main/deploy/shooterData/shooter_data.json | Removes old shooter lookup table JSON. |
| src/main/deploy/pathplanner/settings.json | Updates robot dimensions and physical parameters for PathPlanner. |
| src/main/deploy/choreo/depotAuto.chor | Adds Choreo project file for depot auto. |
| src/main/deploy/choreo/OutputAuto.traj | Adds Choreo-generated trajectory. |
| src/main/deploy/apriltags/welded/2026-official.json | Adds welded field AprilTag layout JSON. |
| src/main/deploy/apriltags/welded/2026-none.json | Adds empty welded layout JSON. |
| src/main/deploy/apriltags/andymark/2026-official.json | Adds andymark field AprilTag layout JSON. |
| src/main/deploy/apriltags/andymark/2026-none.json | Adds empty andymark layout JSON. |
| src/main/deploy/apriltagLayout/2026-rebuilt-welded.json | Adds rebuilt welded layout JSON used by vision constants. |
| .wpilib/wpilib_preferences.json | Updates WPILib team number. |
| .vscode/settings.json | Increases Java language server max heap. |
| .github/workflows/build.yml | Updates CI to include Spotless check, caching, and renames workflow/job. |
| .github/copilot-instructions.md | Adds repo-specific Copilot instructions/documentation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // TODO: Move CAN ID into constants. | ||
| private static final int motorId = 15; | ||
|
|
||
| private final TalonFX talon; |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
motorId is hard-coded to 15 here, but this CAN ID is also used by HoodIOTalonFX (TalonFX id 15) in the same PR. This will cause a CAN ID conflict at runtime. Assign unique IDs and centralize them in constants as the TODO suggests.
| public HoodIOTalonFX() { | ||
| talon = new TalonFX(15); | ||
| cancoder = new CANcoder(15); | ||
|
|
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both the TalonFX and CANcoder are constructed with device ID 15, and ID 15 is also used by SpindexerIOTalonFX in this PR. CAN IDs must be unique per device, so this will create conflicts on the CAN bus. Use distinct IDs for the hood motor and hood encoder, and ensure they don’t overlap with other subsystems.
| @Override | ||
| public void periodicAfterScheduler() { | ||
| if (DriverStation.isEnabled()) { | ||
| double clampedGoalDeg = MathUtil.clamp(goalAngleDeg, minAngleDeg, maxAngleDeg); | ||
| outputs.positionRad = Units.degreesToRadians(clampedGoalDeg); | ||
| outputs.mode = HoodIOOutputMode.CLOSED_LOOP; | ||
| outputs.volts = 0.0; | ||
|
|
||
| // Log state | ||
| Logger.recordOutput("Hood/Profile/GoalPositionDeg", clampedGoalDeg); | ||
| } else { | ||
| outputs.mode = HoodIOOutputMode.OPEN_LOOP; | ||
| outputs.volts = 0.0; | ||
| } | ||
|
|
||
| io.applyOutputs(outputs); | ||
| } |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
runVolts() sets outputs.mode = OPEN_LOOP, but periodicAfterScheduler() overwrites outputs.mode back to CLOSED_LOOP whenever the robot is enabled. As a result, the open-loop command won’t actually take effect while enabled. Consider honoring the current outputs.mode (as set by commands) and only forcing OPEN_LOOP when disabled, or gating the closed-loop assignment when outputs.mode is already OPEN_LOOP.
| public static class HoodIOInputs { | ||
| boolean motorConnected = false; | ||
| double positionRads = 0.0; | ||
| double velocityRadsPerSec = 0.0; | ||
| double appliedVolts = 0.0; | ||
| double supplyCurrentAmps = 0.0; | ||
| double torqueCurrentAmps = 0.0; | ||
| double tempCelsius = 0.0; | ||
| } |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HoodIOInputs fields are package-private, while other *IOInputs classes in this PR use public fields. Keeping these consistent avoids surprises for logging/telemetry and matches the established IO pattern. Consider making these fields public like the other inputs classes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot open a new pull request to apply changes based on this feedback
| new VisionIOPhotonVision(camera0Name, robotToCamera0)); | ||
|
|
||
| flywheel = new Flywheel(new FlywheelIOTalonFX()); | ||
| hood = new Hood(new HoodIO() {}); | ||
| spindexer = new Spindexer(new SpindexerIOTalonFX()); | ||
| kicker = new Kicker(new KickerIOTalonFX()); |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the COMPBOT configuration, hood is instantiated with a no-op new HoodIO() {} even though a real HoodIOTalonFX implementation is added in this PR. This means the hood will not actuate on the comp robot as wired here. If the hood hardware is intended to be active, wire in new HoodIOTalonFX() (or the appropriate real IO).
| private static Alliance getFirstActiveAlliance() { | ||
| String message = DriverStation.getGameSpecificMessage(); | ||
| if (message.length() > 0) { | ||
| char character = message.charAt(0); | ||
| if (character == 'R') { | ||
| return Alliance.Blue; | ||
| } else if (character == 'B') { | ||
| return Alliance.Red; | ||
| } | ||
| } | ||
| return DriverStation.getAlliance().orElse(Alliance.Blue) == Alliance.Blue | ||
| ? Alliance.Red | ||
| : Alliance.Blue; |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getFirstActiveAlliance() appears to swap alliances ('R' returns Alliance.Blue and 'B' returns Alliance.Red). If the game-specific message uses the intuitive encoding (R=Red, B=Blue), this will invert the schedule selection. Verify the encoding and correct the mapping (and/or add a clarifying comment with the spec).
| static { | ||
| try { | ||
| aprilTagLayout = | ||
| new AprilTagFieldLayout("/home/lvuser/deploy/apriltagLayout/2026-rebuilt-welded.json"); | ||
| } catch (Exception e) { | ||
| throw new RuntimeException("Failed to load AprilTag layout", e); | ||
| } |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AprilTag layout is loaded from a hard-coded roboRIO path (/home/lvuser/deploy/...). This will break on desktop sim/replay and makes the code less portable. Prefer resolving via Filesystem.getDeployDirectory() (as done elsewhere in the repo) and constructing a Path to the JSON.
| layout = new AprilTagFieldLayout(p); | ||
| layoutString = new ObjectMapper().writeValueAsString(layout); |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential race condition. This assignment to layout is visible to other threads before the subsequent statements are executed.
| layout = new AprilTagFieldLayout(p); | |
| layoutString = new ObjectMapper().writeValueAsString(layout); | |
| AprilTagFieldLayout newLayout = new AprilTagFieldLayout(p); | |
| String newLayoutString = new ObjectMapper().writeValueAsString(newLayout); | |
| layoutString = newLayoutString; | |
| layout = newLayout; |
| this.io = io; | ||
| } | ||
|
|
||
| public void periodic() { |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method overrides Subsystem.periodic; it is advisable to add an Override annotation.
| return atGoal; | ||
| } | ||
|
|
||
| public void periodic() { |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method overrides Subsystem.periodic; it is advisable to add an Override annotation.
|
@GrumpyBud I've opened a new pull request, #7, to work on those changes. Once the pull request is ready, I'll request review from you. |
|
@GrumpyBud I've opened a new pull request, #8, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: GrumpyBud <[email protected]>
Co-authored-by: GrumpyBud <[email protected]>
Fix Constants.java to satisfy PR gate requirements
Make HoodIOInputs fields public to match IO pattern
No description provided.