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