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