Commit | Line | Data |
---|---|---|
38a404b3 KZ |
1 | package org.usfirst.frc.team3501.robot; |
2 | ||
99930d53 RR |
3 | import java.awt.event.KeyEvent; |
4 | import java.awt.event.KeyListener; | |
5 | ||
9dc69158 | 6 | import org.usfirst.frc.team3501.robot.commands.climber.ToggleWinch; |
7935bf26 | 7 | import org.usfirst.frc.team3501.robot.commands.driving.ToggleGear; |
cef1f36d RR |
8 | import org.usfirst.frc.team3501.robot.commands.intake.ReverseIntakeContinuous; |
9 | import org.usfirst.frc.team3501.robot.commands.intake.RunIntakeContinuous; | |
5e93f308 CZ |
10 | import org.usfirst.frc.team3501.robot.commands.shooter.DecreaseShootingSpeed; |
11 | import org.usfirst.frc.team3501.robot.commands.shooter.IncreaseShootingSpeed; | |
cef1f36d RR |
12 | import org.usfirst.frc.team3501.robot.commands.shooter.ReverseIndexWheelContinuous; |
13 | import org.usfirst.frc.team3501.robot.commands.shooter.RunFlyWheelContinuous; | |
14 | import org.usfirst.frc.team3501.robot.commands.shooter.RunIndexWheelContinuous; | |
99930d53 | 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 | |
99930d53 | 21 | public class OI implements KeyListener { |
cca02549 | 22 | private static OI oi; |
38a404b3 KZ |
23 | public static Joystick leftJoystick; |
24 | public static Joystick rightJoystick; | |
83fa645c | 25 | public static Button toggleWinch; |
38a404b3 | 26 | |
cef1f36d RR |
27 | public static Button runIndexWheel; |
28 | public static Button reverseIndexWheel; | |
2291f7b3 | 29 | public static Button toggleFlyWheel; |
30 | ||
7935bf26 AD |
31 | public static Button toggleGear; |
32 | ||
cef1f36d RR |
33 | public static Button runIntake; |
34 | public static Button reverseIntake; | |
35 | ||
5e93f308 CZ |
36 | public static Button increaseShooterSpeed; |
37 | public static Button decreaseShooterSpeed; | |
38 | ||
ee1a8006 RR |
39 | private static Button changeCam; |
40 | ||
38a404b3 KZ |
41 | public OI() { |
42 | leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT); | |
43 | rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT); | |
cef1f36d | 44 | |
5e93f308 CZ |
45 | runIndexWheel = new JoystickButton(rightJoystick, |
46 | Constants.OI.RUN_INDEXWHEEL_PORT); | |
cef1f36d RR |
47 | runIndexWheel.whileHeld(new RunIndexWheelContinuous()); |
48 | ||
aec45ad9 | 49 | reverseIndexWheel = new JoystickButton(rightJoystick, |
cef1f36d RR |
50 | Constants.OI.REVERSE_INDEXWHEEL_PORT); |
51 | reverseIndexWheel.whileHeld(new ReverseIndexWheelContinuous()); | |
52 | ||
5e93f308 | 53 | toggleFlyWheel = new JoystickButton(rightJoystick, |
2291f7b3 | 54 | Constants.OI.TOGGLE_FLYWHEEL_PORT); |
cef1f36d RR |
55 | toggleFlyWheel.toggleWhenPressed(new RunFlyWheelContinuous()); |
56 | ||
7935bf26 AD |
57 | toggleGear = new JoystickButton(leftJoystick, |
58 | Constants.OI.TOGGLE_GEAR_PORT); | |
59 | toggleGear.whenPressed(new ToggleGear()); | |
cef1f36d | 60 | |
aec45ad9 | 61 | runIntake = new JoystickButton(leftJoystick, Constants.OI.RUN_INTAKE_PORT); |
cef1f36d RR |
62 | runIntake.whileHeld(new RunIntakeContinuous()); |
63 | ||
64 | reverseIntake = new JoystickButton(leftJoystick, | |
65 | Constants.OI.REVERSE_INTAKE_PORT); | |
66 | reverseIntake.whileHeld(new ReverseIntakeContinuous()); | |
67 | ||
68 | toggleWinch = new JoystickButton(leftJoystick, | |
69 | Constants.OI.TOGGLE_WINCH_PORT); | |
25ef99e6 | 70 | toggleWinch.whenPressed(new ToggleWinch()); |
5e93f308 CZ |
71 | |
72 | increaseShooterSpeed = new JoystickButton(leftJoystick, | |
73 | Constants.OI.INCREASE_SHOOTER_SPEED_PORT); | |
74 | increaseShooterSpeed.whenPressed(new IncreaseShootingSpeed()); | |
75 | ||
76 | decreaseShooterSpeed = new JoystickButton(leftJoystick, | |
77 | Constants.OI.DECREASE_SHOOTER_SPEED_PORT); | |
78 | decreaseShooterSpeed.whenPressed(new DecreaseShootingSpeed()); | |
ee1a8006 RR |
79 | |
80 | changeCam = new JoystickButton(rightJoystick, | |
81 | Constants.OI.CHANGE_CAMERA_VIEW); | |
82 | changeCam.toggleWhenPressed(new ChangeCameraView()); | |
38a404b3 | 83 | } |
cf086549 SG |
84 | |
85 | public static OI getOI() { | |
86 | if (oi == null) | |
87 | oi = new OI(); | |
88 | return oi; | |
cca02549 | 89 | } |
99930d53 RR |
90 | |
91 | @Override | |
92 | public void keyTyped(KeyEvent e) { | |
93 | ||
94 | } | |
95 | ||
96 | @Override | |
97 | public void keyPressed(KeyEvent e) { | |
98 | // TODO Auto-generated method stub | |
99 | ||
100 | } | |
101 | ||
102 | @Override | |
103 | public void keyReleased(KeyEvent e) { | |
104 | // TODO Auto-generated method stub | |
105 | ||
106 | } | |
38a404b3 | 107 | } |