save in case my comp crashes
[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.MaintainClimbedPosition;
4 import org.usfirst.frc.team3501.robot.commands.climber.RunWinchContinuous;
5 import org.usfirst.frc.team3501.robot.commands.climber.ToggleWinch;
6 import org.usfirst.frc.team3501.robot.commands.driving.ToggleGear;
7 import org.usfirst.frc.team3501.robot.commands.intake.ReverseIntakeContinuous;
8 import org.usfirst.frc.team3501.robot.commands.intake.RunIntakeContinuous;
9 import org.usfirst.frc.team3501.robot.commands.shooter.DecreaseShootingSpeed;
10 import org.usfirst.frc.team3501.robot.commands.shooter.IncreaseShootingSpeed;
11 import org.usfirst.frc.team3501.robot.commands.shooter.ReverseIndexWheelContinuous;
12 import org.usfirst.frc.team3501.robot.commands.shooter.RunFlyWheelContinuous;
13 import org.usfirst.frc.team3501.robot.commands.shooter.RunIndexWheelContinuous;
14
15 import edu.wpi.first.wpilibj.Joystick;
16 import edu.wpi.first.wpilibj.buttons.Button;
17 import edu.wpi.first.wpilibj.buttons.JoystickButton;
18
19 public class OI {
20 private static OI oi;
21 public static Joystick leftJoystick;
22 public static Joystick rightJoystick;
23 public static Button toggleWinch;
24
25 public static Button runIndexWheel;
26 public static Button reverseIndexWheel;
27 public static Button toggleFlyWheel;
28
29 public static Button toggleGear;
30
31 public static Button runIntake;
32 public static Button reverseIntake;
33
34 public static Button increaseShooterSpeed;
35 public static Button decreaseShooterSpeed;
36
37 public OI() {
38 leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT);
39 rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT);
40
41 runIndexWheel = new JoystickButton(rightJoystick,
42 Constants.OI.RUN_INDEXWHEEL_PORT);
43 runIndexWheel.whileHeld(new RunIndexWheelContinuous());
44
45 reverseIndexWheel = new JoystickButton(leftJoystick,
46 Constants.OI.REVERSE_INDEXWHEEL_PORT);
47 reverseIndexWheel.whileHeld(new ReverseIndexWheelContinuous());
48
49 toggleFlyWheel = new JoystickButton(rightJoystick,
50 Constants.OI.TOGGLE_FLYWHEEL_PORT);
51 toggleFlyWheel.toggleWhenPressed(new RunFlyWheelContinuous());
52
53 toggleGear = new JoystickButton(leftJoystick,
54 Constants.OI.TOGGLE_GEAR_PORT);
55
56 toggleGear.whenPressed(new ToggleGear());
57
58 runIntake = new JoystickButton(leftJoystick,
59 Constants.OI.RUN_INTAKE_PORT);
60 runIntake.whileHeld(new RunIntakeContinuous());
61
62 reverseIntake = new JoystickButton(leftJoystick,
63 Constants.OI.REVERSE_INTAKE_PORT);
64 reverseIntake.whileHeld(new ReverseIntakeContinuous());
65
66 toggleWinch = new JoystickButton(leftJoystick,
67 Constants.OI.TOGGLE_WINCH_PORT);
68
69 increaseShooterSpeed = new JoystickButton(leftJoystick,
70 Constants.OI.INCREASE_SHOOTER_SPEED_PORT);
71 increaseShooterSpeed.whenPressed(new IncreaseShootingSpeed());
72
73 decreaseShooterSpeed = new JoystickButton(leftJoystick,
74 Constants.OI.DECREASE_SHOOTER_SPEED_PORT);
75 decreaseShooterSpeed.whenPressed(new DecreaseShootingSpeed());
76
77 if (!isClimbing) {
78 toggleWinch.whenPressed(new RunWinchContinuous());
79 isClimbing = true;
80 } else {
81 toggleWinch.whenPressed(new MaintainClimbedPosition());
82 isClimbing = false;
83 }
84
85 /*
86 * if (!Robot.getDriveTrain().isClimbing()) { toggleWinch.whenPressed(new
87 * RunWinchContinuous()); Robot.getDriveTrain().setClimbing(true); } else {
88 * toggleWinch.whenPressed(new MaintainClimbedPosition());
89 * Robot.getDriveTrain().setClimbing(false); }
90 */
91 toggleWinch.whenPressed(new ToggleWinch());
92
93 }
94
95 public static OI getOI() {
96 if (oi == null)
97 oi = new OI();
98 return oi;
99 }
100 }