refactor isUsingTimeToPassDefense to isUsingTime
[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
30 public final static int LEFT_JOYSTICK_TRIGGER_PORT = 0;
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
36 public final static int RIGHT_JOYSTICK_TRIGGER_PORT = 0;
37 public final static int RIGHT_JOYSTICK_THUMB_PORT = 2;
38
52ef246c
KZ
39 public final static int TOGGLE_SCALING_PORT = 0;
40
200caf63 41 }
38a404b3 42
200caf63
KZ
43 public static class DriveTrain {
44 // Drivetrain Motor Related Ports
33141cdd
KZ
45 public static final int FRONT_LEFT = 1;
46 public static final int FRONT_RIGHT = 4;
47 public static final int REAR_LEFT = 2;
48 public static final int REAR_RIGHT = 3;
27615e61 49
200caf63 50 // Encoder related ports
33141cdd
KZ
51 public final static int ENCODER_LEFT_A = 0;
52 public final static int ENCODER_LEFT_B = 1;
53 public final static int ENCODER_RIGHT_A = 9;
54 public final static int ENCODER_RIGHT_B = 8;
45bdf5b9 55
8058ae1c
SC
56 public final static int FORWARD_CHANNEL = 0;
57 public final static int REVERSE_CHANNEL = 0;
58
5bc7e25f
ME
59 public static final double INCHES_PER_PULSE = ((3.66 / 5.14) * 6 * Math.PI)
60 / 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;
d9c04720
SC
67 public static final int LEFT_FORWARD = 0, LEFT_REVERSE = 1,
68 RIGHT_FORWARD = 2, RIGHT_REVERSE = 3;
33141cdd 69 public static double time = 0;
2a099bc6
KZ
70
71 // Gearing constants
72 public static final Value HIGH_GEAR = DoubleSolenoid.Value.kForward;
73 public static final Value LOW_GEAR = DoubleSolenoid.Value.kReverse;
74
54c588d9
CZ
75 public static boolean inverted = false;
76
9d518a5c 77 public static final double PASS_DEFENSE_TIMEOUT = 10; // find this
200caf63 78 }
ecf2c4a8 79
200caf63
KZ
80 public static class Scaler {
81 // Piston channels
82 public final static int FORWARD_CHANNEL = 0;
cef820ab 83 public final static int REVERSE_CHANNEL = 1;
ecf2c4a8 84
200caf63
KZ
85 // Winch port
86 public final static int WINCH_MOTOR = 0;
8b905afe 87
694c9fc9 88 // Winch speeds
cef820ab 89 public final static double WINCH_STOP_SPEED = 0.0;
eab4ce91 90 public final static double SCALE_SPEED = 0;
39a39f43 91 public final static double SECONDS_TO_CLAMP = 2.0;
52ef246c 92
edf10851 93 // Winch timeout
eab4ce91 94 public final static int SECONDS_TO_SCALE = 0;
edf10851 95
52ef246c
KZ
96 public static boolean SCALING = false;
97
200caf63 98 }
38a404b3 99
200caf63
KZ
100 public static class Shooter {
101 public static final int PORT = 0;
071ab315
KZ
102 public static final int PUNCH_FORWARD = 0;
103 public static final int PUNCH_REVERSE = 1;
200caf63 104 public static final int ANGLE_ADJUSTER_PORT = 0;
2c52cb6e 105
200caf63
KZ
106 public static final DoubleSolenoid.Value punch = DoubleSolenoid.Value.kForward;
107 public static final DoubleSolenoid.Value retract = DoubleSolenoid.Value.kReverse;
da0c4bd8 108
200caf63
KZ
109 // Encoder port
110 public static final int ENCODER_PORT_A = 0;
111 public static final int ENCODER_PORT_B = 0;
071ab315
KZ
112 public static final int HOOD_FORWARD = 2;
113 public static final int HOOD_REVERSE = 3;
114
ec821916
CZ
115 public static final double DEFAULT_SHOOTER_SPEED = 0.5;
116
5930d874
CZ
117 public static final Value open = Value.kReverse;
118 public static final Value closed = Value.kForward;
2c52cb6e 119
0262918c
E
120 public static final Port LIDAR_I2C_PORT = I2C.Port.kMXP;
121
200caf63
KZ
122 public static enum State {
123 RUNNING, STOPPED;
124 }
125 }
40348cab 126
200caf63
KZ
127 public static class IntakeArm {
128 public static final int ROLLER_PORT = 0;
129 public static final int ARM_PORT = 1;
130 public static final int POT_CHANNEL = 0;
131 public static final double INTAKE_SPEED = 0.5;
132 public static final double OUTPUT_SPEED = -0.5;
133 public final static double FULL_RANGE = 270.0; // in degrees
134 public final static double OFFSET = -135.0; // in degrees
135 public static final double ZERO_ANGLE = 0;
136 }
29f5cd04 137
200caf63
KZ
138 public static class DefenseArm {
139 // Potentiometer related ports
140 public static final int ARM_CHANNEL = 0;
141 public static final int ARM_PORT = 0;
142 public static final int HAND_PORT = 1;
143 public static final int HAND_CHANNEL = 1;
144 public final static double FULL_RANGE = 270.0; // in degrees
145 public final static double OFFSET = -135.0; // in degrees
72fc3c9b 146
200caf63
KZ
147 public final static double[] armPotValue = { 0.0, 45.0, 90.0 }; // 3
148 // level
149 public final static double ARM_LENGTH = 0; // TODO: find actual length
150 public final static double HAND_LENGTH = 0; // TODO: find actual length
151 public final static double ARM_MOUNTED_HEIGHT = 0; // TODO: find actual
152 // height
153 }
1826a8dc 154
9728080f
KZ
155 public static class Auton {
156 /*
157 * Distance dead reckoning constants
158 */
159 public static final double POS1_DIST1 = 109;
160 public static final double POS1_TURN1 = 60;
161 public static final double POS1_DIST2 = 0;
162
163 // constants for position 2
164 public static final double POS2_DIST1 = 140;
165 public static final double POS2_TURN1 = 60;
166 public static final double POS2_DIST2 = 0;
167
168 // constants for position 3
169 public static final double POS3_DIST1 = 0;
170 public static final double POS3_TURN1 = 90;
171 public static final double POS3_DIST2 = 35.5;
172 public static final double POS3_TURN2 = -90;
173 public static final double POS3_DIST3 = 0;
174
175 // constants for position 4
176 public static final double POS4_DIST1 = 0;
177 public static final double POS4_TURN1 = -90;
178 public static final double POS4_DIST2 = 18.5;
179 public static final double POS4_TURN2 = 90;
180 public static final double POS4_DIST3 = 0;
181
182 // constants for position 5
183 public static final double POS5_DIST1 = 0;
184 public static final double POS5_TURN1 = -90;
185 public static final double POS5_DIST2 = 72.5;
186 public static final double POS5_TURN2 = 90;
187 public static final double POS5_DIST3 = 0;
188 public static final double DRIVE_MAX_TIMEOUT = 3.0;
189 public static final double TURN_MAX_TIMEOUT = 5.0;
190
191 /*
192 * Time dead Reckoning constants
193 */
194 public static final double POS1_DIST1_TIME = 109;
195 public static final double POS1_DRIVE_MAXSPEED = 0.5;
196 public static final double POS1_TURN1_TIME = 60;
197 public static final double POS1_TURN_MAXSPEED = 0.5;
198 public static final double POS1_DIST2_TIME = 0;
199
200 // constants for position 2
201
202 public static final double POS2_DIST1_TIME = 109;
203 public static final double POS2_DRIVE_MAXSPEED = 0.5;
204 public static final double POS2_TURN1_TIME = 60;
205 public static final double POS2_TURN_MAXSPEED = 0.5;
206 public static final double POS2_DIST2_TIME = 0;
207
208 // constants for position 3
209
210 public static final double POS3_DIST1_TIME = 109;
211 public static final double POS3_DRIVE_MAXSPEED = 0.5;
212 public static final double POS3_TURN1_TIME = 60;
213 public static final double POS3_TURN_MAXSPEED = 0.5;
214 public static final double POS3_DIST2_TIME = 0;
215 // constants for position 4
216
217 public static final double POS4_DIST1_TIME = 109;
218 public static final double POS4_DRIVE_MAXSPEED = 0.5;
219 public static final double POS4_TURN1_TIME = 60;
220 public static final double POS4_TURN_MAXSPEED = 0.5;
221 public static final double POS4_DIST2_TIME = 0;
222 // constants for position 5
223
224 public static final double POS5_DIST1_TIME = 109;
225 public static final double POS5_DRIVE_MAXSPEED = 0.5;
226 public static final double POS5_TURN1_TIME = 60;
227 public static final double POS5_TURN_MAXSPEED = 0.5;
228 public static final double POS5_DIST2_TIME = 0;
600a1a1c
KZ
229
230 // Passing Defenses Constants
231
232 public static final double DEFAULT_SPEED = 0.5;
ca325a58 233 public static boolean isUsingTime = true;
600a1a1c
KZ
234
235 // dead reckoning time and speed constants for driving through defenses
236 public static double passRockWallTime = 0;
237 public static double passRockWallSpeed = 0;
238 public static double passRockWallDistance = 0;
239 public static double passLowBarTime = 0;
240 public static double passLowBarSpeed = 0;
241 public static double passLowBarDistance = 0;
242 public static double passMoatTime = 0;
243 public static double passMoatSpeed = 0;
244 public static double passMoatDistance = 0;
245 public static double passRampartTime = 0;
246 public static double passRampartSpeed = 0;
247 public static double passRampartDistance = 0;
248 public static double passRoughTerrainTime = 0;
249 public static double passRoughTerrainSpeed = 0;
250 public static double passRoughTerrainDistance = 0;
9728080f
KZ
251 }
252
5bc7e25f
ME
253 public enum Direction {
254 UP, DOWN, RIGHT, LEFT, FORWARD, BACKWARD;
255 }
256
200caf63
KZ
257 public enum Defense {
258 PORTCULLIS, SALLY_PORT, ROUGH_TERRAIN, LOW_BAR, CHEVAL_DE_FRISE, DRAWBRIDGE, MOAT, ROCK_WALL, RAMPART;
259 }
38a404b3 260}