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