62805410ab37f7fe205ddd1507c25646dc69f47e
1 package org
.usfirst
.frc
.team3501
.robot
.commands
.driving
;
3 import org
.usfirst
.frc
.team3501
.robot
.Robot
;
5 import edu
.wpi
.first
.wpilibj
.Timer
;
6 import edu
.wpi
.first
.wpilibj
.command
.Command
;
9 * This commands make the robot drive for a specified time with the motors set
10 * at a specified value between 1 and -1
13 * time: how long the robot should drive for - in seconds
14 * motorVal: the motor input to set the motors to
16 public class TimeDrive
extends Command
{
18 double motorVal
, time
;
20 public TimeDrive(final double time
, final double motorVal
) {
21 requires(Robot
.getDriveTrain());
25 this.motorVal
= motorVal
;
29 protected void initialize() {
31 Robot
.getDriveTrain().setMotorValues(motorVal
, motorVal
);
35 protected void execute() {
39 protected boolean isFinished() {
40 return timer
.get() >= time
;
44 protected void end() {
45 Robot
.getDriveTrain().stop();
49 protected void interrupted() {