Update ports to competition setup, minor bugfixes
[3501/stronghold-2016] / src / org / usfirst / frc / team3501 / robot / OI.java
1 package org.usfirst.frc.team3501.robot;
2
3 import org.usfirst.frc.team3501.robot.commands.driving.SetHighGear;
4 import org.usfirst.frc.team3501.robot.commands.driving.SetLowGear;
5 import org.usfirst.frc.team3501.robot.commands.driving.ToggleFront;
6 import org.usfirst.frc.team3501.robot.commands.intakearm.MoveIntakeArm;
7 import org.usfirst.frc.team3501.robot.commands.intakearm.RunIntake;
8 import org.usfirst.frc.team3501.robot.commands.shooter.FireCatapult;
9 import org.usfirst.frc.team3501.robot.commands.shooter.ResetCatapult;
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 public static Joystick leftJoystick;
17 public static Joystick rightJoystick;
18
19 // left joystick buttons
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;
26
27 // right joystick buttons
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;
34
35 public OI() {
36 leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT);
37 rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT);
38
39 // Left joystick
40 gearShift = new JoystickButton(leftJoystick,
41 Constants.OI.LEFT_JOYSTICK_GEAR_SHIFT_PORT);
42 gearShift.whenPressed(new SetLowGear());
43 gearShift.whenReleased(new SetHighGear());
44
45 extendIntake1 = new JoystickButton(leftJoystick,
46 Constants.OI.LEFT_JOYSTICK_EXTEND_INTAKE_1_PORT);
47 extendIntake1.whenPressed(new MoveIntakeArm(Constants.IntakeArm.EXTEND));
48
49 extendIntake2 = new JoystickButton(leftJoystick,
50 Constants.OI.LEFT_JOYSTICK_EXTEND_INTAKE_2_PORT);
51 extendIntake2.whenPressed(new MoveIntakeArm(Constants.IntakeArm.EXTEND));
52
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);
63 toggleFront.whenPressed(new ToggleFront());
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());
89 }
90 }