--- /dev/null
+package org.usfirst.frc.team3501.robot.commands;\r
+\r
+import org.usfirst.frc.team3501.robot.Robot;\r
+\r
+import edu.wpi.first.wpilibj.Timer;\r
+import edu.wpi.first.wpilibj.command.Command;\r
+\r
+/**\r
+ * This command\r
+ */\r
+public class DriveForTime extends Command {\r
+\r
+ private final static double DEFAULT_SPEED = 0.5;\r
+ private double speed;\r
+ private double seconds;\r
+\r
+ private Timer timer;\r
+\r
+ public DriveForTime(double seconds, double speed) {\r
+ this.seconds = seconds;\r
+ this.speed = speed;\r
+ }\r
+\r
+ public DriveForTime(double seconds) {\r
+ this(seconds, DEFAULT_SPEED);\r
+ }\r
+\r
+ @Override\r
+ protected void initialize() {\r
+ timer = new Timer();\r
+ timer.start();\r
+\r
+ Robot.driveTrain.setMotorSpeeds(speed, speed);\r
+ }\r
+\r
+ @Override\r
+ protected void execute() {\r
+ }\r
+\r
+ @Override\r
+ protected boolean isFinished() {\r
+ if (timer.get() >= seconds)\r
+ return true;\r
+ return false;\r
+ }\r
+\r
+ @Override\r
+ protected void end() {\r
+ Robot.driveTrain.setMotorSpeeds(0, 0);\r
+ }\r
+\r
+ @Override\r
+ protected void interrupted() {\r
+ }\r
+}\r