refactor isUsingTimeToPassDefense to isUsingTime
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / commands / auton / PassLowBar.java
old mode 100755 (executable)
new mode 100644 (file)
index 8d42325..9ee3e6e
@@ -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 low bar.
  *
+ * dependency on sensors: encoders
+ * dependency on subsystems: drivetrain
+ * dependency on other commands: DriveForDist
+ *
  * pre-condition: robot is flush against the ramp of the outerworks in front of
  * the low bar
  *
@@ -13,30 +21,18 @@ import edu.wpi.first.wpilibj.command.Command;
  * @author Meryem and Avi
  *
  */
-public class PassLowBar extends Command {
-
-  public PassLowBar() {
-
-  }
-
-  @Override
-  protected void initialize() {
-  }
-
-  @Override
-  protected void execute() {
-  }
 
-  @Override
-  protected boolean isFinished() {
-    return false;
-  }
+public class PassLowBar extends CommandGroup {
 
-  @Override
-  protected void end() {
-  }
-
-  @Override
-  protected void interrupted() {
+  public PassLowBar() {
+    if (Constants.Auton.isUsingTime) {
+      addSequential(new DriveForTime(Constants.Auton.passLowBarTime,
+          Constants.Auton.passLowBarSpeed));
+    }
+    else {
+      addSequential(new DriveDistance(
+          Constants.Auton.passLowBarDistance,
+          Constants.DriveTrain.PASS_DEFENSE_TIMEOUT));
+    }
   }
 }