This repository was archived by the owner on Sep 14, 2019. It is now read-only.
File tree Expand file tree Collapse file tree
Robot2018/src/org/usfirst/frc/team199/Robot2018/commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments