Commit | Line | Data |
---|---|---|
f43a1c52 CZ |
1 | package org.usfirst.frc.team3501.robot.commands.driving; |
2 | ||
dfb792a1 | 3 | import org.usfirst.frc.team3501.robot.Constants; |
f43a1c52 | 4 | import org.usfirst.frc.team3501.robot.Robot; |
dfb792a1 | 5 | import org.usfirst.frc.team3501.robot.subsystems.DriveTrain; |
f43a1c52 | 6 | |
0704e870 | 7 | import edu.wpi.first.wpilibj.DoubleSolenoid.Value; |
f43a1c52 CZ |
8 | import edu.wpi.first.wpilibj.command.Command; |
9 | ||
10 | /** | |
0704e870 | 11 | * This command toggles the gear(low or high). |
f43a1c52 CZ |
12 | * |
13 | * post-condition: if the drivetrain is running at high gear, it will be made to | |
14 | * run at low gear, and vice versa | |
15 | */ | |
fc01fb0f | 16 | public class ToggleDriveGear extends Command { |
dfb792a1 | 17 | DriveTrain driveTrain = Robot.getDriveTrain(); |
f43a1c52 | 18 | |
fc01fb0f | 19 | public ToggleDriveGear() { |
dfb792a1 | 20 | requires(driveTrain); |
f43a1c52 CZ |
21 | } |
22 | ||
f43a1c52 CZ |
23 | @Override |
24 | protected void initialize() { | |
0704e870 | 25 | |
f43a1c52 CZ |
26 | } |
27 | ||
f43a1c52 CZ |
28 | @Override |
29 | protected void execute() { | |
fc01fb0f | 30 | Value rightPistonValue = driveTrain.getRightDriveTrainPiston(); |
150f450f | 31 | System.out.println("I think i'm at " + rightPistonValue); |
9ca89e45 | 32 | if (rightPistonValue == Constants.DriveTrain.REVERSE_PISTON_VALUE) { |
dfb792a1 | 33 | driveTrain.setHighGear(); |
0704e870 | 34 | } else { |
dfb792a1 | 35 | driveTrain.setLowGear(); |
0704e870 | 36 | } |
150f450f CZ |
37 | // boolean leftPistonValue = driveTrain.getLeftDriveTrainPiston(); |
38 | // if (leftPistonValue == Constants.DriveTrain.RETRACT_VALUE) { | |
39 | // driveTrain.setHighGear(); | |
40 | // } else { | |
41 | // driveTrain.setLowGear(); | |
42 | // } | |
f43a1c52 CZ |
43 | } |
44 | ||
f43a1c52 CZ |
45 | @Override |
46 | protected boolean isFinished() { | |
dfb792a1 | 47 | return true; |
f43a1c52 CZ |
48 | } |
49 | ||
f43a1c52 CZ |
50 | @Override |
51 | protected void end() { | |
52 | } | |
53 | ||
f43a1c52 CZ |
54 | @Override |
55 | protected void interrupted() { | |
56 | } | |
57 | } |