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

Commit 6d43455

Browse files
committed
changed shiftddrivetype to an instantcommand
1 parent 4930d79 commit 6d43455

1 file changed

Lines changed: 5 additions & 30 deletions

File tree

Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/ShiftDriveType.java

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,23 @@
22

33
import org.usfirst.frc.team199.Robot2018.Robot;
44

5-
import edu.wpi.first.wpilibj.Timer;
6-
import edu.wpi.first.wpilibj.command.Command;
5+
import edu.wpi.first.wpilibj.command.InstantCommand;
76
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
87

98
/**
109
*
1110
*/
12-
public class ShiftDriveType extends Command {
13-
14-
Timer tim;
15-
boolean arcadeDrive;
11+
public class ShiftDriveType extends InstantCommand {
1612

1713
public ShiftDriveType() {
14+
super();
1815
// Use requires() here to declare subsystem dependencies
1916
// eg. requires(chassis);
2017
}
2118

22-
// Called just before this Command runs the first time
19+
// Called once when the command executes
2320
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));
4222
}
4323

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-
}
4924
}

0 commit comments

Comments
 (0)