Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code review pull request #51

Open
wants to merge 18 commits into
base: BranchForCodeReview2
Choose a base branch
from
Open

Conversation

Mboesn
Copy link
Contributor

@Mboesn Mboesn commented Jun 17, 2021

This pull request has all the code being merged into an empty branch.

This is done in order to have an easy way to review the entire code and write comments about everything.

src/main/java/frc/robot/RobotContainer.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/RobotContainer.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/RobotContainer.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/RobotContainer.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/RobotContainer.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/subsystems/shooter/ShooterSS.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/subsystems/spinner/SpinnerCMD.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/utilities/OIMap.java Outdated Show resolved Hide resolved
src/main/java/frc/robot/RobotContainer.java Show resolved Hide resolved
src/main/java/frc/robot/RobotContainer.java Outdated Show resolved Hide resolved
Comment on lines 58 to 63
private TrigonSwerveControllerCMDGP motionTest;
private IntakeOpenerCMD intakeCMD;

private ShootCMDGP shootCMDGP;
private ShootWithPitcherCMDGP ShootWithPitcherCMDGP;
private CollectCMDGP collectCMDGP;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

IntakeOpenerCMD Should be OpenIntake
CollectCMDGP should just be Collect

Subsystems are nouns.
Command are verbs of the nouns, all of these names should reflect the actions of the command instead of saying they are commands.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this comment was brought to you by Ohad not me

src/main/java/frc/robot/RobotContainer.java Outdated Show resolved Hide resolved
Comment on lines 86 to 91
SmartDashboard.putData("Shooter Command", shooterCMD);
SmartDashboard.putData("CalibrateShooterKfCMD", calibrateShooterKfCMD);
SmartDashboard.putData("CalibrateLoaderKfCMD", calibrateLoaderKfCMD);
SmartDashboard.putData("TurnToTargetCMD", turnToTargetCMD);
SmartDashboard.putData("TurnAndPositionToTargetCMD", turnAndPositionToTargetCMD);
SmartDashboard.putData("TrigonSwerveControllerCMDGP", motionTest);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

should be under "Commands/

/**
* @return the vector between the middle of the robot and the target.
*/
private Vector2d calculateVector() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this isnt used, does it need to exist?

Comment on lines +61 to +64
return 4.15*Math.pow(Math.E, -0.0604*y) + 0.8;
else
return 4.15*Math.pow(Math.E, -0.0604*y) + 0.8;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

magic numbers

/**
* @param tableKey the key of the limelight - if it was changed.
*/
public VanillaLimelight(String tableKey, LimelightConstants constants) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

change name to limelight


@Override
public void end(boolean interrupted) {
if(ledSS != null)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

remove


import java.util.HashMap;

public class SensorTestCMD extends CommandBase {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

test this class improtant

Copy link
Contributor Author

@Mboesn Mboesn left a comment

Choose a reason for hiding this comment

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

Changes in main code

Comment on lines 61 to 63
private ShootCMDGP shootCMDGP;
private ShootWithPitcherCMDGP ShootWithPitcherCMDGP;
private CollectCMDGP collectCMDGP;
Copy link
Contributor

Choose a reason for hiding this comment

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

CMDGP to CG

*/
public RobotContainer() {

Logger.configureLoggingAndConfig(this, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

explain in a comment

Comment on lines 86 to 91
SmartDashboard.putData("Shooter Command", shooterCMD);
SmartDashboard.putData("CalibrateShooterKfCMD", calibrateShooterKfCMD);
SmartDashboard.putData("CalibrateLoaderKfCMD", calibrateLoaderKfCMD);
SmartDashboard.putData("TurnToTargetCMD", turnToTargetCMD);
SmartDashboard.putData("TurnAndPositionToTargetCMD", turnAndPositionToTargetCMD);
SmartDashboard.putData("TrigonSwerveControllerCMDGP", motionTest);
Copy link
Contributor

Choose a reason for hiding this comment

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

Name them consistantly

Comment on lines 103 to 105
shooterCMD = new ShooterCMD(subsystemContainer.SHOOTER_SS, null, robotConstants.shooterConstants,
() -> SmartDashboard.getNumber("Shooter/Desired Velocity", 0));
calibrateShooterKfCMD = new CalibrateShooterKfCMD(subsystemContainer.SHOOTER_SS,
Copy link
Contributor

Choose a reason for hiding this comment

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

explain in a comment

* Initializes all commands.
*/
public void initializeCommands() {
SmartDashboard.putNumber("Shooter/Desired Velocity", 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not a command that you're initializing, so don't put it here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was required because that value is given to the command in the constructor and if you attempt to get a value without sending it first weird and annoying things happen

Comment on lines 113 to 118
double rand = 0.1 * this.rand.nextInt(10);
int odd = randomOddNumber();
while (odd < 5 && rand == 0.0) {
odd = randomOddNumber();
}
return -(rand + odd * 0.01);
Copy link
Contributor

Choose a reason for hiding this comment

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

eic

*/
private int randomOddNumber() {
int rand = this.rand.nextInt(10);
return rand % 2 == 0 ? rand + 1 : rand;
Copy link
Contributor

Choose a reason for hiding this comment

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

eic

Comment on lines +64 to +81
hasRecalculatedF = false;
hasSetpoint = false;
ballsShotCount = 0;
sampleCount = 0;
outputSum = 0;
lastTimeAtSetpoint = Timer.getFPGATimestamp();
currentState = ShooterState.AfterShot;
TBHController.reset();
PIDController.reset();
if (isUsingLimelight)
limelight.startVision(Target.PowerPort);
if(desiredVelocitySupplier.getAsDouble() < 2000){
desiredVelocity = 3200;
DriverStationLogger.logToDS("ShooterCMD/tooLowDesiredVelocity: " + desiredVelocitySupplier.getAsDouble());
}
else
desiredVelocity = desiredVelocitySupplier.getAsDouble();
f = constants.KF_COEF_A * desiredVelocity + constants.KF_COEF_B;
Copy link
Contributor

Choose a reason for hiding this comment

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

eic

Comment on lines +16 to +17
// private final TrigonDoubleSolenoid solenoid;
// private final ColorSensorV3 colorSensor;
Copy link
Contributor

Choose a reason for hiding this comment

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

wut

Comment on lines +9 to +18
private final JoystickButton buttonA;
private final JoystickButton buttonB;
private final JoystickButton buttonX;
private final JoystickButton buttonY;
private final JoystickButton leftBumper;
private final JoystickButton rightBumper;
private final JoystickButton leftStickButton;
private final JoystickButton rightStickButton;
private final JoystickButton backButton;
private final JoystickButton startButton;
Copy link
Contributor

Choose a reason for hiding this comment

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

whywhywhywhywhywhwyhwhyw
so ugly

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