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