Fix gear ports, swap low/high trigger
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / OI.java
index 997be71cdbe551afe2477d093f6172a28c1cfe26..2412a36db7000f2a96f12bdf507bcb81dc7e6e76 100644 (file)
@@ -1,14 +1,94 @@
 package org.usfirst.frc.team3501.robot;
 
+import org.usfirst.frc.team3501.robot.Constants.IntakeArm;
+import org.usfirst.frc.team3501.robot.commands.driving.SetHighGear;
+import org.usfirst.frc.team3501.robot.commands.driving.SetLowGear;
+import org.usfirst.frc.team3501.robot.commands.driving.ToggleFront;
+import org.usfirst.frc.team3501.robot.commands.intakearm.MoveIntakeArm;
+import org.usfirst.frc.team3501.robot.commands.intakearm.RunIntake;
+import org.usfirst.frc.team3501.robot.commands.shooter.FireCatapult;
+import org.usfirst.frc.team3501.robot.commands.shooter.ResetCatapult;
+
 import edu.wpi.first.wpilibj.Joystick;
+import edu.wpi.first.wpilibj.buttons.Button;
+import edu.wpi.first.wpilibj.buttons.JoystickButton;
 
 public class OI {
   public static Joystick leftJoystick;
   public static Joystick rightJoystick;
 
+  // left joystick buttons
+  public static Button gearShift;
+  public static Button extendIntake1;
+  public static Button extendIntake2;
+  public static Button retractIntake1;
+  public static Button retractIntake2;
+  public static Button toggleFront;
+
+  // right joystick buttons
+  public static Button intake;
+  public static Button outtake1;
+  public static Button outtake2;
+  public static Button shooterUp;
+  public static Button shooterDown1;
+  public static Button shooterDown2;
+
   public OI() {
     leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT);
     rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT);
 
+    // Left joystick
+    gearShift = new JoystickButton(leftJoystick,
+        Constants.OI.LEFT_JOYSTICK_GEAR_SHIFT_PORT);
+    gearShift.whenPressed(new SetHighGear());
+    gearShift.whenReleased(new SetLowGear());
+
+    extendIntake1 = new JoystickButton(leftJoystick,
+        Constants.OI.LEFT_JOYSTICK_EXTEND_INTAKE_1_PORT);
+    extendIntake1.whenPressed(new MoveIntakeArm(IntakeArm.EXTEND));
+
+    extendIntake2 = new JoystickButton(leftJoystick,
+        Constants.OI.LEFT_JOYSTICK_EXTEND_INTAKE_2_PORT);
+    extendIntake2.whenPressed(new MoveIntakeArm(IntakeArm.EXTEND));
+
+    retractIntake1 = new JoystickButton(leftJoystick,
+        Constants.OI.LEFT_JOYSTICK_RETRACT_INTAKE_1_PORT);
+    retractIntake1.whenPressed(new MoveIntakeArm(IntakeArm.RETRACT));
+
+    retractIntake2 = new JoystickButton(leftJoystick,
+        Constants.OI.LEFT_JOYSTICK_RETRACT_INTAKE_2_PORT);
+    retractIntake2.whenPressed(new MoveIntakeArm(IntakeArm.RETRACT));
+
+    toggleFront = new JoystickButton(leftJoystick,
+        Constants.OI.LEFT_JOYSTICK_TOGGLE_FRONT_PORT);
+    toggleFront.whenPressed(new ToggleFront());
+
+    // Right joystick
+    intake = new JoystickButton(rightJoystick,
+        Constants.OI.RIGHT_JOYSTICK_INTAKE_PORT);
+    intake.whenPressed(new RunIntake(IntakeArm.IN));
+    intake.whenReleased(new RunIntake(IntakeArm.STOP));
+
+    outtake1 = new JoystickButton(rightJoystick,
+        Constants.OI.RIGHT_JOYSTICK_OUTTAKE_1_PORT);
+    outtake1.whenPressed(new RunIntake(IntakeArm.OUT));
+    outtake1.whenReleased(new RunIntake(IntakeArm.STOP));
+
+    outtake2 = new JoystickButton(rightJoystick,
+        Constants.OI.RIGHT_JOYSTICK_OUTTAKE_2_PORT);
+    outtake2.whenPressed(new RunIntake(IntakeArm.OUT));
+    outtake2.whenReleased(new RunIntake(IntakeArm.STOP));
+
+    shooterUp = new JoystickButton(rightJoystick,
+        Constants.OI.RIGHT_JOYSTICK_SHOOTER_UP_PORT);
+    shooterUp.whenPressed(new FireCatapult());
+
+    shooterDown1 = new JoystickButton(rightJoystick,
+        Constants.OI.RIGHT_JOYSTICK_SHOOTER_DOWN_1_PORT);
+    shooterDown1.whenPressed(new ResetCatapult());
+
+    shooterDown2 = new JoystickButton(rightJoystick,
+        Constants.OI.RIGHT_JOYSTICK_SHOOTER_DOWN_2_PORT);
+    shooterDown2.whenPressed(new ResetCatapult());
   }
 }