| 1 | package org.usfirst.frc.team3501.robot; |
| 2 | |
| 3 | import org.usfirst.frc.team3501.robot.commands.driving.BrakeCANTalons; |
| 4 | import org.usfirst.frc.team3501.robot.commands.driving.CoastCANTalons; |
| 5 | import org.usfirst.frc.team3501.robot.commands.driving.ToggleGear; |
| 6 | import org.usfirst.frc.team3501.robot.commands.intake.ReverseIntakeContinuous; |
| 7 | import org.usfirst.frc.team3501.robot.commands.intake.RunIntakeContinuous; |
| 8 | import org.usfirst.frc.team3501.robot.commands.shooter.DecreaseShootingSpeed; |
| 9 | import org.usfirst.frc.team3501.robot.commands.shooter.IncreaseShootingSpeed; |
| 10 | import org.usfirst.frc.team3501.robot.commands.shooter.ReverseIndexWheelContinuous; |
| 11 | import org.usfirst.frc.team3501.robot.commands.shooter.RunFlyWheelContinuous; |
| 12 | import org.usfirst.frc.team3501.robot.commands.shooter.RunIndexWheelContinuous; |
| 13 | |
| 14 | import edu.wpi.first.wpilibj.Joystick; |
| 15 | import edu.wpi.first.wpilibj.buttons.Button; |
| 16 | import edu.wpi.first.wpilibj.buttons.JoystickButton; |
| 17 | |
| 18 | public class OI { |
| 19 | private static OI oi; |
| 20 | public static Joystick leftJoystick; |
| 21 | public static Joystick rightJoystick; |
| 22 | |
| 23 | public static Button runIndexWheel; |
| 24 | public static Button reverseIndexWheel; |
| 25 | public static Button toggleFlyWheel; |
| 26 | |
| 27 | public static Button toggleGear; |
| 28 | |
| 29 | public static Button runIntake; |
| 30 | public static Button reverseIntake; |
| 31 | |
| 32 | public static Button increaseShooterSpeed; |
| 33 | public static Button decreaseShooterSpeed; |
| 34 | |
| 35 | public static Button brakeCANTalons; |
| 36 | public static Button coastCANTalons; |
| 37 | |
| 38 | public OI() { |
| 39 | leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT); |
| 40 | rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT); |
| 41 | |
| 42 | runIndexWheel = new JoystickButton(rightJoystick, |
| 43 | Constants.OI.RUN_INDEXWHEEL_PORT); |
| 44 | runIndexWheel.whileHeld(new RunIndexWheelContinuous()); |
| 45 | |
| 46 | reverseIndexWheel = new JoystickButton(rightJoystick, |
| 47 | Constants.OI.REVERSE_INDEXWHEEL_PORT); |
| 48 | reverseIndexWheel.whileHeld(new ReverseIndexWheelContinuous()); |
| 49 | |
| 50 | toggleFlyWheel = new JoystickButton(rightJoystick, |
| 51 | Constants.OI.TOGGLE_FLYWHEEL_PORT); |
| 52 | toggleFlyWheel.toggleWhenPressed(new RunFlyWheelContinuous()); |
| 53 | |
| 54 | toggleGear = new JoystickButton(leftJoystick, |
| 55 | Constants.OI.TOGGLE_GEAR_PORT); |
| 56 | toggleGear.whenPressed(new ToggleGear()); |
| 57 | |
| 58 | runIntake = new JoystickButton(leftJoystick, Constants.OI.RUN_INTAKE_PORT); |
| 59 | runIntake.whileHeld(new RunIntakeContinuous()); |
| 60 | |
| 61 | reverseIntake = new JoystickButton(leftJoystick, |
| 62 | Constants.OI.REVERSE_INTAKE_PORT); |
| 63 | reverseIntake.whileHeld(new ReverseIntakeContinuous()); |
| 64 | |
| 65 | increaseShooterSpeed = new JoystickButton(leftJoystick, |
| 66 | Constants.OI.INCREASE_SHOOTER_SPEED_PORT); |
| 67 | increaseShooterSpeed.whenPressed(new IncreaseShootingSpeed()); |
| 68 | |
| 69 | decreaseShooterSpeed = new JoystickButton(leftJoystick, |
| 70 | Constants.OI.DECREASE_SHOOTER_SPEED_PORT); |
| 71 | decreaseShooterSpeed.whenPressed(new DecreaseShootingSpeed()); |
| 72 | |
| 73 | brakeCANTalons = new JoystickButton(rightJoystick, |
| 74 | Constants.OI.BRAKE_CANTALONS_PORT); |
| 75 | brakeCANTalons.whenPressed(new BrakeCANTalons()); |
| 76 | |
| 77 | coastCANTalons = new JoystickButton(rightJoystick, |
| 78 | Constants.OI.COAST_CANTALONS_PORT); |
| 79 | coastCANTalons.whenPressed(new CoastCANTalons()); |
| 80 | } |
| 81 | |
| 82 | public static OI getOI() { |
| 83 | if (oi == null) |
| 84 | oi = new OI(); |
| 85 | return oi; |
| 86 | } |
| 87 | } |