add necessary commands/buttons
[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.driving.BrakeCANTalons;
4 import org.usfirst.frc.team3501.robot.commands.driving.CoastCANTalons;
5 import org.usfirst.frc.team3501.robot.commands.driving.ToggleDriveGear;
6 import org.usfirst.frc.team3501.robot.commands.driving.ToggleGearManipulatorPiston;
7 import org.usfirst.frc.team3501.robot.commands.intake.ReverseIntakeContinuous;
8 import org.usfirst.frc.team3501.robot.commands.intake.RunIntakeContinuous;
9 import org.usfirst.frc.team3501.robot.commands.shooter.DecreaseShootingSpeed;
10 import org.usfirst.frc.team3501.robot.commands.shooter.IncreaseShootingSpeed;
11 import org.usfirst.frc.team3501.robot.commands.shooter.ReverseFlyWheelContinuous;
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
16 import edu.wpi.first.wpilibj.Joystick;
17 import edu.wpi.first.wpilibj.buttons.Button;
18 import edu.wpi.first.wpilibj.buttons.JoystickButton;
19
20 public class OI {
21 private static OI oi;
22 public static Joystick leftJoystick;
23 public static Joystick rightJoystick;
24 public static Joystick gamePad;
25
26 public static Button runIndexWheel;
27 public static Button reverseIndexWheel;
28 public static Button toggleFlyWheel;
29 public static Button reverseFlyWheel;
30
31 public static Button toggleGear;
32 public static Button toggleGearManipulatorPiston;
33
34 public static Button runIntake;
35 public static Button reverseIntake;
36
37 public static Button increaseShooterSpeed;
38 public static Button decreaseShooterSpeed;
39
40 public static Button brakeCANTalons;
41 public static Button coastCANTalons;
42
43 public OI() {
44 leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT);
45 rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT);
46 gamePad = new Joystick(Constants.OI.GAME_PAD_PORT);
47
48 runIndexWheel = new JoystickButton(rightJoystick,
49 Constants.OI.RUN_INDEXWHEEL_PORT);
50 runIndexWheel.whileHeld(new RunIndexWheelContinuous());
51
52 reverseIndexWheel = new JoystickButton(rightJoystick,
53 Constants.OI.REVERSE_INDEXWHEEL_PORT);
54 reverseIndexWheel.whileHeld(new ReverseIndexWheelContinuous());
55
56 toggleFlyWheel = new JoystickButton(gamePad,
57 Constants.OI.TOGGLE_FLYWHEEL_PORT);
58 toggleFlyWheel.toggleWhenPressed(new RunFlyWheelContinuous());
59
60 reverseFlyWheel = new JoystickButton(gamePad,
61 Constants.OI.REVERSE_FLYWHEEL_PORT);
62 reverseFlyWheel.whileHeld(new ReverseFlyWheelContinuous());
63
64 toggleGear = new JoystickButton(leftJoystick,
65 Constants.OI.TOGGLE_GEAR_PORT);
66 toggleGear.whenPressed(new ToggleDriveGear());
67
68 toggleGearManipulatorPiston = new JoystickButton(gamePad,
69 Constants.OI.TOGGLE_GEAR_MANIPULATOR_PORT);
70 toggleGearManipulatorPiston.whenPressed(new ToggleGearManipulatorPiston());
71
72 runIntake = new JoystickButton(leftJoystick, Constants.OI.RUN_INTAKE_PORT);
73 runIntake.whileHeld(new RunIntakeContinuous());
74
75 reverseIntake = new JoystickButton(leftJoystick,
76 Constants.OI.REVERSE_INTAKE_PORT);
77 reverseIntake.whileHeld(new ReverseIntakeContinuous());
78
79 increaseShooterSpeed = new JoystickButton(gamePad,
80 Constants.OI.INCREASE_SHOOTER_SPEED_PORT);
81 increaseShooterSpeed.whenPressed(new IncreaseShootingSpeed());
82
83 decreaseShooterSpeed = new JoystickButton(gamePad,
84 Constants.OI.DECREASE_SHOOTER_SPEED_PORT);
85 decreaseShooterSpeed.whenPressed(new DecreaseShootingSpeed());
86
87 brakeCANTalons = new JoystickButton(rightJoystick,
88 Constants.OI.BRAKE_CANTALONS_PORT);
89 brakeCANTalons.whenPressed(new BrakeCANTalons());
90
91 coastCANTalons = new JoystickButton(rightJoystick,
92 Constants.OI.COAST_CANTALONS_PORT);
93 coastCANTalons.whenPressed(new CoastCANTalons());
94 }
95
96 public static OI getOI() {
97 if (oi == null)
98 oi = new OI();
99 return oi;
100 }
101 }