* This command will expel a boulder from the robot, if it is even present to
* begin with.
*
- * pre-condition: A boulder is present inside the robot.
+ * 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.
*/
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();
}
@Override
protected boolean isFinished() {
- return !Robot.photogate.isBallPresent();
+ return (this.isTimedOut() || !Robot.photogate.isBallPresent());
}
@Override
* This command will take a boulder into the robot if there is not a boulder
* present inside already.
*
- * pre-condition: A boulder is not present inside the robot.
+ * pre-condition: Intake arm must be at correct height and a boulder is not
+ * present inside the robot.
*
* post-condition: A boulder is taken in from the field outside of the robot
* into the robot.
*/
public class IntakeBall extends Command {
+ private final int TIMEOUT_AMOUNT = 5;
public IntakeBall() {
requires(Robot.intakeArm);
@Override
protected void initialize() {
+ this.setTimeout(TIMEOUT_AMOUNT);
if (!Robot.photogate.isBallPresent())
Robot.intakeArm.intakeBall();
@Override
protected boolean isFinished() {
- return Robot.photogate.isBallPresent();
+ return (this.isTimedOut() || Robot.photogate.isBallPresent());
}
@Override