Add JoystickButton objects and constants for Drivetrain, Climer, Intake, and Shooter
[3501/2017steamworks] / src / org / usfirst / frc / team3501 / robot / OI.java
CommitLineData
38a404b3
KZ
1package org.usfirst.frc.team3501.robot;
2
cef1f36d
RR
3import org.usfirst.frc.team3501.robot.commands.climber.MaintainClimbedPosition;
4import org.usfirst.frc.team3501.robot.commands.climber.RunWinchContinuous;
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;
8import org.usfirst.frc.team3501.robot.commands.shooter.ReverseIndexWheelContinuous;
9import org.usfirst.frc.team3501.robot.commands.shooter.RunFlyWheelContinuous;
10import org.usfirst.frc.team3501.robot.commands.shooter.RunIndexWheelContinuous;
7935bf26 11
38a404b3 12import edu.wpi.first.wpilibj.Joystick;
de8c65d3
SG
13import edu.wpi.first.wpilibj.buttons.Button;
14import edu.wpi.first.wpilibj.buttons.JoystickButton;
38a404b3
KZ
15
16public class OI {
cca02549 17 private static OI oi;
38a404b3
KZ
18 public static Joystick leftJoystick;
19 public static Joystick rightJoystick;
83fa645c 20 public static Button toggleWinch;
cef1f36d 21 private boolean isClimbing = false;
38a404b3 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
38a404b3
KZ
32 public OI() {
33 leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT);
34 rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT);
cef1f36d
RR
35
36 runIndexWheel = new JoystickButton(leftJoystick,
2291f7b3 37 Constants.OI.TOGGLE_INDEXWHEEL_PORT);
cef1f36d
RR
38 runIndexWheel.whileHeld(new RunIndexWheelContinuous());
39
40 reverseIndexWheel = new JoystickButton(leftJoystick,
41 Constants.OI.REVERSE_INDEXWHEEL_PORT);
42 reverseIndexWheel.whileHeld(new ReverseIndexWheelContinuous());
43
2291f7b3 44 toggleFlyWheel = new JoystickButton(leftJoystick,
45 Constants.OI.TOGGLE_FLYWHEEL_PORT);
cef1f36d
RR
46 toggleFlyWheel.toggleWhenPressed(new RunFlyWheelContinuous());
47
7935bf26
AD
48 toggleGear = new JoystickButton(leftJoystick,
49 Constants.OI.TOGGLE_GEAR_PORT);
50 toggleGear.whenPressed(new ToggleGear());
cef1f36d
RR
51
52 runIntake = new JoystickButton(leftJoystick,
53 Constants.OI.TOGGLE_INTAKE_PORT);
54 runIntake.whileHeld(new RunIntakeContinuous());
55
56 reverseIntake = new JoystickButton(leftJoystick,
57 Constants.OI.REVERSE_INTAKE_PORT);
58 reverseIntake.whileHeld(new ReverseIntakeContinuous());
59
60 toggleWinch = new JoystickButton(leftJoystick,
61 Constants.OI.TOGGLE_WINCH_PORT);
62 if (!isClimbing) {
63 toggleWinch.whenPressed(new RunWinchContinuous());
64 isClimbing = true;
65 } else {
66 toggleWinch.whenPressed(new MaintainClimbedPosition());
67 isClimbing = false;
68 }
38a404b3 69 }
cf086549
SG
70
71 public static OI getOI() {
72 if (oi == null)
73 oi = new OI();
74 return oi;
cca02549 75 }
38a404b3 76}