Modify auton to ramp up in 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 currentTime, targetTime, speed;
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 this.setTimeout(time);
25 this.speed = speed;
26 }
27
28 @Override
29 protected void initialize() {
30 }
31
32 @Override
33 protected void execute() {
34 Robot.driveTrain.drive(speed, 0);
35 }
36
37 @Override
38 protected boolean isFinished() {
39 return this.isTimedOut();
40 }
41
42 @Override
43 protected void end() {
44 Robot.driveTrain.stop();
45 }
46
47 @Override
48 protected void interrupted() {
49 end();
50 }
51 }