Conversation
…706-Robot-Code into shooter-develop-2
…706-Robot-Code into shooter-develop-2
…706-Robot-Code into shooter-develop-2
…706-Robot-Code into shooter-develop-2
…r variable,s will replace wiht acutal values later
…706-Robot-Code into shooter-develop-2
…706-Robot-Code into shooter-develop-2
GabbyGenereux
left a comment
There was a problem hiding this comment.
Please remove all the files under /.gradle from this PR, as they shouldn't be committed.
| @@ -0,0 +1,6 @@ | |||
| { | |||
There was a problem hiding this comment.
this shouldn't be committed either. We need to keep the projectYear and currentLanguage set, as it is now in the codebase.
2026-2706-Robot-Code-Imported/src/main/java/frc/robot/subsystems/ShooterStateMachine.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Nitpick: All java classes should be "PascalCase" (aka. first letter of every word should be capitalized) and methods should be camelCase (aka. first letter of every word, except for the first one, should be capitalized)
| import java.util.concurrent.TimeUnit; | ||
|
|
||
|
|
||
| /** An example command that uses an example subsystem. */ |
There was a problem hiding this comment.
lets update the comments with something more applicable to the current command/class
| // Returns true when the command should end. | ||
| @Override | ||
| public boolean isFinished() { | ||
| return false; |
There was a problem hiding this comment.
is this should return true when the command should end, and we just return false, does that mean the command never ends?
There was a problem hiding this comment.
Same comments apply here, rename the class and redo the comments so they are more descriptive of the code in the file.
| // Returns true when the command should end. | ||
| @Override | ||
| public boolean isFinished() { | ||
| return true; |
There was a problem hiding this comment.
Opposite question than the one I posed in startShooter, if we return true when the command should end, and we just return true right away, does the command every actually run?
There was a problem hiding this comment.
It looks to me that they have separated the start and stop into separate commands. Starting the shooting never ends until stop shooter is called. What happens if both commands are run at the same time (it could happen if they end up being assigned to different buttons).
I think they could probably be combined into a single command.
There was a problem hiding this comment.
the button bindings for both commands are set such that they are both binded to one button. when you press/hold the button, startShooter runs and when you let go of the button, stopShooter is called. so basically stopShooter is continuously called until the button is pressed.
2026-2706-Robot-Code/src/main/java/frc/robot/subsystems/AutoSelectorKnobSubsystem.java
Show resolved
Hide resolved
2026-2706-Robot-Code/src/main/java/frc/robot/subsystems/ShooterSubsystem.java
Outdated
Show resolved
Hide resolved
| // Determines which way the motor spins | ||
| shooterConfig.inverted(false); | ||
| shooterMotor2.configure( | ||
| shooterConfig, |
There was a problem hiding this comment.
nitpick: we should indent these properly to help with readability.
2026-2706-Robot-Code/src/main/java/frc/robot/subsystems/ShooterSubsystem.java
Outdated
Show resolved
Hide resolved
| followerConfig.follow(shooterMotor1); | ||
| shooterMotor2.configure(followerConfig, SparkBase.ResetMode.kResetSafeParameters, SparkBase.PersistMode.kPersistParameters); | ||
|
|
||
|
|
There was a problem hiding this comment.
nit: Lets remove this extra whitespace as well
| } | ||
|
|
||
| public void testMotor() { // purely for testing | ||
| System.out.println(shooterMotor1); |
There was a problem hiding this comment.
Lets remove this for now. You'll have to add it back locally when you want to test, but I'd rather than than have rouge print statements hanging out in the code.
| } | ||
|
|
||
| /** | ||
|
|
There was a problem hiding this comment.
This is a good place to put a comment explaining what this method does, and what it returns.
| //indexerMotor.set(getDesiredVoltage()/2); | ||
| } | ||
|
|
||
| //@Override |
There was a problem hiding this comment.
Should this be removed?
| public Robot() { | ||
| // Instantiate our RobotContainer. This will perform all our button bindings, and put our | ||
| // autonomous chooser on the dashboard. | ||
| System.out.println("shooter system initialized"); |
There was a problem hiding this comment.
We should remove print statements, if we want to log things we should use a separate logging system.
| m_encoder = shooterMotor1.getEncoder(); | ||
| SparkMaxConfig shooterConfig = new SparkMaxConfig(); | ||
| // Determines which way the motor spins | ||
| shooterConfig.inverted(false); |
There was a problem hiding this comment.
You could make this a static variable instead of having to hunt through the code for it. Depending on how the motor is wired, then may need to be true or false. Since this is configuration related, it would be good practise to define configuration constant data together. For example
private static boolean INVERTED = false;
| SparkBase.ResetMode.kResetSafeParameters, | ||
| SparkBase.PersistMode.kPersistParameters | ||
| ); | ||
| shooterMotor1.setCANTimeout(500);//Units in miliseconds |
There was a problem hiding this comment.
This timeout value could also be defined as a constant value... The other option for constant values is that you could allow them to be set via network tables... That can be really helpful during testing because it means you can dynamically tweak your variables without have to recompile and redeploy all the time.
| //@SuppressWarnings("resource") | ||
| shooterMotor2 = new SparkMax(Constants.shooterConstants.MOTOR2_ID, MotorType.kBrushless); | ||
| // Determines which way the motor spins | ||
| shooterConfig.inverted(false); |
There was a problem hiding this comment.
Similar comment as before, use a separate constant so they can be tweaked in one place.
Removed commented-out code related to resource warnings and indexer motor.
…706-Robot-Code into shooter-develop-2
Removed state machine to simplify code flow since theres only really two modes and two of the states can be combined into a singular method
Initialized and configured 4 motors (tested only 3 because we don't have agitator hopper motor)
Added CAN ID constants for motors
Created methods to control shooter motors based on current RPM and linked them to commands (startShooter, stopShooter)
Binded commands to the A button on the operator controller
Tested both shooter motors and feeder motor on prototype. Still need to PID tune.