Add JoystickButton objects and constants for Drivetrain, Climer, Intake, and Shooter
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / OI.java
index 00186000ceb5768b3f0a95a03ba80f3f87105d1c..8b5cdacb84b0a96ea8be573add14da2e85042ef7 100644 (file)
@@ -1,5 +1,7 @@
 package org.usfirst.frc.team3501.robot;
 
+import org.usfirst.frc.team3501.robot.commands.climber.MaintainClimbedPosition;
+import org.usfirst.frc.team3501.robot.commands.climber.RunWinchContinuous;
 import org.usfirst.frc.team3501.robot.commands.climber.ToggleWinch;
 import org.usfirst.frc.team3501.robot.commands.driving.ToggleGear;
 import org.usfirst.frc.team3501.robot.commands.intake.ReverseIntakeContinuous;
@@ -19,6 +21,7 @@ public class OI {
   public static Joystick leftJoystick;
   public static Joystick rightJoystick;
   public static Button toggleWinch;
+  private boolean isClimbing = false;
 
   public static Button runIndexWheel;
   public static Button reverseIndexWheel;
@@ -72,6 +75,14 @@ public class OI {
     decreaseShooterSpeed = new JoystickButton(leftJoystick,
         Constants.OI.DECREASE_SHOOTER_SPEED_PORT);
     decreaseShooterSpeed.whenPressed(new DecreaseShootingSpeed());
+
+    if (!isClimbing) {
+      toggleWinch.whenPressed(new RunWinchContinuous());
+      isClimbing = true;
+    } else {
+      toggleWinch.whenPressed(new MaintainClimbedPosition());
+      isClimbing = false;
+    }
   }
 
   public static OI getOI() {