X-Git-Url: http://challenge-bot.com/repos/?a=blobdiff_plain;f=src%2Forg%2Fusfirst%2Ffrc%2Fteam3501%2Frobot%2Fcommands%2Fdriving%2FTimeDrive.java;fp=src%2Forg%2Fusfirst%2Ffrc%2Fteam3501%2Frobot%2Fcommands%2Fdriving%2FTimeDrive.java;h=e4c1d75bc360afdcdb9e4ab9d7177ae61c2179bc;hb=2e74db51ee32c8a7a297d5e04150ffe2c408ee25;hp=e9a8f9f34bb598906cdcb4e2b4d8bb90e4b5e612;hpb=5aa7457a990473a5df1de74654d56418e10daaa7;p=3501%2Fstronghold-2016 diff --git a/src/org/usfirst/frc/team3501/robot/commands/driving/TimeDrive.java b/src/org/usfirst/frc/team3501/robot/commands/driving/TimeDrive.java index e9a8f9f3..e4c1d75b 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/driving/TimeDrive.java +++ b/src/org/usfirst/frc/team3501/robot/commands/driving/TimeDrive.java @@ -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