Skip to content

Shooter subsystem#8

Merged
pigrammer3 merged 5 commits into
mainfrom
subsystem/shooter
Feb 24, 2026
Merged

Shooter subsystem#8
pigrammer3 merged 5 commits into
mainfrom
subsystem/shooter

Conversation

@pigrammer3
Copy link
Copy Markdown
Member

closes #3

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements an initial shooter subsystem with velocity PID control for a three-motor flywheel and position PID control for a hood mechanism. The implementation follows the AdvantageKit IO layer pattern established in the codebase for hardware abstraction and logging.

Changes:

  • Added ShooterIO interface defining inputs and control methods for flywheel and hood
  • Added SparkMax hardware implementation with PID and feedforward control for both flywheel and hood
  • Added basic simulation implementation for testing without hardware

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
ShooterIO.java Defines the IO interface with inputs class for flywheel velocity/temperature/current and hood position/velocity
ShooterIOSparkMax.java Hardware implementation configuring 3 flywheel motors (with followers) and 1 hood motor with PID/feedforward control
ShooterIOSimBasic.java Basic simulation using trapezoidal motion profiles for hood and simple velocity model for flywheel
Shooter.java Subsystem class providing logging and command factories for hood angle and combined operation
Constants.java Adds ShooterConstants with motor IDs, gear ratios, PID gains, and physical limits

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/java/frc/robot/subsystems/shooter/Shooter.java
Comment thread src/main/java/frc/robot/subsystems/shooter/ShooterIO.java
Comment thread src/main/java/frc/robot/subsystems/shooter/ShooterIOSparkMax.java Outdated
Comment thread src/main/java/frc/robot/subsystems/shooter/ShooterIOSparkMax.java
Comment thread src/main/java/frc/robot/subsystems/shooter/ShooterIOSparkMax.java Outdated
}

public void setFlywheelVelocity(AngularVelocity velocity) {
flywheelController.setSetpoint(velocity.in(RotationsPerSecond), ControlType.kMAXMotionVelocityControl);
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using kMAXMotionVelocityControl for a flywheel is unusual and likely incorrect. Flywheel velocity control should typically use ControlType.kVelocity instead. MAXMotion velocity control is designed for profiled velocity changes and requires cruise velocity to be set in MAXMotionConfig (which is missing on line 49). For simple flywheel velocity PID control, use ControlType.kVelocity.

Suggested change
flywheelController.setSetpoint(velocity.in(RotationsPerSecond), ControlType.kMAXMotionVelocityControl);
flywheelController.setSetpoint(velocity.in(RotationsPerSecond), ControlType.kVelocity);

Copilot uses AI. Check for mistakes.
Comment on lines +64 to +65
hoodConfig.alternateEncoder.positionConversionFactor(1 / ShooterConstants.HERRINGBONE_RATIO)
.velocityConversionFactor(60 / ShooterConstants.HERRINGBONE_RATIO);
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alternate encoder is configured on lines 64-65 but never retrieved or used. The hood uses the relative encoder (line 73). If this alternate encoder configuration is not needed, consider removing it to avoid confusion. If it's intended for future use with an external encoder, consider adding a comment explaining this.

Suggested change
hoodConfig.alternateEncoder.positionConversionFactor(1 / ShooterConstants.HERRINGBONE_RATIO)
.velocityConversionFactor(60 / ShooterConstants.HERRINGBONE_RATIO);

Copilot uses AI. Check for mistakes.
Comment thread src/main/java/frc/robot/subsystems/shooter/ShooterIOSimBasic.java Outdated
Comment thread src/main/java/frc/robot/subsystems/shooter/ShooterIOSimBasic.java Outdated
Comment thread src/main/java/frc/robot/subsystems/shooter/ShooterIOSimBasic.java Outdated
@pigrammer3 pigrammer3 merged commit 40f1c4e into main Feb 24, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create initial shooter & hood subsystem

3 participants