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.climber.RunWinch;
6 import org.usfirst.frc.team3501.robot.commands.climber.StopWinch;
7 import org.usfirst.frc.team3501.robot.commands.driving.ShiftDriveHighGear;
8 import org.usfirst.frc.team3501.robot.commands.driving.ShiftDriveLowGear;
9 import org.usfirst.frc.team3501.robot.commands.driving.ShiftGearManipulatorPistonHigh;
10 import org.usfirst.frc.team3501.robot.commands.driving.ShiftGearManipulatorPistonLow;
11 import org.usfirst.frc.team3501.robot.commands.intake.ReverseIntakeContinuous;
12 import org.usfirst.frc.team3501.robot.commands.intake.RunIntakeContinuous;
13 import org.usfirst.frc.team3501.robot.commands.shooter.DecreaseShootingSpeed;
14 import org.usfirst.frc.team3501.robot.commands.shooter.IncreaseShootingSpeed;
15 import org.usfirst.frc.team3501.robot.commands.shooter.ResetShootingSpeed;
16 import org.usfirst.frc.team3501.robot.commands.shooter.ReverseFlyWheelContinuous;
17 import org.usfirst.frc.team3501.robot.commands.shooter.ReverseIndexWheelContinuous;
18 import org.usfirst.frc.team3501.robot.commands.shooter.RunFlyWheelContinuous;
19 import org.usfirst.frc.team3501.robot.commands.shooter.RunIndexWheelContinuous;
20 import org.usfirst.frc.team3501.robot.commands.shooter.StopFlyWheel;
21
22 import edu.wpi.first.wpilibj.Joystick;
23 import edu.wpi.first.wpilibj.buttons.Button;
24 import edu.wpi.first.wpilibj.buttons.JoystickButton;
25
26 public class OI {
27 private static OI oi;
28 public static Joystick xboxController;
29 // public static Joystick rightJoystick;
30 public static Joystick gamePad;
31
32 public static Button runIndexWheel;
33 public static Button reverseIndexWheel;
34 public static Button runFlyWheel;
35 public static Button stopFlyWheel;
36 public static Button reverseFlyWheel;
37
38 // public static Button toggleGear;
39 public static Button shiftHigh;
40 public static Button shiftLow;
41
42 // public static Button toggleGearManipulatorPiston;
43
44 public static Button runIntake;
45 public static Button reverseIntake;
46
47 public static Button increaseShooterSpeed;
48 public static Button decreaseShooterSpeed;
49 public static Button resetShooterSpeed;
50
51 public static Button brakeCANTalons;
52 public static Button coastCANTalons;
53 public static Button climb;
54 public static Button stopclimb;
55
56 public static Button shiftGearManipulatorPistonHigh;
57 public static Button shiftGearManipulatorPistonLow;
58
59 public OI() {
60 xboxController = new Joystick(Constants.OI.XBOX_CONTROLLER_PORT);
61 // rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT);
62 gamePad = new Joystick(Constants.OI.GAME_PAD_PORT);
63
64 runIndexWheel = new JoystickButton(xboxController,
65 Constants.OI.RUN_INDEXWHEEL_PORT);
66 runIndexWheel.whileHeld(new RunIndexWheelContinuous());
67
68 reverseIndexWheel = new JoystickButton(xboxController,
69 Constants.OI.REVERSE_INDEXWHEEL_PORT);
70 reverseIndexWheel.whileHeld(new ReverseIndexWheelContinuous());
71
72 runFlyWheel = new JoystickButton(gamePad, Constants.OI.RUN_FLYWHEEL_PORT);
73 runFlyWheel.whenPressed(new RunFlyWheelContinuous());
74
75 stopFlyWheel = new JoystickButton(gamePad, Constants.OI.STOP_FLYWHEEL_PORT);
76 stopFlyWheel.whenPressed(new StopFlyWheel());
77
78 reverseFlyWheel = new JoystickButton(gamePad,
79 Constants.OI.REVERSE_FLYWHEEL_PORT);
80 reverseFlyWheel.whileHeld(new ReverseFlyWheelContinuous());
81
82 shiftHigh = new JoystickButton(xboxController,
83 Constants.OI.SHIFT_HIGH_PORT);
84 shiftHigh.whenPressed(new ShiftDriveHighGear());
85
86 shiftLow = new JoystickButton(xboxController, Constants.OI.SHIFT_LOW_PORT);
87 shiftLow.whenPressed(new ShiftDriveLowGear());
88
89 /*
90 * toggleGearManipulatorPiston = new JoystickButton(gamePad,
91 * Constants.OI.TOGGLE_GEAR_MANIPULATOR_PORT);
92 * toggleGearManipulatorPiston.whenPressed(new
93 * ToggleGearManipulatorPiston());
94 */
95
96 shiftGearManipulatorPistonHigh = new JoystickButton(gamePad,
97 Constants.OI.SHIFT_GEAR_MANIPULATOR_HIGH_PORT);
98 shiftGearManipulatorPistonHigh
99 .whenPressed(new ShiftGearManipulatorPistonHigh());
100
101 shiftGearManipulatorPistonLow = new JoystickButton(gamePad,
102 Constants.OI.SHIFT_GEAR_MANIPULATOR_LOW_PORT);
103 shiftGearManipulatorPistonLow
104 .whenPressed(new ShiftGearManipulatorPistonLow());
105
106 runIntake = new JoystickButton(xboxController,
107 Constants.OI.RUN_INTAKE_PORT);
108 runIntake.whileHeld(new RunIntakeContinuous());
109
110 reverseIntake = new JoystickButton(xboxController,
111 Constants.OI.REVERSE_INTAKE_PORT);
112 reverseIntake.whileHeld(new ReverseIntakeContinuous());
113
114 increaseShooterSpeed = new JoystickButton(gamePad,
115 Constants.OI.INCREASE_SHOOTER_SPEED_PORT);
116 increaseShooterSpeed.whenPressed(new IncreaseShootingSpeed());
117
118 decreaseShooterSpeed = new JoystickButton(gamePad,
119 Constants.OI.DECREASE_SHOOTER_SPEED_PORT);
120 decreaseShooterSpeed.whenPressed(new DecreaseShootingSpeed());
121
122 resetShooterSpeed = new JoystickButton(gamePad,
123 Constants.OI.RESET_SHOOTER_SPEED_PORT);
124 resetShooterSpeed.whenPressed(new ResetShootingSpeed());
125
126 brakeCANTalons = new JoystickButton(xboxController,
127 Constants.OI.BRAKE_CANTALONS_PORT);
128 brakeCANTalons.whenPressed(new BrakeCANTalons());
129
130 coastCANTalons = new JoystickButton(xboxController,
131 Constants.OI.COAST_CANTALONS_PORT);
132 coastCANTalons.whenPressed(new CoastCANTalons());
133
134 climb = new JoystickButton(xboxController, Constants.OI.CLIMB_PORT);
135 climb.whenPressed(new RunWinch());
136
137 stopclimb = new JoystickButton(xboxController,
138 Constants.OI.STOP_CLIMB_PORT);
139 stopclimb.whenPressed(new StopWinch());
140 }
141
142 public static OI getOI() {
143 if (oi == null)
144 oi = new OI();
145 return oi;
146 }
147 }