| 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 | import org.usfirst.frc.team3501.robot.commands.shooter.ToggleIndexerPiston; |
| 14 | import org.usfirst.frc.team3501.robot.utils.ChangeCameraView; |
| 15 | |
| 16 | import edu.wpi.first.wpilibj.Joystick; |
| 17 | import edu.wpi.first.wpilibj.buttons.Button; |
| 18 | import edu.wpi.first.wpilibj.buttons.JoystickButton; |
| 19 | |
| 20 | public class OI /* implements KeyListener */ { |
| 21 | private static OI oi; |
| 22 | public static Joystick leftJoystick; |
| 23 | public static Joystick rightJoystick; |
| 24 | |
| 25 | public static Button runIndexWheel; |
| 26 | public static Button reverseIndexWheel; |
| 27 | public static Button toggleFlyWheel; |
| 28 | |
| 29 | public static Button toggleGear; |
| 30 | |
| 31 | public static Button runIntake; |
| 32 | public static Button reverseIntake; |
| 33 | |
| 34 | public static Button increaseShooterSpeed; |
| 35 | public static Button decreaseShooterSpeed; |
| 36 | |
| 37 | private static Button changeCam; |
| 38 | |
| 39 | private static Button togglePiston; |
| 40 | private static Button toggleDriveTrainPiston; |
| 41 | |
| 42 | public static Button brakeCANTalons; |
| 43 | public static Button coastCANTalons; |
| 44 | |
| 45 | public OI() { |
| 46 | |
| 47 | leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT); |
| 48 | rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT); |
| 49 | |
| 50 | runIndexWheel = new JoystickButton(rightJoystick, |
| 51 | Constants.OI.RUN_INDEXWHEEL_PORT); |
| 52 | runIndexWheel.whileHeld(new RunIndexWheelContinuous()); |
| 53 | |
| 54 | reverseIndexWheel = new JoystickButton(rightJoystick, |
| 55 | Constants.OI.REVERSE_INDEXWHEEL_PORT); |
| 56 | reverseIndexWheel.whileHeld(new ReverseIndexWheelContinuous()); |
| 57 | |
| 58 | toggleFlyWheel = new JoystickButton(rightJoystick, |
| 59 | Constants.OI.TOGGLE_FLYWHEEL_PORT); |
| 60 | toggleFlyWheel.toggleWhenPressed(new RunFlyWheelContinuous()); |
| 61 | |
| 62 | toggleGear = new JoystickButton(leftJoystick, |
| 63 | Constants.OI.TOGGLE_GEAR_PORT); |
| 64 | toggleGear.whenPressed(new ToggleGear()); |
| 65 | |
| 66 | runIntake = new JoystickButton(leftJoystick, Constants.OI.RUN_INTAKE_PORT); |
| 67 | runIntake.whileHeld(new RunIntakeContinuous()); |
| 68 | |
| 69 | reverseIntake = new JoystickButton(leftJoystick, |
| 70 | Constants.OI.REVERSE_INTAKE_PORT); |
| 71 | reverseIntake.whileHeld(new ReverseIntakeContinuous()); |
| 72 | |
| 73 | increaseShooterSpeed = new JoystickButton(leftJoystick, |
| 74 | Constants.OI.INCREASE_SHOOTER_SPEED_PORT); |
| 75 | increaseShooterSpeed.whenPressed(new IncreaseShootingSpeed()); |
| 76 | |
| 77 | decreaseShooterSpeed = new JoystickButton(leftJoystick, |
| 78 | Constants.OI.DECREASE_SHOOTER_SPEED_PORT); |
| 79 | decreaseShooterSpeed.whenPressed(new DecreaseShootingSpeed()); |
| 80 | |
| 81 | changeCam = new JoystickButton(rightJoystick, |
| 82 | Constants.OI.CHANGE_CAMERA_VIEW); |
| 83 | changeCam.toggleWhenPressed(new ChangeCameraView()); |
| 84 | |
| 85 | togglePiston = new JoystickButton(rightJoystick, |
| 86 | Constants.Shooter.TOGGLE_INDEXER); |
| 87 | togglePiston.whenPressed(new ToggleIndexerPiston()); |
| 88 | |
| 89 | toggleDriveTrainPiston = new JoystickButton(rightJoystick, |
| 90 | Constants.DriveTrain.TOGGLE_DRIVE_PISTON); |
| 91 | toggleDriveTrainPiston.whenPressed(new ToggleGear()); |
| 92 | |
| 93 | brakeCANTalons = new JoystickButton(rightJoystick, |
| 94 | Constants.OI.BRAKE_CANTALONS_PORT); |
| 95 | brakeCANTalons.whenPressed(new BrakeCANTalons()); |
| 96 | |
| 97 | coastCANTalons = new JoystickButton(rightJoystick, |
| 98 | Constants.OI.COAST_CANTALONS_PORT); |
| 99 | coastCANTalons.whenPressed(new CoastCANTalons()); |
| 100 | } |
| 101 | |
| 102 | public static OI getOI() { |
| 103 | if (oi == null) |
| 104 | oi = new OI(); |
| 105 | return oi; |
| 106 | } |
| 107 | |
| 108 | /* |
| 109 | * @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == |
| 110 | * KeyEvent.VK_Z) { // Robot.swapCameraFeed(); |
| 111 | * Robot.getShooter().runIndexWheel(); } } |
| 112 | * |
| 113 | * @Override public void keyReleased(KeyEvent e) { if (e.getKeyCode() == |
| 114 | * KeyEvent.VK_Z) { // Robot.swapCameraFeed(); |
| 115 | * Robot.getShooter().stopIndexWheel(); } } |
| 116 | * |
| 117 | * @Override public void keyTyped(KeyEvent e) { } |
| 118 | */ |
| 119 | |
| 120 | } |