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