Add code for toggleDrivePiston
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / commands / driving / ToggleDrivePiston.java
1 package org.usfirst.frc.team3501.robot.commands.driving;
2
3 import org.usfirst.frc.team3501.robot.Constants;
4 import org.usfirst.frc.team3501.robot.Robot;
5 import org.usfirst.frc.team3501.robot.subsystems.DriveTrain;
6 import edu.wpi.first.wpilibj.command.Command;
7
8 public class ToggleDrivePiston extends Command {
9 private DriveTrain driveTrain = Robot.getDriveTrain();
10
11 /**
12 * See JavaDoc comment in class for details
13 *
14 * @param motorVal
15 * value range from -1 to 1
16 */
17 public ToggleDrivePiston() {
18 requires(driveTrain);
19 }
20
21 // Called just before this Command runs the first time
22 @Override
23 protected void initialize() {
24 }
25
26 // Called repeatedly when this Command is scheduled to run
27 @Override
28 protected void execute() {
29 if (DriveTrain.getDriveTrain()
30 .getLeftGearPistonValue() == Constants.DriveTrain.HIGH_GEAR) {
31 DriveTrain.getDriveTrain().setLowGear();
32 } else {
33 DriveTrain.getDriveTrain().setHighGear();
34 }
35
36 // check to make sure that both pistons are set to the same gear. Otherwise,
37 // the code must be changed
38 }
39
40 // Called once after isFinished returns true
41 @Override
42 protected void end() {
43 }
44
45 // Called when another command which requires one or more of the same
46 // subsystems is scheduled to run
47 @Override
48 protected void interrupted() {
49 end();
50 }
51
52 @Override
53 protected boolean isFinished() {
54 return false;
55
56 }
57
58 }