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
12 * parameters: time: how long the robot should drive for - in seconds motorVal:
13 * the motor input to set the motors to
17 public class TimeDrive
extends Command
{
19 double motorVal
, motorValTwo
, time
;
21 public TimeDrive(final double time
, final double motorVal
) {
22 requires(Robot
.getDriveTrain());
26 this.motorVal
= motorVal
;
30 protected void initialize() {
35 protected void execute() {
37 motorValues
= Robot
.getDriveTrain().correctStraightness();
38 motorVal
= motorValues
[0];
39 motorValTwo
= motorValues
[1];
40 Robot
.getDriveTrain().setMotorValues(motorVal
, motorValTwo
);
45 protected boolean isFinished() {
46 return timer
.get() >= time
;
50 protected void end() {
51 Robot
.getDriveTrain().stop();
55 protected void interrupted() {