Commit | Line | Data |
---|---|---|
38a404b3 KZ |
1 | package org.usfirst.frc.team3501.robot; |
2 | ||
6b06b2bc CZ |
3 | import org.usfirst.frc.team3501.robot.commands.auton.PassChevalDeFrise; |
4 | import org.usfirst.frc.team3501.robot.commands.auton.PassDrawBridge; | |
5 | import org.usfirst.frc.team3501.robot.commands.auton.PassSallyPort; | |
6 | import org.usfirst.frc.team3501.robot.commands.intakearm.IntakeBall; | |
7 | import org.usfirst.frc.team3501.robot.commands.scaler.ExtendLift; | |
8 | import org.usfirst.frc.team3501.robot.commands.scaler.RetractLift; | |
9 | import org.usfirst.frc.team3501.robot.commands.shooter.Shoot; | |
10 | import org.usfirst.frc.team3501.robot.commands.shooter.runShooter; | |
37e5a121 | 11 | |
6b06b2bc | 12 | import edu.wpi.first.wpilibj.DigitalInput; |
38a404b3 | 13 | import edu.wpi.first.wpilibj.Joystick; |
cb3389eb E |
14 | import edu.wpi.first.wpilibj.buttons.Button; |
15 | import edu.wpi.first.wpilibj.buttons.JoystickButton; | |
6b06b2bc | 16 | import edu.wpi.first.wpilibj.command.Scheduler; |
38a404b3 KZ |
17 | |
18 | public class OI { | |
6b06b2bc CZ |
19 | public static boolean isScalingMode = false; |
20 | public static boolean isCompactRobot = false; | |
21 | ||
38a404b3 KZ |
22 | public static Joystick leftJoystick; |
23 | public static Joystick rightJoystick; | |
6b06b2bc CZ |
24 | |
25 | // first column of arcade buttons - getting past defenses | |
26 | public static DigitalButton passPortcullis; | |
27 | public static DigitalButton passChevalDeFrise; | |
28 | public static DigitalButton passDrawbridge; | |
29 | public static DigitalButton passSallyPort; | |
30 | ||
31 | // second column of arcade buttons - different angles for intake arm | |
32 | // TO DO: change position numbers to angle values (?) | |
33 | public static DigitalButton lowerChevalDeFrise; | |
34 | public static DigitalButton moveToIntakeBoulder; | |
35 | public static DigitalButton poiseAboveChevalDeFrise; | |
36 | public static DigitalButton moveIntakeArmInsideRobot; | |
37 | ||
38 | // left joystick buttons | |
39 | public static Button toggleShooter; | |
40 | public static Button SpinRobot180_1; // both do the same thing, just two | |
41 | public static Button SpinRobot180_2; // different buttons | |
42 | public static Button compactRobot_1; | |
43 | public static Button compactRobot_2; | |
44 | ||
45 | // right joystick buttons | |
46 | public static Button intakeBoulder; | |
47 | public static Button shootBoulder; | |
48 | ||
49 | // button to change robot to the scaling mode | |
50 | public static DigitalButton toggleScalingMode; | |
38a404b3 KZ |
51 | |
52 | public OI() { | |
53 | leftJoystick = new Joystick(Constants.OI.LEFT_STICK_PORT); | |
54 | rightJoystick = new Joystick(Constants.OI.RIGHT_STICK_PORT); | |
55 | ||
6b06b2bc CZ |
56 | passPortcullis = new DigitalButton( |
57 | new DigitalInput(Constants.OI.PASS_PORTCULLIS_PORT)); | |
58 | passChevalDeFrise = new DigitalButton( | |
59 | new DigitalInput(Constants.OI.PASS_CHEVAL_DE_FRISE_PORT)); | |
60 | passDrawbridge = new DigitalButton( | |
61 | new DigitalInput(Constants.OI.PASS_DRAWBRIDGE)); | |
62 | passSallyPort = new DigitalButton( | |
63 | new DigitalInput(Constants.OI.PASS_SALLYPORT_PORT)); | |
64 | ||
65 | lowerChevalDeFrise = new DigitalButton( | |
66 | new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_ONE_PORT)); | |
67 | moveToIntakeBoulder = new DigitalButton( | |
68 | new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_TWO_PORT)); | |
69 | poiseAboveChevalDeFrise = new DigitalButton( | |
70 | new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_THREE_PORT)); | |
71 | moveIntakeArmInsideRobot = new DigitalButton( | |
72 | new DigitalInput(Constants.OI.ARCADE_INTAKEARM_LEVEL_FOUR_PORT)); | |
73 | ||
74 | toggleShooter = new JoystickButton(leftJoystick, | |
75 | Constants.OI.LEFT_JOYSTICK_TRIGGER_PORT); | |
76 | SpinRobot180_1 = new JoystickButton(leftJoystick, | |
77 | Constants.OI.LEFT_JOYSTICK_TOP_LEFT_PORT); | |
78 | SpinRobot180_2 = new JoystickButton(leftJoystick, | |
79 | Constants.OI.LEFT_JOYSTICK_TOP_RIGHT_PORT); | |
80 | compactRobot_1 = new JoystickButton(leftJoystick, | |
81 | Constants.OI.LEFT_JOYSTICK_TOP_CENTER_PORT); | |
82 | compactRobot_2 = new JoystickButton(leftJoystick, | |
83 | Constants.OI.LEFT_JOYSTICK_TOP_LOW_PORT); | |
84 | ||
85 | intakeBoulder = new JoystickButton(rightJoystick, | |
86 | Constants.OI.RIGHT_JOYSTICK_TRIGGER_PORT); | |
87 | shootBoulder = new JoystickButton(rightJoystick, | |
88 | Constants.OI.RIGHT_JOYSTICK_THUMB_PORT); | |
89 | ||
90 | toggleScalingMode = new DigitalButton( | |
91 | new DigitalInput(Constants.OI.SCALING_BUTTON_PORT)); | |
92 | ||
93 | passPortcullis.whenPressed(new PassPortcullis()); | |
94 | passChevalDeFrise.whenPressed(new PassChevalDeFrise()); | |
95 | passDrawbridge.whenPressed(new PassDrawBridge()); | |
96 | passSallyPort.whenPressed(new PassSallyPort()); | |
97 | ||
98 | lowerChevalDeFrise | |
99 | .whenPressed(/* TO DO: define this, and fill in commands */); | |
100 | ||
101 | if (toggleScalingMode.get()) { | |
102 | if (!isScalingMode) { | |
103 | isScalingMode = true; | |
104 | if (!isCompactRobot) { | |
105 | Scheduler.getInstance().add(new CompactRobot()); | |
106 | isCompactRobot = true; | |
107 | } | |
108 | } else if (isScalingMode) { | |
109 | isScalingMode = false; | |
110 | Scheduler.getInstance().add(new CompactRobot()); | |
111 | } | |
112 | } | |
113 | ||
114 | if (!isScalingMode) { | |
115 | toggleShooter.toggleWhenPressed(new runShooter()); | |
116 | compactRobot_1.whenPressed(new CompactRobot()); | |
117 | ||
118 | intakeBoulder.whenPressed(new IntakeBall()); | |
119 | shootBoulder.whenPressed(new Shoot()); | |
cb3389eb | 120 | |
6b06b2bc CZ |
121 | } else if (isScalingMode) { |
122 | toggleShooter.toggleWhenPressed(new WinchIn()); | |
123 | compactRobot_1.whenPressed(new RetractLift()); | |
7a949394 | 124 | |
6b06b2bc CZ |
125 | intakeBoulder.toggleWhenPressed(new WinchOut()); |
126 | shootBoulder.whenPressed(new ExtendLift()); | |
127 | } | |
8a394843 | 128 | |
6b06b2bc CZ |
129 | SpinRobot180_1 |
130 | .whenPressed(/* rotate robot 180, reorient joystick controls */); | |
be737818 | 131 | |
38a404b3 KZ |
132 | } |
133 | } |