Total Complexity | 7 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Changes | 6 | ||
Bugs | 0 | Features | 1 |
1 | package org.usfirst.frc.team3695.robot.commands; |
||
6 | public class CyborgCommandSpit extends Command { |
||
7 | |||
8 | Boolean isFinished; |
||
|
|||
9 | long runTime; |
||
10 | long startTime; |
||
11 | |||
12 | public CyborgCommandSpit(long runTime) { |
||
13 | isFinished = false; |
||
14 | requires(Robot.SUB_MANIPULATOR); |
||
15 | this.runTime = runTime; |
||
16 | } |
||
17 | |||
18 | protected void initialize() { |
||
19 | startTime = System.currentTimeMillis(); |
||
20 | } |
||
21 | |||
22 | protected void execute() { |
||
23 | if (startTime + runTime >= System.currentTimeMillis()){ |
||
24 | Robot.SUB_MANIPULATOR.spit(); |
||
25 | } else { |
||
26 | isFinished = true; |
||
27 | } |
||
28 | } |
||
29 | |||
30 | protected boolean isFinished() { return isFinished; } |
||
31 | |||
32 | protected void end() { |
||
33 | Robot.SUB_MANIPULATOR.stopSpinning(); |
||
34 | isFinished = false; |
||
35 | } |
||
36 | |||
37 | protected void interrupted() { |
||
38 | end(); |
||
39 | } |
||
41 |