change TimeDrive back to using a constant speed because we want a constant speed...
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / commands / driving / TimeDrive.java
1 package org.usfirst.frc.team3501.robot.commands.driving;
2
3 import org.usfirst.frc.team3501.robot.Constants.Auton;
4 import org.usfirst.frc.team3501.robot.Robot;
5
6 import edu.wpi.first.wpilibj.Timer;
7 import edu.wpi.first.wpilibj.command.Command;
8
9 public class TimeDrive extends Command {
10 Timer timer;
11 double speed, time;
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();
25 this.speed = speed;
26 }
27
28 @Override
29 protected void initialize() {
30 timer.start();
31 Robot.driveTrain.setMotorSpeeds(speed, speed);
32 }
33
34 @Override
35 protected void execute() {
36
37 }
38
39 @Override
40 protected boolean isFinished() {
41 return time >= time;
42 }
43
44 @Override
45 protected void end() {
46 Robot.driveTrain.stop();
47 }
48
49 @Override
50 protected void interrupted() {
51 end();
52 }
53 }