Add command group for ToggleWinch
[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.commandgroups.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.ReverseIndexWheelContinuous;
8 import org.usfirst.frc.team3501.robot.commands.shooter.RunFlyWheelContinuous;
9 import org.usfirst.frc.team3501.robot.commands.shooter.RunIndexWheelContinuous;
10
11 import edu.wpi.first.wpilibj.Joystick;
12 import edu.wpi.first.wpilibj.buttons.Button;
13 import edu.wpi.first.wpilibj.buttons.JoystickButton;
14
15 public class OI {
16 private static OI oi;
17 public static Joystick leftJoystick;
18 public static Joystick rightJoystick;
19 public static Button toggleWinch;
20
21 public static Button runIndexWheel;
22 public static Button reverseIndexWheel;
23 public static Button toggleFlyWheel;
24
25 public static Button toggleGear;
26
27 public static Button runIntake;
28 public static Button reverseIntake;
29
30 public OI() {
31 leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT);
32 rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT);
33
34 runIndexWheel = new JoystickButton(leftJoystick,
35 Constants.OI.TOGGLE_INDEXWHEEL_PORT);
36 runIndexWheel.whileHeld(new RunIndexWheelContinuous());
37
38 reverseIndexWheel = new JoystickButton(leftJoystick,
39 Constants.OI.REVERSE_INDEXWHEEL_PORT);
40 reverseIndexWheel.whileHeld(new ReverseIndexWheelContinuous());
41
42 toggleFlyWheel = new JoystickButton(leftJoystick,
43 Constants.OI.TOGGLE_FLYWHEEL_PORT);
44 toggleFlyWheel.toggleWhenPressed(new RunFlyWheelContinuous());
45
46 toggleGear = new JoystickButton(leftJoystick,
47 Constants.OI.TOGGLE_GEAR_PORT);
48 toggleGear.whenPressed(new ToggleGear());
49
50 runIntake = new JoystickButton(leftJoystick,
51 Constants.OI.TOGGLE_INTAKE_PORT);
52 runIntake.whileHeld(new RunIntakeContinuous());
53
54 reverseIntake = new JoystickButton(leftJoystick,
55 Constants.OI.REVERSE_INTAKE_PORT);
56 reverseIntake.whileHeld(new ReverseIntakeContinuous());
57
58 toggleWinch = new JoystickButton(leftJoystick,
59 Constants.OI.TOGGLE_WINCH_PORT);
60 /*
61 * if (!Robot.getDriveTrain().isClimbing()) { toggleWinch.whenPressed(new
62 * RunWinchContinuous()); Robot.getDriveTrain().setClimbing(true); } else {
63 * toggleWinch.whenPressed(new MaintainClimbedPosition());
64 * Robot.getDriveTrain().setClimbing(false); }
65 */
66 toggleWinch.whenPressed(new ToggleWinch());
67 }
68
69 public static OI getOI() {
70 if (oi == null)
71 oi = new OI();
72 return oi;
73 }
74 }