add dead reckoning time, spd, distance to pass defense commands and constants
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / commands / auton / PassMoat.java
index 1e7ce58526cfcd15a1648feeba2a46eb2b64c1ad..f5b01c468bb774533752c57afa1c19852bc78a2e 100755 (executable)
@@ -1,10 +1,21 @@
 package org.usfirst.frc.team3501.robot.commands.auton;
 
+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 moat.
  *
+ * The code drives the robot for a specific time at a specific speed up the ramp
+ * to the defense then drive over the defense at a different speed and time.
+ *
+ * dependency on subsystem: drivetrain
+ *
+ * dependency on other commands: DriveForTime
+ *
  * pre-condition: robot is flush against the ramp of the outerworks in front of
  * the moat
  *
@@ -16,17 +27,15 @@ import edu.wpi.first.wpilibj.command.CommandGroup;
 
 public class PassMoat extends CommandGroup {
 
-  private final double BEG_TIME = 0;
-  private final double MID_TIME = 0;
-  private final double END_TIME = 0;
-  private final double BEG_SPEED = 0;
-  private final double MID_SPEED = 0;
-  private final double END_SPEED = 0;
-
   public PassMoat() {
-    addSequential(new DriveForTime(BEG_TIME, BEG_SPEED));
-    addSequential(new DriveForTime(MID_TIME, MID_SPEED));
-    addSequential(new DriveForTime(END_TIME, END_SPEED));
+    if (Constants.DeadReckoning.isDeadReckoning) {
+      addSequential(new DriveForTime(Constants.DeadReckoning.passMoatTime,
+          Constants.DeadReckoning.passMoatSpeed));
+    }
+    else {
+      addSequential(new DriveDistance(Constants.DeadReckoning.passMoatDistance,
+          Constants.DriveTrain.PASS_DEFENSE_TIMEOUT));
+    }
 
   }
 }