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