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