Add buttons to move intake arm.
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / OI.java
index 07c47e8405422f77149aa54fabaf7c0cc81b0559..75d6beff8c93e9e2de828ffe662fdf230f1045a1 100644 (file)
@@ -2,6 +2,8 @@ package org.usfirst.frc.team3501.robot;
 
 import org.usfirst.frc.team3501.robot.commands.driving.ChangeGear;
 import org.usfirst.frc.team3501.robot.commands.shooter.Shoot;
+import org.usfirst.frc.team3501.robot.commands.intakearm.RunBothIntakeMotors;
+import org.usfirst.frc.team3501.robot.commands.intakearm.RunIntakeMotor;
 
 import edu.wpi.first.wpilibj.Joystick;
 import edu.wpi.first.wpilibj.buttons.Button;
@@ -11,33 +13,40 @@ public class OI {
   public static Joystick leftJoystick;
   public static Joystick rightJoystick;
 
-  // first column of arcade buttons - getting past defenses
-  public static DigitalButton passPortcullis;
-  public static DigitalButton passChevalDeFrise;
-  public static DigitalButton passDrawbridge;
-  public static DigitalButton passSallyPort;
-
-  // second column of arcade buttons - different angles for intake arm
-  // TO DO: change position numbers to angle values (?)
-  public static DigitalButton lowerChevalDeFrise;
-  public static DigitalButton moveToIntakeBoulder;
-  public static DigitalButton poiseAboveChevalDeFrise;
-  public static DigitalButton moveIntakeArmInsideRobot;
-
-  // left joystick buttons
-  public static Button toggleShooter;
-  public static Button SpinRobot180_1; // both do the same thing, just two
-  public static Button SpinRobot180_2; // different buttons
-  public static Button compactRobot_1;
-  public static Button compactRobot_2;
+  public static Button leftIntakeArmMotorUp;
+  public static Button leftIntakeArmMotorDown;
+  public static Button rightIntakeArmMotorUp;
+  public static Button rightIntakeArmMotorDown;
+  public static Button bothIntakeArmMotorUp;
+  public static Button bothIntakeArmMotorDown;
 
+  // // first column of arcade buttons - getting past defenses
+  // public static DigitalButton passPortcullis;
+  // public static DigitalButton passChevalDeFrise;
+  // public static DigitalButton passDrawbridge;
+  // public static DigitalButton passSallyPort;
+  //
+  // // second column of arcade buttons - different angles for intake arm
+  // // TO DO: change position numbers to angle values (?)
+  // public static DigitalButton lowerChevalDeFrise;
+  // public static DigitalButton moveToIntakeBoulder;
+  // public static DigitalButton poiseAboveChevalDeFrise;
+  // public static DigitalButton moveIntakeArmInsideRobot;
+  //
+  // // left joystick buttons
+  // public static Button toggleShooter;
+  // public static Button SpinRobot180_1; // both do the same thing, just two
+  // public static Button SpinRobot180_2; // different buttons
+  // public static Button compactRobot_1;
+  // public static Button compactRobot_2;
+  //
   // right joystick buttons
   public static Button intakeBoulder;
   public static Button shootBoulder;
   public static Button toggleGear;
-
-  // button to change robot to the scaling mode
-  public static DigitalButton toggleScaling;
+  //
+  // // button to change robot to the scaling mode
+  // public static DigitalButton toggleScaling;
 
   public OI() {
     leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT);
@@ -51,6 +60,50 @@ public class OI {
         Constants.OI.LEFT_JOYSTICK_TRIGGER_PORT);
     shootBoulder.whenPressed(new Shoot());
 
+    recordPotAngle1 = new JoystickButton(leftJoystick,
+        Constants.OI.LEFT_JOYSTICK_TOP_LEFT_BUTTON);
+    recordPotAngle1.whenPressed(new RecordPotAngle(0));
+    recordPotAngle2 = new JoystickButton(leftJoystick,
+        Constants.OI.LEFT_JOYSTICK_TOP_CENTER_BUTTON);
+    recordPotAngle2.whenPressed(new RecordPotAngle(1));
+    recordPotAngle3 = new JoystickButton(leftJoystick,
+        Constants.OI.LEFT_JOYSTICK_TOP_RIGHT_BUTTON);
+    recordPotAngle3.whenPressed(new RecordPotAngle(2));
+    recordPotAngle4 = new JoystickButton(leftJoystick,
+        Constants.OI.LEFT_JOYSTICK_TOP_LOW_BUTTON);
+    recordPotAngle4.whenPressed(new RecordPotAngle(3));
+
+    leftIntakeArmMotorUp = new JoystickButton(leftJoystick,
+        Constants.OI.LEFT_JOYSTICK_BOTTOM_LEFT_FORWARD_BUTTON);
+    leftIntakeArmMotorUp.whenPressed(new RunIntakeMotor(
+        Robot.intakeArm.getLeftIntakeArmMotor(),
+        Constants.IntakeArm.DEFAULT_INTAKE_ARM_SPEED));
+    leftIntakeArmMotorDown = new JoystickButton(leftJoystick,
+        Constants.OI.LEFT_JOYSTICK_BOTTOM_LEFT_BACK_BUTTON);
+    leftIntakeArmMotorDown.whenPressed(new RunIntakeMotor(
+        Robot.intakeArm.getLeftIntakeArmMotor(),
+        -Constants.IntakeArm.DEFAULT_INTAKE_ARM_SPEED));
+
+    rightIntakeArmMotorUp = new JoystickButton(leftJoystick,
+        Constants.OI.LEFT_JOYSTICK_BOTTOM_RIGHT_FORWARD_BUTTON);
+    rightIntakeArmMotorUp.whenPressed(new RunIntakeMotor(
+        Robot.intakeArm.getRightIntakeArmMotor(),
+        Constants.IntakeArm.DEFAULT_INTAKE_ARM_SPEED));
+    rightIntakeArmMotorDown = new JoystickButton(leftJoystick,
+        Constants.OI.LEFT_JOYSTICK_BOTTOM_RIGHT_BACK_BUTTON);
+    rightIntakeArmMotorDown.whenPressed(new RunIntakeMotor(
+        Robot.intakeArm.getRightIntakeArmMotor(),
+        -Constants.IntakeArm.DEFAULT_INTAKE_ARM_SPEED));
+
+    bothIntakeArmMotorUp = new JoystickButton(leftJoystick,
+        Constants.OI.LEFT_JOYSTICK_BOTTOM_BACK_LEFT_BUTTON);
+    bothIntakeArmMotorUp.whenPressed(new RunBothIntakeMotors(
+        Constants.IntakeArm.DEFAULT_INTAKE_ARM_SPEED));
+    bothIntakeArmMotorDown = new JoystickButton(leftJoystick,
+        Constants.OI.LEFT_JOYSTICK_BOTTOM_BACK_RIGHT_BUTTON);
+    bothIntakeArmMotorDown.whenPressed(new RunBothIntakeMotors(
+        -Constants.IntakeArm.DEFAULT_INTAKE_ARM_SPEED));
+
     // passPortcullis = new DigitalButton(
     // new DigitalInput(Constants.OI.PASS_PORTCULLIS_PORT));
     // passPortcullis.whenPressed(new PassPortcullis());