| 1 | package org.usfirst.frc.team3501.robot; |
| 2 | |
| 3 | import org.usfirst.frc.team3501.robot.Constants.IntakeArm; |
| 4 | import org.usfirst.frc.team3501.robot.commands.driving.SetHighGear; |
| 5 | import org.usfirst.frc.team3501.robot.commands.driving.SetLowGear; |
| 6 | import org.usfirst.frc.team3501.robot.commands.driving.ToggleFront; |
| 7 | import org.usfirst.frc.team3501.robot.commands.intakearm.MoveIntakeArm; |
| 8 | import org.usfirst.frc.team3501.robot.commands.intakearm.RunIntake; |
| 9 | import org.usfirst.frc.team3501.robot.commands.shooter.FireCatapult; |
| 10 | import org.usfirst.frc.team3501.robot.commands.shooter.ResetCatapult; |
| 11 | |
| 12 | import edu.wpi.first.wpilibj.Joystick; |
| 13 | import edu.wpi.first.wpilibj.buttons.Button; |
| 14 | import edu.wpi.first.wpilibj.buttons.JoystickButton; |
| 15 | |
| 16 | public class OI { |
| 17 | public static Joystick leftJoystick; |
| 18 | public static Joystick rightJoystick; |
| 19 | |
| 20 | // left joystick buttons |
| 21 | public static Button gearShift; |
| 22 | public static Button extendIntake1; |
| 23 | public static Button extendIntake2; |
| 24 | public static Button retractIntake1; |
| 25 | public static Button retractIntake2; |
| 26 | public static Button toggleFront; |
| 27 | |
| 28 | // right joystick buttons |
| 29 | public static Button intake; |
| 30 | public static Button outtake1; |
| 31 | public static Button outtake2; |
| 32 | public static Button shooterUp; |
| 33 | public static Button shooterDown1; |
| 34 | public static Button shooterDown2; |
| 35 | |
| 36 | public OI() { |
| 37 | leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT); |
| 38 | rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT); |
| 39 | |
| 40 | // Left joystick |
| 41 | gearShift = new JoystickButton(leftJoystick, |
| 42 | Constants.OI.LEFT_JOYSTICK_GEAR_SHIFT_PORT); |
| 43 | gearShift.whenPressed(new SetHighGear()); |
| 44 | gearShift.whenReleased(new SetLowGear()); |
| 45 | |
| 46 | extendIntake1 = new JoystickButton(leftJoystick, |
| 47 | Constants.OI.LEFT_JOYSTICK_EXTEND_INTAKE_1_PORT); |
| 48 | extendIntake1.whenPressed(new MoveIntakeArm(IntakeArm.EXTEND)); |
| 49 | |
| 50 | extendIntake2 = new JoystickButton(leftJoystick, |
| 51 | Constants.OI.LEFT_JOYSTICK_EXTEND_INTAKE_2_PORT); |
| 52 | extendIntake2.whenPressed(new MoveIntakeArm(IntakeArm.EXTEND)); |
| 53 | |
| 54 | retractIntake1 = new JoystickButton(leftJoystick, |
| 55 | Constants.OI.LEFT_JOYSTICK_RETRACT_INTAKE_1_PORT); |
| 56 | retractIntake1.whenPressed(new MoveIntakeArm(IntakeArm.RETRACT)); |
| 57 | |
| 58 | retractIntake2 = new JoystickButton(leftJoystick, |
| 59 | Constants.OI.LEFT_JOYSTICK_RETRACT_INTAKE_2_PORT); |
| 60 | retractIntake2.whenPressed(new MoveIntakeArm(IntakeArm.RETRACT)); |
| 61 | |
| 62 | toggleFront = new JoystickButton(leftJoystick, |
| 63 | Constants.OI.LEFT_JOYSTICK_TOGGLE_FRONT_PORT); |
| 64 | toggleFront.whenPressed(new ToggleFront()); |
| 65 | |
| 66 | // Right joystick |
| 67 | intake = new JoystickButton(rightJoystick, |
| 68 | Constants.OI.RIGHT_JOYSTICK_INTAKE_PORT); |
| 69 | intake.whenPressed(new RunIntake(IntakeArm.IN)); |
| 70 | intake.whenReleased(new RunIntake(IntakeArm.STOP)); |
| 71 | |
| 72 | outtake1 = new JoystickButton(rightJoystick, |
| 73 | Constants.OI.RIGHT_JOYSTICK_OUTTAKE_1_PORT); |
| 74 | outtake1.whenPressed(new RunIntake(IntakeArm.OUT)); |
| 75 | outtake1.whenReleased(new RunIntake(IntakeArm.STOP)); |
| 76 | |
| 77 | outtake2 = new JoystickButton(rightJoystick, |
| 78 | Constants.OI.RIGHT_JOYSTICK_OUTTAKE_2_PORT); |
| 79 | outtake2.whenPressed(new RunIntake(IntakeArm.OUT)); |
| 80 | outtake2.whenReleased(new RunIntake(IntakeArm.STOP)); |
| 81 | |
| 82 | shooterUp = new JoystickButton(rightJoystick, |
| 83 | Constants.OI.RIGHT_JOYSTICK_SHOOTER_UP_PORT); |
| 84 | shooterUp.whenPressed(new FireCatapult()); |
| 85 | |
| 86 | shooterDown1 = new JoystickButton(rightJoystick, |
| 87 | Constants.OI.RIGHT_JOYSTICK_SHOOTER_DOWN_1_PORT); |
| 88 | shooterDown1.whenPressed(new ResetCatapult()); |
| 89 | |
| 90 | shooterDown2 = new JoystickButton(rightJoystick, |
| 91 | Constants.OI.RIGHT_JOYSTICK_SHOOTER_DOWN_2_PORT); |
| 92 | shooterDown2.whenPressed(new ResetCatapult()); |
| 93 | } |
| 94 | } |