-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: BranchForCodeReview2
Are you sure you want to change the base?
Conversation
src/main/java/frc/robot/utilities/TrigonPlaystationController.java
Outdated
Show resolved
Hide resolved
private TrigonSwerveControllerCMDGP motionTest; | ||
private IntakeOpenerCMD intakeCMD; | ||
|
||
private ShootCMDGP shootCMDGP; | ||
private ShootWithPitcherCMDGP ShootWithPitcherCMDGP; | ||
private CollectCMDGP collectCMDGP; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
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); |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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?
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; | ||
} |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test this class improtant
There was a problem hiding this 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
private ShootCMDGP shootCMDGP; | ||
private ShootWithPitcherCMDGP ShootWithPitcherCMDGP; | ||
private CollectCMDGP collectCMDGP; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explain in a comment
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name them consistantly
shooterCMD = new ShooterCMD(subsystemContainer.SHOOTER_SS, null, robotConstants.shooterConstants, | ||
() -> SmartDashboard.getNumber("Shooter/Desired Velocity", 0)); | ||
calibrateShooterKfCMD = new CalibrateShooterKfCMD(subsystemContainer.SHOOTER_SS, |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
double rand = 0.1 * this.rand.nextInt(10); | ||
int odd = randomOddNumber(); | ||
while (odd < 5 && rand == 0.0) { | ||
odd = randomOddNumber(); | ||
} | ||
return -(rand + odd * 0.01); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eic
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eic
// private final TrigonDoubleSolenoid solenoid; | ||
// private final ColorSensorV3 colorSensor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wut
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whywhywhywhywhywhwyhwhyw
so ugly
switched ledcontroller and blink time to constants switched isopen place in constructor
…-TRIGON/RobotCode2021 into BranchForCodeReview1
Based on Ohad code review done by me not Ohad
based on ohads code review fixed by me not him
Co-Authored-By: lycaon7 <[email protected]> Co-authored-by: lycaon7 <[email protected]>
this took way too long but it works hopefully
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.