Commit | Line | Data |
---|---|---|
38a404b3 KZ |
1 | package org.usfirst.frc.team3501.robot; |
2 | ||
9b10474d | 3 | import edu.wpi.first.wpilibj.DoubleSolenoid; |
2a099bc6 | 4 | import edu.wpi.first.wpilibj.DoubleSolenoid.Value; |
0262918c E |
5 | import edu.wpi.first.wpilibj.I2C; |
6 | import edu.wpi.first.wpilibj.I2C.Port; | |
9b10474d | 7 | |
38a404b3 KZ |
8 | /** |
9 | * The Constants stores constant values for all subsystems. This includes the | |
10 | * port values for motors and sensors, as well as important operational | |
11 | * constants for subsystems such as max and min values. | |
12 | */ | |
13 | ||
14 | public class Constants { | |
200caf63 KZ |
15 | public static class OI { |
16 | // Computer Ports | |
17 | public final static int LEFT_STICK_PORT = 0; | |
18 | public final static int RIGHT_STICK_PORT = 1; | |
2c9bcd75 CZ |
19 | |
20 | public final static int PASS_PORTCULLIS_PORT = 0; | |
21 | public final static int PASS_CHEVAL_DE_FRISE_PORT = 0; | |
52ef246c | 22 | public final static int PASS_DRAWBRIDGE_PORT = 0; |
2c9bcd75 CZ |
23 | public final static int PASS_SALLYPORT_PORT = 0; |
24 | ||
25 | public final static int ARCADE_INTAKEARM_LEVEL_ONE_PORT = 0; | |
26 | public final static int ARCADE_INTAKEARM_LEVEL_TWO_PORT = 0; | |
27 | public final static int ARCADE_INTAKEARM_LEVEL_THREE_PORT = 0; | |
28 | public final static int ARCADE_INTAKEARM_LEVEL_FOUR_PORT = 0; | |
29 | ||
074407dc | 30 | public final static int LEFT_JOYSTICK_TRIGGER_PORT = 1; |
0a179caa KZ |
31 | public final static int LEFT_JOYSTICK_TOP_LEFT_BUTTON = 4; |
32 | public final static int LEFT_JOYSTICK_TOP_RIGHT_BUTTON = 5; | |
2c9bcd75 CZ |
33 | public final static int LEFT_JOYSTICK_TOP_CENTER_PORT = 3; |
34 | public final static int LEFT_JOYSTICK_TOP_LOW_PORT = 2; | |
35 | ||
0a179caa KZ |
36 | public final static int LEFT_JOYSTICK_BOTTOM_BACK_LEFT_BUTTON = 8; |
37 | public final static int LEFT_JOYSTICK_BOTTOM_BACK_RIGHT_BUTTON = 9; | |
38 | public final static int LEFT_JOYSTICK_BOTTOM_LEFT_FORWARD_BUTTON = 6; | |
39 | public final static int LEFT_JOYSTICK_BOTTOM_LEFT_BACK_BUTTON = 7; | |
40 | public final static int LEFT_JOYSTICK_BOTTOM_RIGHT_FORWARD_BUTTON = 11; | |
41 | public final static int LEFT_JOYSTICK_BOTTOM_RIGHT_BACK_BUTTON = 10; | |
42 | ||
074407dc | 43 | public final static int RIGHT_JOYSTICK_TRIGGER_PORT = 1; |
2c9bcd75 CZ |
44 | public final static int RIGHT_JOYSTICK_THUMB_PORT = 2; |
45 | ||
52ef246c | 46 | public final static int TOGGLE_SCALING_PORT = 0; |
ee82dd56 | 47 | public final static int TOGGLE_COMPRESSOR_PORT = 12; |
52ef246c | 48 | |
200caf63 | 49 | } |
38a404b3 | 50 | |
200caf63 KZ |
51 | public static class DriveTrain { |
52 | // Drivetrain Motor Related Ports | |
33141cdd | 53 | public static final int FRONT_LEFT = 1; |
faabd6f8 | 54 | public static final int FRONT_RIGHT = 6; |
33141cdd | 55 | public static final int REAR_LEFT = 2; |
faabd6f8 | 56 | public static final int REAR_RIGHT = 5; |
27615e61 | 57 | |
200caf63 | 58 | // Encoder related ports |
33141cdd KZ |
59 | public final static int ENCODER_LEFT_A = 0; |
60 | public final static int ENCODER_LEFT_B = 1; | |
61 | public final static int ENCODER_RIGHT_A = 9; | |
62 | public final static int ENCODER_RIGHT_B = 8; | |
45bdf5b9 | 63 | |
0b469cd3 HD |
64 | public final static int FORWARD_CHANNEL = 0; |
65 | public final static int REVERSE_CHANNEL = 1; | |
66 | ||
67 | public static final double INCHES_PER_PULSE = ((3.66 / 5.14) * 6 * Math.PI) / 256; | |
33141cdd | 68 | |
fb75626b KZ |
69 | public static double kp = 0.013, ki = 0.000015, kd = -0.002; |
70 | public static double gp = 0.018, gi = 0.000015, gd = 0; | |
71 | public static double encoderTolerance = 8.0, gyroTolerance = 5.0; | |
72 | ||
33141cdd | 73 | public static final int MANUAL_MODE = 1, ENCODER_MODE = 2, GYRO_MODE = 3; |
ee82dd56 HD |
74 | |
75 | public static final int MODULE_A_ID = 9, MODULE_B_ID = 10; | |
8a5f4fa4 HD |
76 | public static final int LEFT_FORWARD = 1, LEFT_REVERSE = 5, |
77 | RIGHT_FORWARD = 0, RIGHT_REVERSE = 6; | |
ee82dd56 | 78 | |
33141cdd | 79 | public static double time = 0; |
2a099bc6 KZ |
80 | |
81 | // Gearing constants | |
82 | public static final Value HIGH_GEAR = DoubleSolenoid.Value.kForward; | |
83 | public static final Value LOW_GEAR = DoubleSolenoid.Value.kReverse; | |
84 | ||
54c588d9 CZ |
85 | public static boolean inverted = false; |
86 | ||
9d518a5c | 87 | public static final double PASS_DEFENSE_TIMEOUT = 10; // find this |
200caf63 | 88 | } |
ecf2c4a8 | 89 | |
200caf63 KZ |
90 | public static class Scaler { |
91 | // Piston channels | |
faabd6f8 KZ |
92 | public final static int FORWARD_CHANNEL = 6; |
93 | public final static int REVERSE_CHANNEL = 0; | |
ecf2c4a8 | 94 | |
200caf63 KZ |
95 | // Winch port |
96 | public final static int WINCH_MOTOR = 0; | |
8b905afe | 97 | |
694c9fc9 | 98 | // Winch speeds |
cef820ab | 99 | public final static double WINCH_STOP_SPEED = 0.0; |
eab4ce91 | 100 | public final static double SCALE_SPEED = 0; |
39a39f43 | 101 | public final static double SECONDS_TO_CLAMP = 2.0; |
52ef246c | 102 | |
edf10851 | 103 | // Winch timeout |
eab4ce91 | 104 | public final static int SECONDS_TO_SCALE = 0; |
edf10851 | 105 | |
52ef246c KZ |
106 | public static boolean SCALING = false; |
107 | ||
200caf63 | 108 | } |
38a404b3 | 109 | |
200caf63 | 110 | public static class Shooter { |
93241e25 | 111 | public static final int PORT = 4; |
faabd6f8 | 112 | public static final int PUNCH_FORWARD = 5; |
071ab315 | 113 | public static final int PUNCH_REVERSE = 1; |
200caf63 | 114 | public static final int ANGLE_ADJUSTER_PORT = 0; |
2c52cb6e | 115 | |
1e41dfe4 HD |
116 | public static final DoubleSolenoid.Value punch = DoubleSolenoid.Value.kReverse; |
117 | public static final DoubleSolenoid.Value retract = DoubleSolenoid.Value.kForward; | |
da0c4bd8 | 118 | |
200caf63 | 119 | // Encoder port |
1e41dfe4 HD |
120 | public static final int ENCODER_PORT_A = 4; |
121 | public static final int ENCODER_PORT_B = 5; | |
faabd6f8 KZ |
122 | public static final int RIGHT_HOOD_FORWARD = 2; |
123 | public static final int RIGHT_HOOD_REVERSE = 4; | |
124 | public static final int LEFT_HOOD_FORWARD = 4; | |
125 | public static final int LEFT_HOOD_REVERSE = 2; | |
071ab315 | 126 | |
ec821916 CZ |
127 | public static final double DEFAULT_SHOOTER_SPEED = 0.5; |
128 | ||
1e41dfe4 HD |
129 | public static final Value open = Value.kForward; |
130 | public static final Value closed = Value.kReverse; | |
2c52cb6e | 131 | |
0262918c E |
132 | public static final Port LIDAR_I2C_PORT = I2C.Port.kMXP; |
133 | ||
200caf63 KZ |
134 | public static enum State { |
135 | RUNNING, STOPPED; | |
136 | } | |
137 | } | |
40348cab | 138 | |
200caf63 KZ |
139 | public static class IntakeArm { |
140 | public static final int ROLLER_PORT = 0; | |
0a179caa KZ |
141 | public static final int LEFT_ARM_PORT = 1; |
142 | public static final int RIGHT_ARM_PORT = 1; | |
200caf63 KZ |
143 | public static final int POT_CHANNEL = 0; |
144 | public static final double INTAKE_SPEED = 0.5; | |
145 | public static final double OUTPUT_SPEED = -0.5; | |
146 | public final static double FULL_RANGE = 270.0; // in degrees | |
147 | public final static double OFFSET = -135.0; // in degrees | |
148 | public static final double ZERO_ANGLE = 0; | |
4f0ad0ba | 149 | public static final double DEFAULT_INTAKE_ARM_SPEED = 0.3; |
0a179caa | 150 | public static final double STOP_INTAKE_ARM_SPEED = 0.0; |
200caf63 | 151 | } |
29f5cd04 | 152 | |
200caf63 KZ |
153 | public static class DefenseArm { |
154 | // Potentiometer related ports | |
155 | public static final int ARM_CHANNEL = 0; | |
156 | public static final int ARM_PORT = 0; | |
157 | public static final int HAND_PORT = 1; | |
158 | public static final int HAND_CHANNEL = 1; | |
159 | public final static double FULL_RANGE = 270.0; // in degrees | |
160 | public final static double OFFSET = -135.0; // in degrees | |
72fc3c9b | 161 | |
200caf63 KZ |
162 | public final static double[] armPotValue = { 0.0, 45.0, 90.0 }; // 3 |
163 | // level | |
164 | public final static double ARM_LENGTH = 0; // TODO: find actual length | |
165 | public final static double HAND_LENGTH = 0; // TODO: find actual length | |
166 | public final static double ARM_MOUNTED_HEIGHT = 0; // TODO: find actual | |
167 | // height | |
168 | } | |
1826a8dc | 169 | |
9728080f KZ |
170 | public static class Auton { |
171 | /* | |
172 | * Distance dead reckoning constants | |
173 | */ | |
174 | public static final double POS1_DIST1 = 109; | |
175 | public static final double POS1_TURN1 = 60; | |
176 | public static final double POS1_DIST2 = 0; | |
177 | ||
178 | // constants for position 2 | |
179 | public static final double POS2_DIST1 = 140; | |
180 | public static final double POS2_TURN1 = 60; | |
181 | public static final double POS2_DIST2 = 0; | |
182 | ||
183 | // constants for position 3 | |
184 | public static final double POS3_DIST1 = 0; | |
185 | public static final double POS3_TURN1 = 90; | |
186 | public static final double POS3_DIST2 = 35.5; | |
187 | public static final double POS3_TURN2 = -90; | |
188 | public static final double POS3_DIST3 = 0; | |
189 | ||
190 | // constants for position 4 | |
191 | public static final double POS4_DIST1 = 0; | |
192 | public static final double POS4_TURN1 = -90; | |
193 | public static final double POS4_DIST2 = 18.5; | |
194 | public static final double POS4_TURN2 = 90; | |
195 | public static final double POS4_DIST3 = 0; | |
196 | ||
197 | // constants for position 5 | |
198 | public static final double POS5_DIST1 = 0; | |
199 | public static final double POS5_TURN1 = -90; | |
200 | public static final double POS5_DIST2 = 72.5; | |
201 | public static final double POS5_TURN2 = 90; | |
202 | public static final double POS5_DIST3 = 0; | |
203 | public static final double DRIVE_MAX_TIMEOUT = 3.0; | |
204 | public static final double TURN_MAX_TIMEOUT = 5.0; | |
205 | ||
206 | /* | |
207 | * Time dead Reckoning constants | |
208 | */ | |
209 | public static final double POS1_DIST1_TIME = 109; | |
210 | public static final double POS1_DRIVE_MAXSPEED = 0.5; | |
211 | public static final double POS1_TURN1_TIME = 60; | |
212 | public static final double POS1_TURN_MAXSPEED = 0.5; | |
213 | public static final double POS1_DIST2_TIME = 0; | |
214 | ||
215 | // constants for position 2 | |
216 | ||
217 | public static final double POS2_DIST1_TIME = 109; | |
218 | public static final double POS2_DRIVE_MAXSPEED = 0.5; | |
219 | public static final double POS2_TURN1_TIME = 60; | |
220 | public static final double POS2_TURN_MAXSPEED = 0.5; | |
221 | public static final double POS2_DIST2_TIME = 0; | |
222 | ||
223 | // constants for position 3 | |
224 | ||
225 | public static final double POS3_DIST1_TIME = 109; | |
226 | public static final double POS3_DRIVE_MAXSPEED = 0.5; | |
227 | public static final double POS3_TURN1_TIME = 60; | |
228 | public static final double POS3_TURN_MAXSPEED = 0.5; | |
229 | public static final double POS3_DIST2_TIME = 0; | |
230 | // constants for position 4 | |
231 | ||
232 | public static final double POS4_DIST1_TIME = 109; | |
233 | public static final double POS4_DRIVE_MAXSPEED = 0.5; | |
234 | public static final double POS4_TURN1_TIME = 60; | |
235 | public static final double POS4_TURN_MAXSPEED = 0.5; | |
236 | public static final double POS4_DIST2_TIME = 0; | |
237 | // constants for position 5 | |
238 | ||
239 | public static final double POS5_DIST1_TIME = 109; | |
240 | public static final double POS5_DRIVE_MAXSPEED = 0.5; | |
241 | public static final double POS5_TURN1_TIME = 60; | |
242 | public static final double POS5_TURN_MAXSPEED = 0.5; | |
243 | public static final double POS5_DIST2_TIME = 0; | |
600a1a1c KZ |
244 | |
245 | // Passing Defenses Constants | |
246 | ||
247 | public static final double DEFAULT_SPEED = 0.5; | |
c688e9da | 248 | public static final boolean IS_USING_TIME = true; |
600a1a1c KZ |
249 | |
250 | // dead reckoning time and speed constants for driving through defenses | |
01b9b0ec ME |
251 | // TODO: find the times it takes to pass each defense |
252 | public static final double PASS_ROCK_WALL_TIME = 0; | |
253 | public static final double PASS_ROCK_WALL_SPEED = 0; | |
254 | public static final double PASS_ROCK_WALL_DIST = 0; | |
255 | public static final double PASS_LOW_BAR_TIME = 0; | |
256 | public static final double PASS_LOW_BAR_SPEED = 0; | |
257 | public static final double PASS_LOW_BAR_DIST = 0; | |
258 | public static final double PASS_MOAT_TIME = 0; | |
259 | public static final double PASS_MOAT_SPEED = 0; | |
260 | public static final double PASS_MOAT_DIST = 0; | |
261 | public static final double PASS_RAMPART_TIME = 0; | |
262 | public static final double PASS_RAMPART_SPEED = 0; | |
263 | public static final double PASS_RAMPART_DIST = 0; | |
264 | public static final double PASS_ROUGH_TERRAIN_TIME = 0; | |
265 | public static final double PASS_ROUGH_TERRAIN_SPEED = 0; | |
266 | public static final double PASS_ROUGH_TERRAIN_DIST = 0; | |
9728080f KZ |
267 | } |
268 | ||
5bc7e25f ME |
269 | public enum Direction { |
270 | UP, DOWN, RIGHT, LEFT, FORWARD, BACKWARD; | |
271 | } | |
272 | ||
200caf63 KZ |
273 | public enum Defense { |
274 | PORTCULLIS, SALLY_PORT, ROUGH_TERRAIN, LOW_BAR, CHEVAL_DE_FRISE, DRAWBRIDGE, MOAT, ROCK_WALL, RAMPART; | |
275 | } | |
38a404b3 | 276 | } |