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