| 1 | package org.usfirst.frc.team3501.robot.commands.shooter; |
| 2 | |
| 3 | import org.usfirst.frc.team3501.robot.Constants; |
| 4 | import org.usfirst.frc.team3501.robot.Robot; |
| 5 | |
| 6 | import edu.wpi.first.wpilibj.command.CommandGroup; |
| 7 | import edu.wpi.first.wpilibj.command.WaitCommand; |
| 8 | |
| 9 | public class Shoot extends CommandGroup { |
| 10 | |
| 11 | public boolean usePhotogate; |
| 12 | |
| 13 | /** |
| 14 | * Fires catapult, then resets after a pause. If robot is set to use photogate |
| 15 | * and no ball is detected, nothing happens. |
| 16 | * |
| 17 | * Precondition: catapult is in reset position, and ball is loaded in |
| 18 | * catapult. |
| 19 | */ |
| 20 | public Shoot() { |
| 21 | if (Robot.shooter.usePhotogate()) { |
| 22 | if (Robot.shooter.isBallInside()) { |
| 23 | addSequential(new FireCatapult()); |
| 24 | addSequential(new WaitCommand(Constants.Shooter.WAIT_TIME)); |
| 25 | addSequential(new ResetCatapult()); |
| 26 | } |
| 27 | } else { |
| 28 | addSequential(new FireCatapult()); |
| 29 | addSequential(new WaitCommand(Constants.Shooter.WAIT_TIME)); |
| 30 | addSequential(new ResetCatapult()); |
| 31 | } |
| 32 | } |
| 33 | } |