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