| 1 | package org.usfirst.frc.team3501.robot.commands.intakearm; |
| 2 | |
| 3 | import org.usfirst.frc.team3501.robot.Robot; |
| 4 | |
| 5 | import edu.wpi.first.wpilibj.command.Command; |
| 6 | |
| 7 | /*** |
| 8 | * This command will expel a boulder from the robot, if it is even present to |
| 9 | * begin with. |
| 10 | * |
| 11 | * pre-condition: Intake arm is at correct height and a boulder is present |
| 12 | * inside the robot. |
| 13 | * |
| 14 | * post-condition: A boulder is expelled from inside the robot to the field |
| 15 | * outside of the robot. |
| 16 | * |
| 17 | * @author Lauren and Niyati |
| 18 | * |
| 19 | */ |
| 20 | |
| 21 | public class ExpelBall extends Command { |
| 22 | private final int TIMEOUT_AMOUNT = 5; |
| 23 | |
| 24 | public ExpelBall() { |
| 25 | requires(Robot.intakeArm); |
| 26 | } |
| 27 | |
| 28 | @Override |
| 29 | protected void initialize() { |
| 30 | this.setTimeout(TIMEOUT_AMOUNT); |
| 31 | if (Robot.shooter.isBallInside()) |
| 32 | Robot.intakeArm.outputBall(); |
| 33 | } |
| 34 | |
| 35 | @Override |
| 36 | protected void execute() { |
| 37 | } |
| 38 | |
| 39 | @Override |
| 40 | protected boolean isFinished() { |
| 41 | return (this.isTimedOut() || !Robot.shooter.isBallInside()); |
| 42 | } |
| 43 | |
| 44 | @Override |
| 45 | protected void end() { |
| 46 | Robot.intakeArm.stopRollers(); |
| 47 | } |
| 48 | |
| 49 | @Override |
| 50 | protected void interrupted() { |
| 51 | |
| 52 | } |
| 53 | |
| 54 | } |