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