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