Commit | Line | Data |
---|---|---|
38a404b3 KZ |
1 | package org.usfirst.frc.team3501.robot; |
2 | ||
ffb43c5c RR |
3 | import org.usfirst.frc.team3501.robot.commands.climber.MaintainClimbedPosition; |
4 | import org.usfirst.frc.team3501.robot.commands.climber.RunWinchContinuous; | |
9dc69158 | 5 | import org.usfirst.frc.team3501.robot.commands.climber.ToggleWinch; |
7935bf26 | 6 | import org.usfirst.frc.team3501.robot.commands.driving.ToggleGear; |
cef1f36d RR |
7 | import org.usfirst.frc.team3501.robot.commands.intake.ReverseIntakeContinuous; |
8 | import org.usfirst.frc.team3501.robot.commands.intake.RunIntakeContinuous; | |
5e93f308 CZ |
9 | import org.usfirst.frc.team3501.robot.commands.shooter.DecreaseShootingSpeed; |
10 | import org.usfirst.frc.team3501.robot.commands.shooter.IncreaseShootingSpeed; | |
cef1f36d RR |
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; | |
7935bf26 | 14 | |
38a404b3 | 15 | import edu.wpi.first.wpilibj.Joystick; |
de8c65d3 SG |
16 | import edu.wpi.first.wpilibj.buttons.Button; |
17 | import edu.wpi.first.wpilibj.buttons.JoystickButton; | |
38a404b3 KZ |
18 | |
19 | public class OI { | |
cca02549 | 20 | private static OI oi; |
38a404b3 KZ |
21 | public static Joystick leftJoystick; |
22 | public static Joystick rightJoystick; | |
83fa645c | 23 | public static Button toggleWinch; |
38a404b3 | 24 | |
cef1f36d RR |
25 | public static Button runIndexWheel; |
26 | public static Button reverseIndexWheel; | |
2291f7b3 | 27 | public static Button toggleFlyWheel; |
28 | ||
7935bf26 AD |
29 | public static Button toggleGear; |
30 | ||
cef1f36d RR |
31 | public static Button runIntake; |
32 | public static Button reverseIntake; | |
33 | ||
5e93f308 CZ |
34 | public static Button increaseShooterSpeed; |
35 | public static Button decreaseShooterSpeed; | |
36 | ||
38a404b3 KZ |
37 | public OI() { |
38 | leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT); | |
39 | rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT); | |
cef1f36d | 40 | |
5e93f308 CZ |
41 | runIndexWheel = new JoystickButton(rightJoystick, |
42 | Constants.OI.RUN_INDEXWHEEL_PORT); | |
cef1f36d RR |
43 | runIndexWheel.whileHeld(new RunIndexWheelContinuous()); |
44 | ||
45 | reverseIndexWheel = new JoystickButton(leftJoystick, | |
46 | Constants.OI.REVERSE_INDEXWHEEL_PORT); | |
47 | reverseIndexWheel.whileHeld(new ReverseIndexWheelContinuous()); | |
48 | ||
5e93f308 | 49 | toggleFlyWheel = new JoystickButton(rightJoystick, |
2291f7b3 | 50 | Constants.OI.TOGGLE_FLYWHEEL_PORT); |
cef1f36d RR |
51 | toggleFlyWheel.toggleWhenPressed(new RunFlyWheelContinuous()); |
52 | ||
7935bf26 AD |
53 | toggleGear = new JoystickButton(leftJoystick, |
54 | Constants.OI.TOGGLE_GEAR_PORT); | |
d0b0d55d | 55 | |
7935bf26 | 56 | toggleGear.whenPressed(new ToggleGear()); |
cef1f36d RR |
57 | |
58 | runIntake = new JoystickButton(leftJoystick, | |
5e93f308 | 59 | Constants.OI.RUN_INTAKE_PORT); |
cef1f36d RR |
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); | |
5e93f308 CZ |
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()); | |
ffb43c5c RR |
76 | |
77 | if (!isClimbing) { | |
78 | toggleWinch.whenPressed(new RunWinchContinuous()); | |
79 | isClimbing = true; | |
80 | } else { | |
81 | toggleWinch.whenPressed(new MaintainClimbedPosition()); | |
82 | isClimbing = false; | |
83 | } | |
cb949663 | 84 | |
731aef6d RR |
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()); | |
38a404b3 | 92 | } |
cf086549 SG |
93 | |
94 | public static OI getOI() { | |
95 | if (oi == null) | |
96 | oi = new OI(); | |
97 | return oi; | |
cca02549 | 98 | } |
38a404b3 | 99 | } |