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