1 package org
.usfirst
.frc
.team3501
.robot
.commands
.driving
;
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
;
7 import edu
.wpi
.first
.wpilibj
.DoubleSolenoid
.Value
;
8 import edu
.wpi
.first
.wpilibj
.command
.Command
;
11 * This command toggles the gear(low or high).
13 * post-condition: if the drivetrain is running at high gear, it will be made to
14 * run at low gear, and vice versa
16 public class ToggleGear
extends Command
{
17 DriveTrain driveTrain
= Robot
.getDriveTrain();
24 protected void initialize() {
29 protected void execute() {
30 Value leftGearPistonValue
= driveTrain
.getLeftGearPistonValue();
31 Value rightGearPistonValue
= driveTrain
.getRightGearPistonValue();
33 if (leftGearPistonValue
== Constants
.DriveTrain
.LOW_GEAR
) {
34 driveTrain
.setHighGear(driveTrain
.getLeftPiston());
36 driveTrain
.setLowGear(driveTrain
.getLeftPiston());
39 if (rightGearPistonValue
== Constants
.DriveTrain
.LOW_GEAR
) {
40 driveTrain
.setHighGear(driveTrain
.getRightPiston());
42 driveTrain
.setLowGear(driveTrain
.getRightPiston());
48 protected boolean isFinished() {
53 protected void end() {
57 protected void interrupted() {