Skip to content
This repository was archived by the owner on Sep 14, 2019. It is now read-only.

Commit 2e48242

Browse files
committed
whoops forgot this file :)
1 parent b21e3f1 commit 2e48242

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package org.usfirst.frc.team199.Robot2018.commands;
2+
3+
import org.usfirst.frc.team199.Robot2018.Robot;
4+
5+
import edu.wpi.first.wpilibj.Timer;
6+
import edu.wpi.first.wpilibj.command.Command;
7+
8+
/**
9+
*
10+
*/
11+
public class SetDistancePerPulse extends Command {
12+
13+
Timer tim;
14+
public SetDistancePerPulse() {
15+
// Use requires() here to declare subsystem dependencies
16+
// eg. requires(chassis);
17+
}
18+
19+
// Called just before this Command runs the first time
20+
protected void initialize() {
21+
tim = new Timer();
22+
tim.reset();
23+
tim.start();
24+
}
25+
26+
// Called repeatedly when this Command is scheduled to run
27+
protected void execute() {
28+
Robot.dt.setDistancePerPulseLeft(Robot.getConst("Distance Per Pulse Left", 0.184));
29+
Robot.dt.setDistancePerPulseRight(Robot.getConst("Distance Per Pulse Right", 0.184));
30+
}
31+
32+
// Make this return true when this Command no longer needs to run execute()
33+
protected boolean isFinished() {
34+
return tim.get() > Robot.getConst("Update Constants Time", 0.1);
35+
}
36+
37+
// Called once after isFinished returns true
38+
protected void end() {
39+
}
40+
41+
// Called when another command which requires one or more of the same
42+
// subsystems is scheduled to run
43+
protected void interrupted() {
44+
end();
45+
}
46+
}

0 commit comments

Comments
 (0)