Change shooter to function off of two pistons, remove punch, shooter motors, and...
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / commands / shooter / Shoot.java
index ec5a11d59e9feacbb9ad8930699ad50cd3aefef9..0b80c1d9c349f7d8b0ddcde6d0bd936e2f632f26 100755 (executable)
@@ -1,30 +1,33 @@
 package org.usfirst.frc.team3501.robot.commands.shooter;
 
-import edu.wpi.first.wpilibj.command.Command;
-
-public class Shoot extends Command {
-
-       public Shoot() {
-       }
-
-       @Override
-       protected void initialize() {
-       }
-
-       @Override
-       protected void execute() {
-       }
-
-       @Override
-       protected boolean isFinished() {
-               return false;
-       }
-
-       @Override
-       protected void end() {
-       }
-
-       @Override
-       protected void interrupted() {
-       }
+import org.usfirst.frc.team3501.robot.Constants;
+import org.usfirst.frc.team3501.robot.Robot;
+
+import edu.wpi.first.wpilibj.command.CommandGroup;
+import edu.wpi.first.wpilibj.command.WaitCommand;
+
+public class Shoot extends CommandGroup {
+
+  public boolean usePhotogate;
+
+  /**
+   * Fires catapult, then resets after a pause. If robot is set to use photogate
+   * and no ball is detected, nothing happens.
+   * 
+   * Precondition: catapult is in reset position, and ball is loaded in
+   * catapult.
+   */
+  public Shoot() {
+    if (Robot.shooter.usePhotogate()) {
+      if (Robot.shooter.isBallInside()) {
+        addSequential(new FireCatapult());
+        addSequential(new WaitCommand(Constants.Shooter.WAIT_TIME));
+        addSequential(new ResetCatapult());
+      }
+    } else {
+      addSequential(new FireCatapult());
+      addSequential(new WaitCommand(Constants.Shooter.WAIT_TIME));
+      addSequential(new ResetCatapult());
+    }
+  }
 }