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