refactor isUsingTimeToPassDefense to isUsingTime
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / commands / auton / PassRampart.java
index f381af4f1c8465c4706e1b983c217d13153cc755..e5af033e9a85272f118ee7925e360a6b2b6d5b51 100755 (executable)
@@ -1,10 +1,18 @@
 package org.usfirst.frc.team3501.robot.commands.auton;
 
-import edu.wpi.first.wpilibj.command.Command;
+import org.usfirst.frc.team3501.robot.Constants;
+import org.usfirst.frc.team3501.robot.commands.driving.DriveDistance;
+import org.usfirst.frc.team3501.robot.commands.driving.DriveForTime;
+
+import edu.wpi.first.wpilibj.command.CommandGroup;
 
 /***
  * This command will drive the robot through the rampart.
  *
+ * dependency on subsystems: drivetrain
+ *
+ * dependency on other commands: DriveForTime
+ *
  * pre-condition: robot is flush against the ramp of the outerworks in front of
  * the rampart
  *
@@ -13,30 +21,21 @@ import edu.wpi.first.wpilibj.command.Command;
  * @author Meryem and Avi
  *
  */
-public class PassRampart extends Command {
-
-  public PassRampart() {
-
-  }
 
-  @Override
-  protected void initialize() {
-  }
+public class PassRampart extends CommandGroup {
 
-  @Override
-  protected void execute() {
-  }
+  public PassRampart() {
 
-  @Override
-  protected boolean isFinished() {
-    return false;
-  }
+    if (Constants.Auton.isUsingTime) {
+      addSequential(new DriveForTime(Constants.Auton.passRockWallTime,
+          Constants.Auton.passRockWallSpeed));
+    }
+    else {
+      addSequential(new DriveDistance(
+          Constants.Auton.passRampartDistance,
+          Constants.DriveTrain.PASS_DEFENSE_TIMEOUT));
+    }
 
-  @Override
-  protected void end() {
   }
 
-  @Override
-  protected void interrupted() {
-  }
 }