1 | package org.usfirst.frc.team3695.robot.commands; |
||
2 | |||
3 | import edu.wpi.first.wpilibj.command.Command; |
||
4 | import org.usfirst.frc.team3695.robot.Robot; |
||
5 | import org.usfirst.frc.team3695.robot.util.Util; |
||
6 | |||
7 | /** Toggle PID */ |
||
8 | public class ToggleCommandKillPID extends Command { |
||
9 | |||
10 | public static Boolean PID_ENABLED; |
||
0 ignored issues
–
show
|
|||
11 | |||
12 | public ToggleCommandKillPID() { |
||
13 | requires(Robot.SUB_DRIVE); |
||
14 | PID_ENABLED = true; |
||
0 ignored issues
–
show
|
|||
15 | } |
||
16 | |||
17 | protected void initialize() { |
||
18 | PID_ENABLED = !PID_ENABLED; |
||
0 ignored issues
–
show
|
|||
19 | if (PID_ENABLED) { |
||
20 | Robot.SUB_DRIVE.pid.setPIDF(Util.getAndSetDouble("P", .5), |
||
0 ignored issues
–
show
|
|||
21 | Util.getAndSetDouble("I", 0), |
||
22 | Util.getAndSetDouble("D", 0), |
||
23 | Util.getAndSetDouble("F", 0)); |
||
24 | } else { |
||
25 | Robot.SUB_DRIVE.pid.setPIDF(0,0,0,0); |
||
26 | } |
||
27 | } |
||
28 | |||
29 | protected void execute() { } |
||
30 | |||
31 | protected boolean isFinished() { |
||
32 | return true; |
||
33 | } |
||
34 | |||
35 | protected void end() {} |
||
36 | |||
37 | protected void interrupted() {} |
||
38 | } |
||
39 |
See this CWE advisory on why this is a security issue.