refactor RunIntake to be RunIntakeContinous (because its used only with joysticks
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / OI.java
CommitLineData
38a404b3
KZ
1package org.usfirst.frc.team3501.robot;
2
7988f380 3import org.usfirst.frc.team3501.robot.Constants.IntakeArm;
571a0e2a
HD
4import org.usfirst.frc.team3501.robot.commands.driving.SetHighGear;
5import org.usfirst.frc.team3501.robot.commands.driving.SetLowGear;
6import org.usfirst.frc.team3501.robot.commands.driving.ToggleFront;
e1f7a742 7import org.usfirst.frc.team3501.robot.commands.intakearm.MoveIntakeArm;
0b12952a 8import org.usfirst.frc.team3501.robot.commands.intakearm.RunIntakeContinuous;
e1f7a742
HD
9import org.usfirst.frc.team3501.robot.commands.shooter.FireCatapult;
10import org.usfirst.frc.team3501.robot.commands.shooter.ResetCatapult;
37e5a121 11
38a404b3 12import edu.wpi.first.wpilibj.Joystick;
cb3389eb
E
13import edu.wpi.first.wpilibj.buttons.Button;
14import edu.wpi.first.wpilibj.buttons.JoystickButton;
38a404b3
KZ
15
16public class OI {
17 public static Joystick leftJoystick;
18 public static Joystick rightJoystick;
6b06b2bc 19
6b06b2bc 20 // left joystick buttons
e1f7a742
HD
21 public static Button gearShift;
22 public static Button extendIntake1;
23 public static Button extendIntake2;
24 public static Button retractIntake1;
25 public static Button retractIntake2;
26 public static Button toggleFront;
6b06b2bc
CZ
27
28 // right joystick buttons
e1f7a742
HD
29 public static Button intake;
30 public static Button outtake1;
31 public static Button outtake2;
32 public static Button shooterUp;
33 public static Button shooterDown1;
34 public static Button shooterDown2;
38a404b3
KZ
35
36 public OI() {
37 leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT);
38 rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT);
39
571a0e2a 40 // Left joystick
e1f7a742
HD
41 gearShift = new JoystickButton(leftJoystick,
42 Constants.OI.LEFT_JOYSTICK_GEAR_SHIFT_PORT);
eeb6c3d9
HD
43 gearShift.whenPressed(new SetHighGear());
44 gearShift.whenReleased(new SetLowGear());
52ef246c 45
e1f7a742
HD
46 extendIntake1 = new JoystickButton(leftJoystick,
47 Constants.OI.LEFT_JOYSTICK_EXTEND_INTAKE_1_PORT);
7988f380 48 extendIntake1.whenPressed(new MoveIntakeArm(IntakeArm.EXTEND));
6b06b2bc 49
e1f7a742
HD
50 extendIntake2 = new JoystickButton(leftJoystick,
51 Constants.OI.LEFT_JOYSTICK_EXTEND_INTAKE_2_PORT);
7988f380 52 extendIntake2.whenPressed(new MoveIntakeArm(IntakeArm.EXTEND));
7a949394 53
e1f7a742
HD
54 retractIntake1 = new JoystickButton(leftJoystick,
55 Constants.OI.LEFT_JOYSTICK_RETRACT_INTAKE_1_PORT);
7988f380 56 retractIntake1.whenPressed(new MoveIntakeArm(IntakeArm.RETRACT));
e1f7a742
HD
57
58 retractIntake2 = new JoystickButton(leftJoystick,
59 Constants.OI.LEFT_JOYSTICK_RETRACT_INTAKE_2_PORT);
7988f380 60 retractIntake2.whenPressed(new MoveIntakeArm(IntakeArm.RETRACT));
e1f7a742
HD
61
62 toggleFront = new JoystickButton(leftJoystick,
63 Constants.OI.LEFT_JOYSTICK_TOGGLE_FRONT_PORT);
571a0e2a 64 toggleFront.whenPressed(new ToggleFront());
e1f7a742
HD
65
66 // Right joystick
67 intake = new JoystickButton(rightJoystick,
68 Constants.OI.RIGHT_JOYSTICK_INTAKE_PORT);
0b12952a
ME
69 intake.whenPressed(new RunIntakeContinuous(IntakeArm.IN));
70 intake.whenReleased(new RunIntakeContinuous(IntakeArm.STOP));
e1f7a742
HD
71
72 outtake1 = new JoystickButton(rightJoystick,
73 Constants.OI.RIGHT_JOYSTICK_OUTTAKE_1_PORT);
0b12952a
ME
74 outtake1.whenPressed(new RunIntakeContinuous(IntakeArm.OUT));
75 outtake1.whenReleased(new RunIntakeContinuous(IntakeArm.STOP));
e1f7a742
HD
76
77 outtake2 = new JoystickButton(rightJoystick,
78 Constants.OI.RIGHT_JOYSTICK_OUTTAKE_2_PORT);
0b12952a
ME
79 outtake2.whenPressed(new RunIntakeContinuous(IntakeArm.OUT));
80 outtake2.whenReleased(new RunIntakeContinuous(IntakeArm.STOP));
e1f7a742
HD
81
82 shooterUp = new JoystickButton(rightJoystick,
83 Constants.OI.RIGHT_JOYSTICK_SHOOTER_UP_PORT);
84 shooterUp.whenPressed(new FireCatapult());
85
86 shooterDown1 = new JoystickButton(rightJoystick,
87 Constants.OI.RIGHT_JOYSTICK_SHOOTER_DOWN_1_PORT);
88 shooterDown1.whenPressed(new ResetCatapult());
89
90 shooterDown2 = new JoystickButton(rightJoystick,
91 Constants.OI.RIGHT_JOYSTICK_SHOOTER_DOWN_2_PORT);
92 shooterDown2.whenPressed(new ResetCatapult());
38a404b3
KZ
93 }
94}