| 1 | package org.usfirst.frc.team3501.robot; |
| 2 | |
| 3 | import org.usfirst.frc.team3501.robot.commands.climber.ToggleWinch; |
| 4 | import org.usfirst.frc.team3501.robot.commands.driving.ToggleGear; |
| 5 | import org.usfirst.frc.team3501.robot.commands.intake.ReverseIntakeContinuous; |
| 6 | import org.usfirst.frc.team3501.robot.commands.intake.RunIntakeContinuous; |
| 7 | import org.usfirst.frc.team3501.robot.commands.shooter.ReverseIndexWheelContinuous; |
| 8 | import org.usfirst.frc.team3501.robot.commands.shooter.RunFlyWheelContinuous; |
| 9 | import org.usfirst.frc.team3501.robot.commands.shooter.RunIndexWheelContinuous; |
| 10 | |
| 11 | import edu.wpi.first.wpilibj.Joystick; |
| 12 | import edu.wpi.first.wpilibj.buttons.Button; |
| 13 | import edu.wpi.first.wpilibj.buttons.JoystickButton; |
| 14 | |
| 15 | public class OI { |
| 16 | private static OI oi; |
| 17 | public static Joystick leftJoystick; |
| 18 | public static Joystick rightJoystick; |
| 19 | public static Button toggleWinch; |
| 20 | |
| 21 | public static Button runIndexWheel; |
| 22 | public static Button reverseIndexWheel; |
| 23 | public static Button toggleFlyWheel; |
| 24 | |
| 25 | public static Button toggleGear; |
| 26 | |
| 27 | public static Button runIntake; |
| 28 | public static Button reverseIntake; |
| 29 | |
| 30 | public OI() { |
| 31 | leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT); |
| 32 | rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT); |
| 33 | |
| 34 | runIndexWheel = new JoystickButton(leftJoystick, |
| 35 | Constants.OI.TOGGLE_INDEXWHEEL_PORT); |
| 36 | runIndexWheel.whileHeld(new RunIndexWheelContinuous()); |
| 37 | |
| 38 | reverseIndexWheel = new JoystickButton(leftJoystick, |
| 39 | Constants.OI.REVERSE_INDEXWHEEL_PORT); |
| 40 | reverseIndexWheel.whileHeld(new ReverseIndexWheelContinuous()); |
| 41 | |
| 42 | toggleFlyWheel = new JoystickButton(leftJoystick, |
| 43 | Constants.OI.TOGGLE_FLYWHEEL_PORT); |
| 44 | toggleFlyWheel.toggleWhenPressed(new RunFlyWheelContinuous()); |
| 45 | |
| 46 | toggleGear = new JoystickButton(leftJoystick, |
| 47 | Constants.OI.TOGGLE_GEAR_PORT); |
| 48 | toggleGear.whenPressed(new ToggleGear()); |
| 49 | |
| 50 | runIntake = new JoystickButton(leftJoystick, |
| 51 | Constants.OI.TOGGLE_INTAKE_PORT); |
| 52 | runIntake.whileHeld(new RunIntakeContinuous()); |
| 53 | |
| 54 | reverseIntake = new JoystickButton(leftJoystick, |
| 55 | Constants.OI.REVERSE_INTAKE_PORT); |
| 56 | reverseIntake.whileHeld(new ReverseIntakeContinuous()); |
| 57 | |
| 58 | toggleWinch = new JoystickButton(leftJoystick, |
| 59 | Constants.OI.TOGGLE_WINCH_PORT); |
| 60 | toggleWinch.whenPressed(new ToggleWinch()); |
| 61 | } |
| 62 | |
| 63 | public static OI getOI() { |
| 64 | if (oi == null) |
| 65 | oi = new OI(); |
| 66 | return oi; |
| 67 | } |
| 68 | } |