Minor fixes after merging
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / commands / driving / TimeDrive.java
CommitLineData
f53566b3
HD
1package org.usfirst.frc.team3501.robot.commands.driving;
2
3import org.usfirst.frc.team3501.robot.Constants.Auton;
4import org.usfirst.frc.team3501.robot.Robot;
5
6import edu.wpi.first.wpilibj.Timer;
7import edu.wpi.first.wpilibj.command.Command;
8
9public class TimeDrive extends Command {
10 Timer timer;
2e74db51 11 double speed, time;
f53566b3
HD
12
13 public TimeDrive() {
14 this(Auton.DEFAULT_TIME, Auton.DEFAULT_SPEED);
15 }
16
17 public TimeDrive(double time) {
18 this(time, Auton.DEFAULT_SPEED);
19 }
20
21 public TimeDrive(double time, double speed) {
22 requires(Robot.driveTrain);
23
24 timer = new Timer();
f53566b3
HD
25 this.speed = speed;
26 }
27
28 @Override
29 protected void initialize() {
30 timer.start();
2e74db51 31 Robot.driveTrain.setMotorSpeeds(speed, speed);
f53566b3
HD
32 }
33
34 @Override
35 protected void execute() {
f53566b3 36
f53566b3
HD
37 }
38
39 @Override
40 protected boolean isFinished() {
f675bae4 41 return timer.get() >= time;
f53566b3
HD
42 }
43
44 @Override
45 protected void end() {
46 Robot.driveTrain.stop();
47 }
48
49 @Override
50 protected void interrupted() {
51 end();
52 }
53}