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