8e69124a247935dd794f638b03c9600afc6954ed
1 package org
.usfirst
.frc
.team3501
.robot
.commands
.driving
;
3 import org
.usfirst
.frc
.team3501
.robot
.Constants
.DriveTrain
;
4 import org
.usfirst
.frc
.team3501
.robot
.Robot
;
6 import edu
.wpi
.first
.wpilibj
.DoubleSolenoid
.Value
;
7 import edu
.wpi
.first
.wpilibj
.command
.Command
;
10 * This command toggles the gear(low or high).
12 * post-condition: if the drivetrain is running at high gear, it will be made to
13 * run at low gear, and vice versa
15 public class ToggleGear
extends Command
{
18 requires(Robot
.getDriveTrain());
22 // Called just before this Command runs the first time
24 protected void initialize() {
28 // Called repeatedly when this Command is scheduled to run
30 protected void execute() {
31 Value gearPistonValue
= Robot
.getDriveTrain().getGearPistonValue();
32 if (gearPistonValue
== DriveTrain
.LOW_GEAR
) {
33 Robot
.getDriveTrain().setHighGear();
35 Robot
.getDriveTrain().setLowGear();
39 // Make this return true when this Command no longer needs to run execute()
41 protected boolean isFinished() {
45 // Called once after isFinished returns true
47 protected void end() {
50 // Called when another command which requires one or more of the same
51 // subsystems is scheduled to run
53 protected void interrupted() {