c608b86b8d1767a8eeab2c2b268693ef6ce74d0e
[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.ToggleWinch;
4 import org.usfirst.frc.team3501.robot.commands.driving.ToggleGear;
5 import org.usfirst.frc.team3501.robot.commands.intake.ReverseIntakeContinuous;
6 import org.usfirst.frc.team3501.robot.commands.intake.RunIntakeContinuous;
7 import org.usfirst.frc.team3501.robot.commands.shooter.DecreaseShootingSpeed;
8 import org.usfirst.frc.team3501.robot.commands.shooter.IncreaseShootingSpeed;
9 import org.usfirst.frc.team3501.robot.commands.shooter.ReverseIndexWheelContinuous;
10 import org.usfirst.frc.team3501.robot.commands.shooter.RunFlyWheelContinuous;
11 import org.usfirst.frc.team3501.robot.commands.shooter.RunIndexWheelContinuous;
12
13 import edu.wpi.first.wpilibj.Joystick;
14 import edu.wpi.first.wpilibj.buttons.Button;
15 import edu.wpi.first.wpilibj.buttons.JoystickButton;
16
17 public class OI {
18 private static OI oi;
19 public static Joystick leftJoystick;
20 public static Joystick rightJoystick;
21 public static Button toggleWinch;
22
23 public static Button runIndexWheel;
24 public static Button reverseIndexWheel;
25 public static Button toggleFlyWheel;
26
27 public static Button toggleGear;
28
29 public static Button runIntake;
30 public static Button reverseIntake;
31
32 public static Button increaseShooterSpeed;
33 public static Button decreaseShooterSpeed;
34
35 public OI() {
36 leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT);
37 rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT);
38
39 runIndexWheel = new JoystickButton(rightJoystick,
40 Constants.OI.RUN_INDEXWHEEL_PORT);
41 runIndexWheel.whileHeld(new RunIndexWheelContinuous());
42
43 reverseIndexWheel = new JoystickButton(rightJoystick,
44 Constants.OI.REVERSE_INDEXWHEEL_PORT);
45 reverseIndexWheel.whileHeld(new ReverseIndexWheelContinuous());
46
47 toggleFlyWheel = new JoystickButton(rightJoystick,
48 Constants.OI.TOGGLE_FLYWHEEL_PORT);
49 toggleFlyWheel.toggleWhenPressed(new RunFlyWheelContinuous());
50
51 toggleGear = new JoystickButton(leftJoystick,
52 Constants.OI.TOGGLE_GEAR_PORT);
53 toggleGear.whenPressed(new ToggleGear());
54
55 runIntake = new JoystickButton(leftJoystick, Constants.OI.RUN_INTAKE_PORT);
56 runIntake.whileHeld(new RunIntakeContinuous());
57
58 reverseIntake = new JoystickButton(leftJoystick,
59 Constants.OI.REVERSE_INTAKE_PORT);
60 reverseIntake.whileHeld(new ReverseIntakeContinuous());
61
62 toggleWinch = new JoystickButton(leftJoystick,
63 Constants.OI.TOGGLE_WINCH_PORT);
64 toggleWinch.whenPressed(new ToggleWinch());
65
66 increaseShooterSpeed = new JoystickButton(leftJoystick,
67 Constants.OI.INCREASE_SHOOTER_SPEED_PORT);
68 increaseShooterSpeed.whenPressed(new IncreaseShootingSpeed());
69
70 decreaseShooterSpeed = new JoystickButton(leftJoystick,
71 Constants.OI.DECREASE_SHOOTER_SPEED_PORT);
72 decreaseShooterSpeed.whenPressed(new DecreaseShootingSpeed());
73 }
74
75 public static OI getOI() {
76 if (oi == null)
77 oi = new OI();
78 return oi;
79 }
80 }