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