|
2 | 2 |
|
3 | 3 | import org.usfirst.frc.team199.Robot2018.Robot; |
4 | 4 |
|
5 | | -import edu.wpi.first.wpilibj.Timer; |
6 | | -import edu.wpi.first.wpilibj.command.Command; |
| 5 | +import edu.wpi.first.wpilibj.command.InstantCommand; |
7 | 6 | import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; |
8 | 7 |
|
9 | 8 | /** |
10 | 9 | * |
11 | 10 | */ |
12 | | -public class ShiftDriveType extends Command { |
13 | | - |
14 | | - Timer tim; |
15 | | - boolean arcadeDrive; |
| 11 | +public class ShiftDriveType extends InstantCommand { |
16 | 12 |
|
17 | 13 | public ShiftDriveType() { |
| 14 | + super(); |
18 | 15 | // Use requires() here to declare subsystem dependencies |
19 | 16 | // eg. requires(chassis); |
20 | 17 | } |
21 | 18 |
|
22 | | - // Called just before this Command runs the first time |
| 19 | + // Called once when the command executes |
23 | 20 | protected void initialize() { |
24 | | - tim = new Timer(); |
25 | | - tim.reset(); |
26 | | - tim.start(); |
27 | | - arcadeDrive = Robot.getBool("Arcade Drive", true); |
28 | | - } |
29 | | - |
30 | | - // Called repeatedly when this Command is scheduled to run |
31 | | - protected void execute() { |
32 | | - SmartDashboard.putBoolean("Bool/Arcade Drive", !arcadeDrive); |
33 | | - } |
34 | | - |
35 | | - // Make this return true when this Command no longer needs to run execute() |
36 | | - protected boolean isFinished() { |
37 | | - return tim.get() > Robot.getConst("SD Value Update Time", 0.125); |
38 | | - } |
39 | | - |
40 | | - // Called once after isFinished returns true |
41 | | - protected void end() { |
| 21 | + SmartDashboard.putBoolean("Bool/Arcade Drive", !Robot.getBool("Arcade Drive", true)); |
42 | 22 | } |
43 | 23 |
|
44 | | - // Called when another command which requires one or more of the same |
45 | | - // subsystems is scheduled to run |
46 | | - protected void interrupted() { |
47 | | - end(); |
48 | | - } |
49 | 24 | } |
0 commit comments