-
Notifications
You must be signed in to change notification settings - Fork 1
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
Major upgrades #88
Major upgrades #88
Changes from all commits
6818dc1
aab4da6
f6aa252
60ad90a
65c684b
fc675e9
3a84ebe
2d36bce
daeca88
1261dc0
d80f84e
873584e
28a4627
3a825d5
0c4568f
7aecdbd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,18 +14,18 @@ public class AimShooter extends Command { | |
DoubleSupplier POVSupplier; | ||
BooleanSupplier humanPlayerSupplier; | ||
BooleanSupplier SubwooferSupplier1; | ||
BooleanSupplier SubwooferSupplier2; | ||
BooleanSupplier SubwooferSupplier3; | ||
BooleanSupplier StageAngleSupplier; | ||
BooleanSupplier intakeSupplier; | ||
|
||
public AimShooter(AngleShooterSubsystem angleShooterSubsystem, DoubleSupplier POVSupplier, BooleanSupplier humanPlayerSupplier, | ||
BooleanSupplier SubwooferSupplier1, BooleanSupplier SubwooferSupplier2, BooleanSupplier SubwooferSupplier3) { | ||
addRequirements(angleShooterSubsystem); | ||
BooleanSupplier SubwooferSupplier1, BooleanSupplier StageAngleSupplier, BooleanSupplier intakeSup) { | ||
this.angleShooterSubsystem = angleShooterSubsystem; | ||
this.POVSupplier = POVSupplier; | ||
this.humanPlayerSupplier = humanPlayerSupplier; | ||
this.SubwooferSupplier1 = SubwooferSupplier1; | ||
this.SubwooferSupplier2 = SubwooferSupplier2; | ||
this.SubwooferSupplier3 = SubwooferSupplier3; | ||
this.StageAngleSupplier = StageAngleSupplier; | ||
this.intakeSupplier = intakeSup; | ||
addRequirements(angleShooterSubsystem); | ||
} | ||
|
||
@Override | ||
|
@@ -35,20 +35,28 @@ public void initialize() { | |
|
||
@Override | ||
public void execute() { | ||
if(SubwooferSupplier1.getAsBoolean()&&SubwooferSupplier2.getAsBoolean()&&SubwooferSupplier3.getAsBoolean()) { | ||
if(SubwooferSupplier1.getAsBoolean()) { | ||
angleShooterSubsystem.setDesiredShooterAngle(Field.SUBWOOFER_ANGLE); | ||
} else { | ||
if (POVSupplier.getAsDouble() == 90 || POVSupplier.getAsDouble() == 45 || POVSupplier.getAsDouble() == 135) { | ||
angleShooterSubsystem.setDesiredShooterAngle(SmartDashboard.getNumber("amp angle", Field.AMPLIFIER_ANGLE)/*Field.AMPLIFIER_ANGLE*/); | ||
if (StageAngleSupplier.getAsBoolean()) { | ||
angleShooterSubsystem.setDesiredShooterAngle(Field.PODIUM_ANGLE); | ||
} else { | ||
if(humanPlayerSupplier.getAsBoolean()) { | ||
angleShooterSubsystem.setDesiredShooterAngle(ShooterConstants.HUMAN_PLAYER_ANGLE); | ||
} else { | ||
angleShooterSubsystem.setDesiredShooterAngle(angleShooterSubsystem.calculateSpeakerAngle()); | ||
if (POVSupplier.getAsDouble() == 90 || POVSupplier.getAsDouble() == 45 || POVSupplier.getAsDouble() == 135) { | ||
angleShooterSubsystem.setDesiredShooterAngle(SmartDashboard.getNumber("amp angle", Field.AMPLIFIER_ANGLE)/*Field.AMPLIFIER_ANGLE*/); | ||
} else { | ||
if(humanPlayerSupplier.getAsBoolean()) { | ||
angleShooterSubsystem.setDesiredShooterAngle(ShooterConstants.HUMAN_PLAYER_ANGLE); | ||
} else { | ||
if(intakeSupplier.getAsBoolean()) { | ||
angleShooterSubsystem.setDesiredShooterAngle(ShooterConstants.GROUND_INTAKE_SHOOTER_ANGLE); | ||
} else { | ||
angleShooterSubsystem.setDesiredShooterAngle(angleShooterSubsystem.calculateSpeakerAngle()); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A note on this whole execute function-- There's no reason to have the if/else statements increasingly nested... It just makes the code harder to read. This functionality is equivalent to:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your right... the nesting is just how i was taught to make if/else statements nested like that, but it is harder to read |
||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public boolean isFinished() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) FIRST and other WPILib contributors. | ||
// Open Source Software; you can modify and/or share it under the terms of | ||
// the WPILib BSD license file in the root directory of this project. | ||
|
||
package frc.robot.commands; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.settings.Constants.IndexerConstants; | ||
import frc.robot.settings.Constants.IntakeConstants; | ||
import frc.robot.subsystems.IndexerSubsystem; | ||
import frc.robot.subsystems.IntakeSubsystem; | ||
|
||
public class GroundIntake extends Command { | ||
/** Creates a new GroundIntake. */ | ||
IntakeSubsystem intake; | ||
IndexerSubsystem indexer; | ||
public GroundIntake(IntakeSubsystem intake, IndexerSubsystem indexer) { | ||
this.intake = intake; | ||
this.indexer = indexer; | ||
addRequirements(intake, indexer); | ||
// Use addRequirements() here to declare subsystem dependencies. | ||
} | ||
|
||
// Called when the command is initially scheduled. | ||
@Override | ||
public void initialize() { | ||
intake.intakeYes(IntakeConstants.INTAKE_SPEED); | ||
indexer.set(IndexerConstants.INDEXER_INTAKE_SPEED); | ||
} | ||
|
||
// Called every time the scheduler runs while the command is scheduled. | ||
@Override | ||
public void execute() {} | ||
|
||
// Called once the command ends or is interrupted. | ||
@Override | ||
public void end(boolean interrupted) { | ||
intake.intakeOff(); | ||
indexer.off(); | ||
} | ||
|
||
// Returns true when the command should end. | ||
@Override | ||
public boolean isFinished() { | ||
return false; | ||
} | ||
} |
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 SmartDashboard.getNumber call seems dangerous... Even if there is no longer an "amp angle" field on the SmartDashboard, it would put my mind at ease if we just changed the Field.AMPLIFIER_ANGLE to be the value you liked best.
If your testing earlier discovered that there was a particular angle that worked best, we need to make sure that the Field.AMPLIFIER_ANGLE constant gets updated appropriately, instead of leaving that change in the SmartDashboard widget.
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.
I agree we should change this,but to set ur mind at ease, when the Boolean is initialized on SmartDashboard (whenever robot code starts) it is set to whatever the constant is. So if you never change anything on SmartDashboard, you will just use the constant