Saved
[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.BrakeCANTalons;
4 import org.usfirst.frc.team3501.robot.commands.climber.CoastCANTalons;
5 import org.usfirst.frc.team3501.robot.commands.climber.ToggleWinch;
6 import org.usfirst.frc.team3501.robot.commands.driving.ShiftDriveHighGear;
7 import org.usfirst.frc.team3501.robot.commands.driving.ShiftDriveLowGear;
8 import org.usfirst.frc.team3501.robot.commands.driving.ToggleGearManipulatorPiston;
9 import org.usfirst.frc.team3501.robot.commands.intake.ReverseIntakeContinuous;
10 import org.usfirst.frc.team3501.robot.commands.intake.RunIntakeContinuous;
11 import org.usfirst.frc.team3501.robot.commands.shooter.DecreaseShootingSpeed;
12 import org.usfirst.frc.team3501.robot.commands.shooter.IncreaseShootingSpeed;
13 import org.usfirst.frc.team3501.robot.commands.shooter.ResetShootingSpeed;
14 import org.usfirst.frc.team3501.robot.commands.shooter.ReverseFlyWheelContinuous;
15 import org.usfirst.frc.team3501.robot.commands.shooter.ReverseIndexWheelContinuous;
16 import org.usfirst.frc.team3501.robot.commands.shooter.RunFlyWheelContinuous;
17 import org.usfirst.frc.team3501.robot.commands.shooter.RunIndexWheelContinuous;
18
19 import edu.wpi.first.wpilibj.Joystick;
20 import edu.wpi.first.wpilibj.buttons.Button;
21 import edu.wpi.first.wpilibj.buttons.JoystickButton;
22
23 public class OI {
24 private static OI oi;
25 public static Joystick xboxController;
26 // public static Joystick rightJoystick;
27 public static Joystick gamePad;
28
29 public static Button runIndexWheel;
30 public static Button reverseIndexWheel;
31 public static Button toggleFlyWheel;
32 public static Button reverseFlyWheel;
33
34 // public static Button toggleGear;
35 public static Button shiftHigh;
36 public static Button shiftLow;
37
38 public static Button toggleGearManipulatorPiston;
39
40 public static Button runIntake;
41 public static Button reverseIntake;
42
43 public static Button increaseShooterSpeed;
44 public static Button decreaseShooterSpeed;
45 public static Button resetShooterSpeed;
46
47 public static Button brakeCANTalons;
48 public static Button coastCANTalons;
49 public static Button climb;
50
51 public OI() {
52 xboxController = new Joystick(Constants.OI.XBOX_CONTROLLER_PORT);
53 // rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT);
54 gamePad = new Joystick(Constants.OI.GAME_PAD_PORT);
55
56 runIndexWheel = new JoystickButton(xboxController,
57 Constants.OI.RUN_INDEXWHEEL_PORT);
58 runIndexWheel.whileHeld(new RunIndexWheelContinuous());
59
60 reverseIndexWheel = new JoystickButton(xboxController,
61 Constants.OI.REVERSE_INDEXWHEEL_PORT);
62 reverseIndexWheel.whileHeld(new ReverseIndexWheelContinuous());
63
64 toggleFlyWheel = new JoystickButton(gamePad,
65 Constants.OI.TOGGLE_FLYWHEEL_PORT);
66 toggleFlyWheel.toggleWhenPressed(new RunFlyWheelContinuous());
67
68 reverseFlyWheel = new JoystickButton(gamePad,
69 Constants.OI.REVERSE_FLYWHEEL_PORT);
70 reverseFlyWheel.whileHeld(new ReverseFlyWheelContinuous());
71
72 // toggleGear = new JoystickButton(xboxController,
73 // Constants.OI.TOGGLE_GEAR_PORT);
74 // toggleGear.whenPressed(new ToggleDriveGear());
75
76 shiftHigh = new JoystickButton(xboxController,
77 Constants.OI.SHIFT_HIGH_PORT);
78 shiftHigh.whenPressed(new ShiftDriveHighGear());
79
80 shiftLow = new JoystickButton(xboxController, Constants.OI.SHIFT_LOW_PORT);
81 shiftLow.whenPressed(new ShiftDriveLowGear());
82
83 toggleGearManipulatorPiston = new JoystickButton(gamePad,
84 Constants.OI.TOGGLE_GEAR_MANIPULATOR_PORT);
85 toggleGearManipulatorPiston.whenPressed(new ToggleGearManipulatorPiston());
86
87 runIntake = new JoystickButton(xboxController,
88 Constants.OI.RUN_INTAKE_PORT);
89 runIntake.whileHeld(new RunIntakeContinuous());
90
91 reverseIntake = new JoystickButton(xboxController,
92 Constants.OI.REVERSE_INTAKE_PORT);
93 reverseIntake.whileHeld(new ReverseIntakeContinuous());
94
95 increaseShooterSpeed = new JoystickButton(gamePad,
96 Constants.OI.INCREASE_SHOOTER_SPEED_PORT);
97 increaseShooterSpeed.whenPressed(new IncreaseShootingSpeed());
98
99 decreaseShooterSpeed = new JoystickButton(gamePad,
100 Constants.OI.DECREASE_SHOOTER_SPEED_PORT);
101 decreaseShooterSpeed.whenPressed(new DecreaseShootingSpeed());
102
103 resetShooterSpeed = new JoystickButton(gamePad,
104 Constants.OI.RESET_SHOOTER_SPEED_PORT);
105 resetShooterSpeed.whenPressed(new ResetShootingSpeed());
106
107 brakeCANTalons = new JoystickButton(xboxController,
108 Constants.OI.BRAKE_CANTALONS_PORT);
109 brakeCANTalons.whenPressed(new BrakeCANTalons());
110
111 coastCANTalons = new JoystickButton(xboxController,
112 Constants.OI.COAST_CANTALONS_PORT);
113 coastCANTalons.whenPressed(new CoastCANTalons());
114
115 climb = new JoystickButton(xboxController, Constants.OI.CLIMB_PORT);
116 climb.whenPressed(new ToggleWinch());
117 }
118
119 public static OI getOI() {
120 if (oi == null)
121 oi = new OI();
122 return oi;
123 }
124 }