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