Add code for alternating the camera feed
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / OI.java
1 package org.usfirst.frc.team3501.robot;
2
3 import org.usfirst.frc.team3501.robot.commands.climber.ToggleWinch;
4 import org.usfirst.frc.team3501.robot.commands.driving.ToggleGear;
5 import org.usfirst.frc.team3501.robot.commands.intake.ReverseIntakeContinuous;
6 import org.usfirst.frc.team3501.robot.commands.intake.RunIntakeContinuous;
7 import org.usfirst.frc.team3501.robot.commands.shooter.DecreaseShootingSpeed;
8 import org.usfirst.frc.team3501.robot.commands.shooter.IncreaseShootingSpeed;
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;
12
13 import edu.wpi.first.wpilibj.Joystick;
14 import edu.wpi.first.wpilibj.buttons.Button;
15 import edu.wpi.first.wpilibj.buttons.JoystickButton;
16
17 public class OI {
18 private static OI oi;
19 public static Joystick leftJoystick;
20 public static Joystick rightJoystick;
21 public static Button toggleWinch;
22
23 public static Button runIndexWheel;
24 public static Button reverseIndexWheel;
25 public static Button toggleFlyWheel;
26
27 public static Button toggleGear;
28
29 public static Button runIntake;
30 public static Button reverseIntake;
31
32 public static Button increaseShooterSpeed;
33 public static Button decreaseShooterSpeed;
34
35 private static Button changeCam;
36
37 public OI() {
38 leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT);
39 rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT);
40
41 runIndexWheel = new JoystickButton(rightJoystick,
42 Constants.OI.RUN_INDEXWHEEL_PORT);
43 runIndexWheel.whileHeld(new RunIndexWheelContinuous());
44
45 reverseIndexWheel = new JoystickButton(rightJoystick,
46 Constants.OI.REVERSE_INDEXWHEEL_PORT);
47 reverseIndexWheel.whileHeld(new ReverseIndexWheelContinuous());
48
49 toggleFlyWheel = new JoystickButton(rightJoystick,
50 Constants.OI.TOGGLE_FLYWHEEL_PORT);
51 toggleFlyWheel.toggleWhenPressed(new RunFlyWheelContinuous());
52
53 toggleGear = new JoystickButton(leftJoystick,
54 Constants.OI.TOGGLE_GEAR_PORT);
55 toggleGear.whenPressed(new ToggleGear());
56
57 runIntake = new JoystickButton(leftJoystick, Constants.OI.RUN_INTAKE_PORT);
58 runIntake.whileHeld(new RunIntakeContinuous());
59
60 reverseIntake = new JoystickButton(leftJoystick,
61 Constants.OI.REVERSE_INTAKE_PORT);
62 reverseIntake.whileHeld(new ReverseIntakeContinuous());
63
64 toggleWinch = new JoystickButton(leftJoystick,
65 Constants.OI.TOGGLE_WINCH_PORT);
66 toggleWinch.whenPressed(new ToggleWinch());
67
68 increaseShooterSpeed = new JoystickButton(leftJoystick,
69 Constants.OI.INCREASE_SHOOTER_SPEED_PORT);
70 increaseShooterSpeed.whenPressed(new IncreaseShootingSpeed());
71
72 decreaseShooterSpeed = new JoystickButton(leftJoystick,
73 Constants.OI.DECREASE_SHOOTER_SPEED_PORT);
74 decreaseShooterSpeed.whenPressed(new DecreaseShootingSpeed());
75
76 changeCam = new JoystickButton(rightJoystick,
77 Constants.OI.CHANGE_CAMERA_VIEW);
78 changeCam.toggleWhenPressed(new ChangeCameraView());
79 }
80
81 public static OI getOI() {
82 if (oi == null)
83 oi = new OI();
84 return oi;
85 }
86 }