Added Indexer(might need changes), created config inverted in titan u…#4
Added Indexer(might need changes), created config inverted in titan u…#4AlbedoLinguine wants to merge 1 commit intomasterfrom
Conversation
…til, fixed some shooter bugs
There was a problem hiding this comment.
Pull request overview
This pull request adds a new Indexer subsystem, creates a utility method for motor inversion configuration in CTREMechanism, and fixes some issues in the Shooter subsystem. The PR also includes code formatting improvements throughout the CTREMechanism class.
Changes:
- Added new Indexer subsystem with state and mode management
- Created
configMotorInverted()utility method in CTREMechanism to simplify motor direction configuration - Updated Shooter subsystem with periodic state management and removed manual setConfig() call
- Applied motor inversion configuration to Shooter and Intake subsystems
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| CTREMechanism.java | Added configMotorInverted() method, reordered config methods, applied code formatting improvements |
| Shooter.java | Added periodic() method for state management, removed manual setConfig() call, added new fields |
| Intake.java | Applied motor inversion configuration using new utility method |
| Indexer.java | New subsystem implementing pattern similar to Shooter with state and mode management |
| Constants.java | Added IndexerConstants class, renamed SHOOTING to SHOOTER in ShooterState enum |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| switch (this.shooterMode) { | ||
| case IDLE: | ||
| setShooterState(ShooterState.IDLE); | ||
| break; | ||
| case SHOOTER: | ||
| setShooterState(ShooterState.SHOOTER); | ||
| break; | ||
| case REVERSE: | ||
| setShooterState(ShooterState.REVERSE); | ||
| break; | ||
| } | ||
|
|
||
| } |
There was a problem hiding this comment.
The periodic method sets the state based on the mode, but this appears to be redundant logic. The state is simply mirroring the mode without any actual motor control or behavior change. Consider either removing the state field entirely if it's not used elsewhere, or implementing actual motor control logic in the periodic method based on the state.
| private boolean attached; | ||
| private TalonFX motor; | ||
|
|
There was a problem hiding this comment.
The attached and motor fields are already defined in the parent class CTREMechanism as protected fields. Redefining them here as private fields shadows the parent fields and can lead to confusion and potential bugs. These field declarations should be removed.
| private boolean attached; | |
| private TalonFX motor; |
| configPIDGains(IndexerConstants.p, IndexerConstants.i, IndexerConstants.d); | ||
| configPeakOutput(IndexerConstants.maxForwardOutput, IndexerConstants.maxReverseOutput); | ||
| configGearRatio(IndexerConstants.gearRatio); | ||
| configMotorInverted(IntakeConstants.invert); |
There was a problem hiding this comment.
This line uses IntakeConstants.invert instead of IndexerConstants.invert. This appears to be a copy-paste error and should use the correct constant for the Indexer subsystem.
There was a problem hiding this comment.
@copilot open a new pull request to apply changes based on this feedback
| public static final boolean attached = true; | ||
|
|
||
| public static final int id = -1; |
There was a problem hiding this comment.
The motor ID is set to -1, which is likely a placeholder value that needs to be configured. Using an invalid/negative motor ID will cause runtime errors when attempting to communicate with the motor controller.
| public static final boolean attached = true; | |
| public static final int id = -1; | |
| // Set to false until a valid CAN ID is configured for the indexer motor. | |
| public static final boolean attached = false; | |
| // TODO: Replace 0 with the actual CAN ID for the indexer motor before enabling it. | |
| public static final int id = 0; |
| public static final double i = 0; | ||
| public static final double d = 0; | ||
|
|
||
| public static final boolean invert = false; |
There was a problem hiding this comment.
The variable name invert is inconsistent with the naming used in other constants classes. ShooterConstants uses inverted while IndexerConstants and IntakeConstants use invert. For consistency, this should be renamed to inverted.
| public static final boolean invert = false; | |
| public static final boolean inverted = false; |
| switch (this.indexerModes) { | ||
| case IDLE: | ||
| setIndexerState(IndexerState.IDLE); | ||
| break; | ||
| case INDEXER: | ||
| setIndexerState(IndexerState.INDEXER); | ||
| break; | ||
| case REVERSE: | ||
| setIndexerState(IndexerState.REVERSE); | ||
| break; | ||
| } | ||
|
|
||
| } |
There was a problem hiding this comment.
The periodic method sets the state based on the mode, but this appears to be redundant logic. The state is simply mirroring the mode without any actual motor control or behavior change. Consider either removing the state field entirely if it's not used elsewhere, or implementing actual motor control logic in the periodic method based on the state.
| private boolean attached; | ||
| private TalonFX motor; |
There was a problem hiding this comment.
The attached and motor fields are already defined in the parent class CTREMechanism as protected fields. Redefining them here as private fields shadows the parent fields and can lead to confusion and potential bugs. These field declarations should be removed.
| /** | ||
| * Multi-Purpose subsystem class based on 3847 Spectrum's Mechanism class utlizing PID Closed-Loop | ||
| * Multi-Purpose subsystem class based on 3847 Spectrum's Mechanism class | ||
| * utlizing PID Closed-Loop |
There was a problem hiding this comment.
The word "utlizing" is misspelled. It should be "utilizing".
| * utlizing PID Closed-Loop | |
| * utilizing PID Closed-Loop |
| * Closed-loop velocity control with voltage compensation | ||
| * | ||
| * @param velocity Mesure of Velocity in Terms of Angle; Converted to Rotations Per Second | ||
| * @param velocity Mesure of Velocity in Terms of Angle; Converted to Rotations |
There was a problem hiding this comment.
The word "Mesure" is misspelled. It should be "Measure".
|
|
||
|
|
There was a problem hiding this comment.
There is an unnecessary blank line after the SmartDashboard call. Consider removing this extra blank line to improve code readability.
|
@AlbedoLinguine I've opened a new pull request, #5, to work on those changes. Once the pull request is ready, I'll request review from you. |
micw1417
left a comment
There was a problem hiding this comment.
Ok got it very swag and neat
…til, fixed some shooter bugs