Shooter subsystem#8
Conversation
There was a problem hiding this comment.
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.
| } | ||
|
|
||
| public void setFlywheelVelocity(AngularVelocity velocity) { | ||
| flywheelController.setSetpoint(velocity.in(RotationsPerSecond), ControlType.kMAXMotionVelocityControl); |
There was a problem hiding this comment.
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.
| flywheelController.setSetpoint(velocity.in(RotationsPerSecond), ControlType.kMAXMotionVelocityControl); | |
| flywheelController.setSetpoint(velocity.in(RotationsPerSecond), ControlType.kVelocity); |
| hoodConfig.alternateEncoder.positionConversionFactor(1 / ShooterConstants.HERRINGBONE_RATIO) | ||
| .velocityConversionFactor(60 / ShooterConstants.HERRINGBONE_RATIO); |
There was a problem hiding this comment.
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.
| hoodConfig.alternateEncoder.positionConversionFactor(1 / ShooterConstants.HERRINGBONE_RATIO) | |
| .velocityConversionFactor(60 / ShooterConstants.HERRINGBONE_RATIO); |
bbf3450 to
d35ec08
Compare
closes #3