Skip to content

Added Indexer(might need changes), created config inverted in titan u…#4

Closed
AlbedoLinguine wants to merge 1 commit intomasterfrom
Yogev
Closed

Added Indexer(might need changes), created config inverted in titan u…#4
AlbedoLinguine wants to merge 1 commit intomasterfrom
Yogev

Conversation

@AlbedoLinguine
Copy link
Contributor

…til, fixed some shooter bugs

Copy link
Contributor

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 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.

Comment on lines +54 to +66
switch (this.shooterMode) {
case IDLE:
setShooterState(ShooterState.IDLE);
break;
case SHOOTER:
setShooterState(ShooterState.SHOOTER);
break;
case REVERSE:
setShooterState(ShooterState.REVERSE);
break;
}

}
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment on lines +22 to +24
private boolean attached;
private TalonFX motor;

Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
private boolean attached;
private TalonFX motor;

Copilot uses AI. Check for mistakes.
configPIDGains(IndexerConstants.p, IndexerConstants.i, IndexerConstants.d);
configPeakOutput(IndexerConstants.maxForwardOutput, IndexerConstants.maxReverseOutput);
configGearRatio(IndexerConstants.gearRatio);
configMotorInverted(IntakeConstants.invert);
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

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

Comment on lines +89 to +91
public static final boolean attached = true;

public static final int id = -1;
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
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;

Copilot uses AI. Check for mistakes.
public static final double i = 0;
public static final double d = 0;

public static final boolean invert = false;
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
public static final boolean invert = false;
public static final boolean inverted = false;

Copilot uses AI. Check for mistakes.
Comment on lines +56 to +68
switch (this.indexerModes) {
case IDLE:
setIndexerState(IndexerState.IDLE);
break;
case INDEXER:
setIndexerState(IndexerState.INDEXER);
break;
case REVERSE:
setIndexerState(IndexerState.REVERSE);
break;
}

}
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment on lines +20 to +21
private boolean attached;
private TalonFX motor;
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
/**
* 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
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

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

The word "utlizing" is misspelled. It should be "utilizing".

Suggested change
* utlizing PID Closed-Loop
* utilizing PID Closed-Loop

Copilot uses AI. Check for mistakes.
* 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
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

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

The word "Mesure" is misspelled. It should be "Measure".

Copilot uses AI. Check for mistakes.
Comment on lines +52 to +53


Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

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

There is an unnecessary blank line after the SmartDashboard call. Consider removing this extra blank line to improve code readability.

Suggested change

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Copilot AI commented Jan 17, 2026

@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.

Copy link
Contributor

@micw1417 micw1417 left a comment

Choose a reason for hiding this comment

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

Ok got it very swag and neat

@micw1417 micw1417 closed this Jan 22, 2026
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.

3 participants