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