-
Notifications
You must be signed in to change notification settings - Fork 0
/
const.py
246 lines (187 loc) · 5.4 KB
/
const.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
"""
Ctrl-Z FRC Team 4096
FIRST Robotics Competition 2019
Code for robot "Saba-Z"
"""
import math
"""
Prepend these to any IDs.
DIO = Digital I/O
AIN = Analog Input
PWM = Pulse Width Modulation
CAN = Controller Area Network
PCM = Pneumatic Control Module
PDP = Power Distribution Panel
"""
### CONSTANTS ###
## DRIVETRAIN ##
# MOTORS - all Victor SPs #
PWM_DRIVE_MOTOR_RIGHT_1 = 0
PWM_DRIVE_MOTOR_RIGHT_2 = 1
PWM_DRIVE_MOTOR_RIGHT_3 = 2
PWM_DRIVE_MOTOR_LEFT_1 = 3
PWM_DRIVE_MOTOR_LEFT_2 = 4
PWM_DRIVE_MOTOR_LEFT_3 = 5
### NOT USED ###
# ENCODERS - grayhill encoders #
DIO_DRIVE_ENC_RIGHT_1 = 5
DIO_DRIVE_ENC_RIGHT_2 = 6
DIO_DRIVE_ENC_LEFT_1 = 7
DIO_DRIVE_ENC_LEFT_2 = 8
DRIVE_ENCODER_LEFT_REVERSED = False # NEED TO BE CHANGED
DRIVE_ENCODER_RIGHT_REVERSED = False
DRIVE_CORRECTION_ENABLED = False
DRIVE_WHEEL_DIAMETER_INCHES = 6
DRIVE_ENCODER_TICKS_PER_REV = 256
DRIVE_TICKS_PER_FOOT = 12 / (math.pi * DRIVE_WHEEL_DIAMETER_INCHES / DRIVE_ENCODER_TICKS_PER_REV)
# Values from last year... might need to be changed
DRIVE_CORRECTION_ROTATION_THRESHOLD = 0.05
DRIVE_CORRECTION_PROPORTION_FORWARD = 0.1
DRIVE_CORRECTION_PROPORTION_REVERSE = 0.04
DRIVE_CORRECTION_PROPORTION_FORWARD_ENC = 0.009
DRIVE_CORRECTION_PROPORTION_REVERSE_ENC = 0.009
DRIVE_ROTATION_MULTIPLIER = 0.85
### NOT USED ###
# Minimum power required to move
# Minimum power required.
DRIVE_MIN_ROTATION_OUTPUT_TANK = 0.7
DRIVE_MIN_OUTPUT_TANK = 0.5
## HATCH ##
# MOTORS #
CAN_MOTOR_HATCH_CARRIAGE = 8
# STRING POTENTIOMETER #
AIN_HATCH_STRING_POT = 2
# PRACTICE BOT VALUESSSS
HATCH_POT_MIN = 0.41 / 5
HATCH_POT_MAX = 2.21 / 5
HATCH_POT_RANGE_MIN = 0
HATCH_POT_RANGE_MAX = 11.25
HATCH_STRING_POT_MULTIPLIER = (HATCH_POT_RANGE_MAX - HATCH_POT_RANGE_MIN) / (HATCH_POT_MAX - HATCH_POT_MIN)
HATCH_STRING_POT_OFFSET = HATCH_POT_RANGE_MAX - (HATCH_POT_MAX * HATCH_STRING_POT_MULTIPLIER)
# PNEUMATICS #
PCM_HATCH_SOLENOID_BEAK_1 = 4 # PCM A
PCM_HATCH_SOLENOID_BEAK_2 = 5 # PCM A
PCM_HATCH_SOLENOID_CARRIAGE_1 = 2 # PCM A
PCM_HATCH_SOLENOID_CARRIAGE_2 = 3 # PCM A
PCM_LIGHT_SENSOR_SOLENOID_1 = 0 # PCM B
PCM_LIGHT_SENSOR_SOLENOID_2 = 1 # PCM B
# OTHER #
CARRIAGE_POS_MIN = 0
CARRIAGE_POS_MAX = 11.5 # Actual travel dist is 11.5", but it needed a bit of fudging
LIMELIGHT_CARRIAGE_PIXEL_MIN = 38
LIMELIGHT_CARRIAGE_PIXEL_MAX = 286
ARDUINO_DEVICE_ADDRESS = 0x10
ARDUINO_LINE_SENSOR_MAX_VALUE = 22
## CARGO ##
# MOTORS #
CAN_MOTOR_CARGO_ARM = 5
CAN_MOTOR_CARGO_INTAKE = 6
# POTENIOMETER #
AIN_CARGO_ARM_POT = 1
# PRACTICE BOT VALUES
#pot min max need tweaking again
CARGO_POT_MIN = 1.20 / 5
CARGO_POT_MAX = 3.16 / 5
CARGO_POT_RANGE_MIN = 0
CARGO_POT_RANGE_MAX = 140
CARGO_ARM_POT_MULTIPLIER = (CARGO_POT_RANGE_MAX - CARGO_POT_RANGE_MIN) / (CARGO_POT_MAX - CARGO_POT_MIN)
CARGO_ARM_POT_OFFSET = CARGO_POT_RANGE_MAX - (CARGO_POT_MAX * CARGO_ARM_POT_MULTIPLIER)
# CURRENT SENSING #
CARGO_PDP_ID = 4 # on comp bot
CARGO_INTAKE_THRESHOLD = 18
# PNEUMATICS #
PCM_CARGO_SOLENOID_BRAKE_1 = 1 # PCM A
PCM_CARGO_SOLENOID_BRAKE_2 = 0 # PCM A
# OTHER #
CARGO_MIN = 0.07 # change
# CLIMBER POSITIONS (in degrees of potentiometer) #
CLIMB_START_HAB_3 = 46
## CLIMBER ##
CLIMB_SPEED = 1.0
CLIMB_DISTANCE_CORRECTION_TOLERANCE = 0.05 # How far apart the front/back climber pods need to be before they are corrected
CLIMB_SPEED_CORRECTION_MULTIPLIER = 0.8 # Amount to slow down the faster of the two climber pods
CLIMB_SLOW_DOWN_PERCENT = 0.9
CLIMB_STILT_UP_STOP_VALUE = .017 # If encder is > this value it stops
# These are ideal values, with range divided into even 10 increments
"""
CLIMB_LEVEL_STILT_VALUES = (
-573000,
-509000,
-448000,
-382000,
-318000,
-257000,
-190000,
-128600,
-64000,
0
)
"""
CLIMB_LEVEL_STILT_VALUES = (
0,
.112,
.224,
.332,
.449,
.555,
.667,
.782,
.888,
1
)
CLIMB_LEVEL_ARM_VALUES = (
45,
43,
37,
32,
26.5,
20,
15,
10.5,
3.5,
0
)
CLIMB_LEVEL_STILT_VALUES_LEVEL_2 = (
0,
.366
)
CLIMB_LEVEL_ARM_VALUES_LEVEL_2 = (
18.7,
0
)
# MOTORS #
CAN_MOTOR_CLIMBER_1 = 3
CAN_MOTOR_CLIMBER_2 = 7
CAN_MOTOR_CLIMBER_DRIVE = 4
CAN_MOTOR_BACK_CLIMBER = 9
# Ultrasonics - UNUSED #
AIN_ULTRASONIC_FRONT = 3
AIN_ULTRASONIC_REAR = 4
ULTRASONIC_OVER_HAB_THRESHOLD = 1000 # Min distance between readings that indicates it's over next Hab platform
# LIMIT SWITCHES #
DIO_CLIMBER_FRONT_TOP_LIMIT = 0
DIO_CLIMBER_FRONT_BOTTOM_LIMIT = 1
DIO_CLIMBER_BACK_TOP_LIMIT = 3
DIO_CLIMBER_BACK_BOTTOM_LIMIT = 4
DIO_CLIMBER_STILTS_HIT_PLATFORM_LIMIT = 2
# PNEUMATICS - UNUSED #
#PCM_CLIMBER_FRONT_BRAKE_SOLENOID_1 = 0 # PCM B
#PCM_CLIMBER_FRONT_BRAKE_SOLENOID_2 = 1 # PCM B
#PCM_CLIMBER_BACK_BRAKE_SOLENOID_1 = 6 # PCM A
#PCM_CLIMBER_BACK_BRAKE_SOLENOID_2 = 7 # PCM A
## LIMELIGHT ##
LIMELIGHT_DRIVER_CAMERA_MODE_ENABLED = 1
LIMELIGHT_DRIVER_CAMERA_MODE_DISABLED = 0
LIMELIGHT_DRIVER_CAMERA_MODE_DEFAULT = LIMELIGHT_DRIVER_CAMERA_MODE_DISABLED
LIMELIGHT_STREAM_MODE = 2 # 0 = side-by-side, 1 = PIP Main, 2 = PIP Secondary
LIMELIGHT_LED_MODE = 0 # 0 = enabled, 1 = disabled
### OTHER ###
MAX_ACCEL = 0.981
LEDS_ENABLED = True
AIN_PRESSURE_SENSOR = 0
# Labeled A on robot
CAN_PCM_A = 1
# Labeled B on robot - UNUSED
# CAN_PCM_B = 2
CAN_PDP = 0