X-Git-Url: http://challenge-bot.com/repos/?a=blobdiff_plain;f=src%2Forg%2Fusfirst%2Ffrc%2Fteam3501%2Frobot%2Fcommands%2FExpelBall.java;h=ba95e6e27621358de74245dc27238d7f8282bc38;hb=a1989c116a0926b44d6f36067e84b7f5fb2d313f;hp=573bd9048cdef6fbabb75ed98b343494cd2f6bd4;hpb=f19a94ad4127fc33806e1c1aaa591589e964778e;p=3501%2Fstronghold-2016 diff --git a/src/org/usfirst/frc/team3501/robot/commands/ExpelBall.java b/src/org/usfirst/frc/team3501/robot/commands/ExpelBall.java index 573bd904..ba95e6e2 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/ExpelBall.java +++ b/src/org/usfirst/frc/team3501/robot/commands/ExpelBall.java @@ -4,13 +4,30 @@ import org.usfirst.frc.team3501.robot.Robot; import edu.wpi.first.wpilibj.command.Command; +/*** + * This command will expel a boulder from the robot, if it is even present to + * begin with. + * + * pre-condition: Intake arm is at correct height and a boulder is present + * inside the robot. + * + * post-condition: A boulder is expelled from inside the robot to the field + * outside of the robot. + * + * @author Lauren and Niyati + * + */ + public class ExpelBall extends Command { + private final int TIMEOUT_AMOUNT = 5; public ExpelBall() { + requires(Robot.intakeArm); } @Override protected void initialize() { + this.setTimeout(TIMEOUT_AMOUNT); if (Robot.photogate.isBallPresent()) Robot.intakeArm.outputBall(); } @@ -21,12 +38,12 @@ public class ExpelBall extends Command { @Override protected boolean isFinished() { - return !Robot.photogate.isBallPresent(); + return (this.isTimedOut() || !Robot.photogate.isBallPresent()); } @Override protected void end() { - + Robot.intakeArm.stopRollers(); } @Override