| 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 | |
| 6 | import edu.wpi.first.wpilibj.DoubleSolenoid.Value; |
| 7 | import edu.wpi.first.wpilibj.command.Command; |
| 8 | |
| 9 | /** |
| 10 | * |
| 11 | */ |
| 12 | public class ChangeGear extends Command { |
| 13 | |
| 14 | public ChangeGear() { |
| 15 | // Doesn't require drivetrain because change can be made while robot is |
| 16 | // driving |
| 17 | } |
| 18 | |
| 19 | @Override |
| 20 | protected void initialize() { |
| 21 | Value gear = Robot.driveTrain.getLeftGearPistonValue(); // Gears are assumed |
| 22 | // to be the same |
| 23 | Value opposite = (gear == Constants.DriveTrain.HIGH_GEAR) ? Constants.DriveTrain.LOW_GEAR |
| 24 | : Constants.DriveTrain.HIGH_GEAR; |
| 25 | Robot.driveTrain.changeGear(opposite); |
| 26 | } |
| 27 | |
| 28 | @Override |
| 29 | protected void execute() { |
| 30 | } |
| 31 | |
| 32 | @Override |
| 33 | protected boolean isFinished() { |
| 34 | return true; |
| 35 | } |
| 36 | |
| 37 | @Override |
| 38 | protected void end() { |
| 39 | } |
| 40 | |
| 41 | @Override |
| 42 | protected void interrupted() { |
| 43 | end(); |
| 44 | } |
| 45 | } |