-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDriveForTime.java
39 lines (31 loc) · 1 KB
/
DriveForTime.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package org.usfirst.frc.team4541.robot.commands;
import org.usfirst.frc.team4541.robot.Robot;
import edu.wpi.first.wpilibj.command.TimedCommand;
/**
* This command is used to drive for a specific length of time
*/
public class DriveForTime extends TimedCommand {
double xRate, yRate, rRate;
public DriveForTime(double xrate, double yrate, double rrate, double timeout) {
super(timeout);
requires(Robot.drivetrain);
xRate = xrate;
yRate = yrate;
rRate = rrate;
}
// Called just before this Command runs the first time
protected void initialize() {
}
// Called repeatedly when this Command is scheduled to run
protected void execute() {
Robot.drivetrain.drive(xRate, yRate, rRate);
}
// Called once after timeout
protected void end(){
Robot.drivetrain.drive(0, 0, 0);
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
protected void interrupted() {
}
}