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