change TimeDrive back to using a constant speed because we want a constant speed...
authorMeryem Esa <meresa14@gmail.com>
Wed, 16 Mar 2016 02:02:34 +0000 (19:02 -0700)
committerHarel Dor <hareldor@gmail.com>
Tue, 22 Mar 2016 23:10:27 +0000 (16:10 -0700)
src/org/usfirst/frc/team3501/robot/commands/driving/TimeDrive.java

index e9a8f9f34bb598906cdcb4e2b4d8bb90e4b5e612..e4c1d75bc360afdcdb9e4ab9d7177ae61c2179bc 100644 (file)
@@ -8,7 +8,7 @@ import edu.wpi.first.wpilibj.command.Command;
 
 public class TimeDrive extends Command {
   Timer timer;
-  double currentTime, targetTime, speed;
+  double speed, time;
 
   public TimeDrive() {
     this(Auton.DEFAULT_TIME, Auton.DEFAULT_SPEED);
@@ -22,28 +22,23 @@ public class TimeDrive extends Command {
     requires(Robot.driveTrain);
 
     timer = new Timer();
-    this.currentTime = 0;
-    this.targetTime = time;
     this.speed = speed;
   }
 
   @Override
   protected void initialize() {
     timer.start();
+    Robot.driveTrain.setMotorSpeeds(speed, speed);
   }
 
   @Override
   protected void execute() {
-    currentTime = timer.get();
 
-    double output = speed * ((targetTime - currentTime) / (targetTime));
-
-    Robot.driveTrain.setMotorSpeeds(output, output);
   }
 
   @Override
   protected boolean isFinished() {
-    return currentTime >= targetTime;
+    return time >= time;
   }
 
   @Override