| 1 | package org.usfirst.frc.team3501.robot.commands.intakearm; |
| 2 | |
| 3 | import org.usfirst.frc.team3501.robot.Constants.IntakeArm; |
| 4 | import org.usfirst.frc.team3501.robot.Robot; |
| 5 | |
| 6 | import edu.wpi.first.wpilibj.command.Command; |
| 7 | |
| 8 | public class RunIntakeContinuous extends Command { |
| 9 | int direction; |
| 10 | |
| 11 | public RunIntakeContinuous(int direction) { |
| 12 | requires(Robot.intakeArm); |
| 13 | this.direction = direction; |
| 14 | } |
| 15 | |
| 16 | @Override |
| 17 | protected void initialize() { |
| 18 | if (direction == IntakeArm.IN) |
| 19 | Robot.intakeArm.intakeBall(); |
| 20 | else if (direction == IntakeArm.OUT) |
| 21 | Robot.intakeArm.outputBall(); |
| 22 | else |
| 23 | Robot.intakeArm.stopRollers(); |
| 24 | } |
| 25 | |
| 26 | @Override |
| 27 | protected void execute() { |
| 28 | // if (Photogate.ballState()) |
| 29 | Robot.intakeArm.outputBall(); |
| 30 | } |
| 31 | |
| 32 | @Override |
| 33 | protected boolean isFinished() { |
| 34 | return true; |
| 35 | } |
| 36 | |
| 37 | @Override |
| 38 | protected void end() { |
| 39 | } |
| 40 | |
| 41 | @Override |
| 42 | protected void interrupted() { |
| 43 | } |
| 44 | |
| 45 | // while holding right trigger, intake intakes |
| 46 | // it intakes until it sees the ball with the photogate |
| 47 | // as soon as it sees the ball, it outtakes for 0.2 seconds. |
| 48 | // after this happens, the right trigger does nothing for 2 seconds |
| 49 | |
| 50 | } |