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