Fix ChangeCameraView
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / OI.java
1 package org.usfirst.frc.team3501.robot;
2
3 import java.awt.event.KeyEvent;
4 import java.awt.event.KeyListener;
5
6 import org.usfirst.frc.team3501.robot.commands.climber.ToggleWinch;
7 import org.usfirst.frc.team3501.robot.commands.driving.ToggleGear;
8 import org.usfirst.frc.team3501.robot.commands.intake.ReverseIntakeContinuous;
9 import org.usfirst.frc.team3501.robot.commands.intake.RunIntakeContinuous;
10 import org.usfirst.frc.team3501.robot.commands.shooter.DecreaseShootingSpeed;
11 import org.usfirst.frc.team3501.robot.commands.shooter.IncreaseShootingSpeed;
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;
15 import org.usfirst.frc.team3501.robot.utils.ChangeCameraView;
16
17 import edu.wpi.first.wpilibj.Joystick;
18 import edu.wpi.first.wpilibj.buttons.Button;
19 import edu.wpi.first.wpilibj.buttons.JoystickButton;
20
21 public class OI implements KeyListener {
22 private static OI oi;
23 public static Joystick leftJoystick;
24 public static Joystick rightJoystick;
25 public static Button toggleWinch;
26
27 public static Button runIndexWheel;
28 public static Button reverseIndexWheel;
29 public static Button toggleFlyWheel;
30
31 public static Button toggleGear;
32
33 public static Button runIntake;
34 public static Button reverseIntake;
35
36 public static Button increaseShooterSpeed;
37 public static Button decreaseShooterSpeed;
38
39 private static Button changeCam;
40
41 public OI() {
42 leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT);
43 rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT);
44
45 runIndexWheel = new JoystickButton(rightJoystick,
46 Constants.OI.RUN_INDEXWHEEL_PORT);
47 runIndexWheel.whileHeld(new RunIndexWheelContinuous());
48
49 reverseIndexWheel = new JoystickButton(rightJoystick,
50 Constants.OI.REVERSE_INDEXWHEEL_PORT);
51 reverseIndexWheel.whileHeld(new ReverseIndexWheelContinuous());
52
53 toggleFlyWheel = new JoystickButton(rightJoystick,
54 Constants.OI.TOGGLE_FLYWHEEL_PORT);
55 toggleFlyWheel.toggleWhenPressed(new RunFlyWheelContinuous());
56
57 toggleGear = new JoystickButton(leftJoystick,
58 Constants.OI.TOGGLE_GEAR_PORT);
59 toggleGear.whenPressed(new ToggleGear());
60
61 runIntake = new JoystickButton(leftJoystick, Constants.OI.RUN_INTAKE_PORT);
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);
70 toggleWinch.whenPressed(new ToggleWinch());
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());
79
80 changeCam = new JoystickButton(rightJoystick,
81 Constants.OI.CHANGE_CAMERA_VIEW);
82 changeCam.toggleWhenPressed(new ChangeCameraView());
83 }
84
85 public static OI getOI() {
86 if (oi == null)
87 oi = new OI();
88 return oi;
89 }
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 }
107 }