blob: 5350240f83ab7cbab18ee81a6b127bb7be0e0349 [file] [log] [blame]
Austin Schuhbcce26a2018-03-26 23:41:24 -07001package(default_visibility = ["//visibility:public"])
Comran Morshed5323ecb2015-12-26 20:50:55 +00002
Alex Perrycb7da4b2019-08-28 19:35:56 -07003load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
4load("//aos:config.bzl", "aos_config")
Austin Schuhbcce26a2018-03-26 23:41:24 -07005load("//tools:environments.bzl", "mcu_cpus")
Alex Perrycb7da4b2019-08-28 19:35:56 -07006load("//tools/build_rules:select.bzl", "compiler_select", "cpu_select")
Comran Morshed5323ecb2015-12-26 20:50:55 +00007
Alex Perrycb7da4b2019-08-28 19:35:56 -07008flatbuffer_cc_library(
9 name = "drivetrain_goal_fbs",
10 srcs = ["drivetrain_goal.fbs"],
11 compatible_with = mcu_cpus,
12 gen_reflections = 1,
13 includes = ["//frc971/control_loops:control_loops_fbs_includes"],
Comran Morshed5323ecb2015-12-26 20:50:55 +000014)
15
Alex Perrycb7da4b2019-08-28 19:35:56 -070016flatbuffer_cc_library(
17 name = "drivetrain_output_fbs",
18 srcs = ["drivetrain_output.fbs"],
19 compatible_with = mcu_cpus,
20 gen_reflections = 1,
21)
22
23flatbuffer_cc_library(
24 name = "drivetrain_position_fbs",
25 srcs = ["drivetrain_position.fbs"],
26 compatible_with = mcu_cpus,
27 gen_reflections = 1,
28)
29
30flatbuffer_cc_library(
31 name = "drivetrain_status_fbs",
32 srcs = ["drivetrain_status.fbs"],
33 compatible_with = mcu_cpus,
34 gen_reflections = 1,
35 includes = ["//frc971/control_loops:control_loops_fbs_includes"],
36)
37
38genrule(
39 name = "drivetrain_goal_float_fbs_generated",
40 srcs = ["drivetrain_goal.fbs"],
41 outs = ["drivetrain_goal_float.fbs"],
42 cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
43 compatible_with = mcu_cpus,
44)
45
46genrule(
47 name = "drivetrain_position_float_fbs_generated",
48 srcs = ["drivetrain_position.fbs"],
49 outs = ["drivetrain_position_float.fbs"],
50 cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
51 compatible_with = mcu_cpus,
52)
53
54genrule(
55 name = "drivetrain_output_float_fbs_generated",
56 srcs = ["drivetrain_output.fbs"],
57 outs = ["drivetrain_output_float.fbs"],
58 cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
59 compatible_with = mcu_cpus,
60)
61
62genrule(
63 name = "drivetrain_status_float_fbs_generated",
64 srcs = ["drivetrain_status.fbs"],
65 outs = ["drivetrain_status_float.fbs"],
66 cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
67 compatible_with = mcu_cpus,
68)
69
70flatbuffer_cc_library(
71 name = "drivetrain_goal_float_fbs",
72 srcs = ["drivetrain_goal_float.fbs"],
73 compatible_with = mcu_cpus,
74 gen_reflections = 1,
75 includes = ["//frc971/control_loops:control_loops_fbs_includes"],
76)
77
78flatbuffer_cc_library(
79 name = "drivetrain_output_float_fbs",
80 srcs = ["drivetrain_output_float.fbs"],
81 compatible_with = mcu_cpus,
82 gen_reflections = 1,
83)
84
85flatbuffer_cc_library(
86 name = "drivetrain_position_float_fbs",
87 srcs = ["drivetrain_position_float.fbs"],
88 compatible_with = mcu_cpus,
89 gen_reflections = 1,
90)
91
92flatbuffer_cc_library(
93 name = "drivetrain_status_float_fbs",
94 srcs = ["drivetrain_status_float.fbs"],
95 compatible_with = mcu_cpus,
96 gen_reflections = 1,
97 includes = ["//frc971/control_loops:control_loops_fbs_includes"],
98)
99
100aos_config(
101 name = "config",
102 src = "drivetrain_config.json",
103 flatbuffers = [
104 ":drivetrain_goal_fbs",
105 ":drivetrain_output_fbs",
106 ":drivetrain_status_fbs",
107 ":drivetrain_position_fbs",
108 ":localizer_fbs",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800109 "//frc971/queues:gyro_fbs",
110 "//frc971/queues:gyro_uid_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700111 "//frc971/wpilib:imu_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700112 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700113 visibility = ["//visibility:public"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700114 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700115 "//aos/robot_state:config",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700116 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000117)
118
119cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700120 name = "drivetrain_config",
121 hdrs = [
122 "drivetrain_config.h",
123 ],
124 deps = [
125 "//frc971:shifter_hall_effect",
Austin Schuha062edb2019-01-03 13:17:13 -0800126 "//frc971/control_loops:hybrid_state_feedback_loop",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700127 "//frc971/control_loops:state_feedback_loop",
128 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000129)
130
131cc_library(
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800132 name = "hybrid_ekf",
133 hdrs = ["hybrid_ekf.h"],
134 deps = [
135 ":drivetrain_config",
136 "//aos/containers:priority_queue",
James Kuszmaulfedc4612019-03-10 11:24:51 -0700137 "//aos/util:math",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800138 "//frc971/control_loops:c2d",
139 "//frc971/control_loops:runge_kutta",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700140 "@org_tuxfamily_eigen//:eigen",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800141 ],
142)
143
144cc_test(
145 name = "hybrid_ekf_test",
146 srcs = ["hybrid_ekf_test.cc"],
147 deps = [
148 ":drivetrain_test_lib",
149 ":hybrid_ekf",
150 ":trajectory",
151 "//aos/testing:googletest",
152 "//aos/testing:random_seed",
153 "//aos/testing:test_shm",
154 ],
155)
156
Alex Perrycb7da4b2019-08-28 19:35:56 -0700157flatbuffer_cc_library(
158 name = "localizer_fbs",
159 srcs = ["localizer.fbs"],
160 gen_reflections = 1,
James Kuszmaulef428a02019-03-02 22:19:41 -0800161)
162
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800163cc_library(
James Kuszmaul3431d622019-02-17 17:07:44 -0800164 name = "localizer",
165 hdrs = ["localizer.h"],
166 deps = [
167 ":drivetrain_config",
168 ":hybrid_ekf",
James Kuszmaul5bc6fc92019-03-01 21:50:06 -0800169 "//frc971/control_loops:pose",
James Kuszmaul3431d622019-02-17 17:07:44 -0800170 ],
171)
172
173cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700174 name = "gear",
175 hdrs = [
176 "gear.h",
177 ],
178 compatible_with = mcu_cpus,
Austin Schuh093535c2016-03-05 23:21:00 -0800179)
180
181cc_library(
Alex Perry731b4602019-02-02 22:13:01 -0800182 name = "splinedrivetrain",
183 srcs = [
184 "splinedrivetrain.cc",
185 ],
186 hdrs = [
187 "splinedrivetrain.h",
188 ],
189 deps = [
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800190 ":distance_spline",
Alex Perry731b4602019-02-02 22:13:01 -0800191 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700192 ":drivetrain_goal_fbs",
193 ":drivetrain_output_fbs",
194 ":drivetrain_status_fbs",
Alex Perry731b4602019-02-02 22:13:01 -0800195 ":spline",
Alex Perry731b4602019-02-02 22:13:01 -0800196 ":trajectory",
Alex Perry1ec34522019-02-17 22:44:10 -0800197 "//aos:init",
James Kuszmaulc73bb222019-04-07 12:15:35 -0700198 "//aos/util:math",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700199 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800200 ],
Alex Perry731b4602019-02-02 22:13:01 -0800201)
202
203cc_library(
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800204 name = "line_follow_drivetrain",
205 srcs = [
206 "line_follow_drivetrain.cc",
207 ],
208 hdrs = [
209 "line_follow_drivetrain.h",
210 ],
211 deps = [
212 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700213 ":drivetrain_goal_fbs",
214 ":drivetrain_output_fbs",
215 ":drivetrain_status_fbs",
James Kuszmaul5bc6fc92019-03-01 21:50:06 -0800216 ":localizer",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800217 "//aos:math",
218 "//aos/util:math",
219 "//frc971/control_loops:c2d",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700220 "//frc971/control_loops:control_loops_fbs",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800221 "//frc971/control_loops:dlqr",
222 "//frc971/control_loops:pose",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700223 "//frc971/control_loops:profiled_subsystem_fbs",
224 "//y2019/control_loops/superstructure:superstructure_goal_fbs",
225 "@org_tuxfamily_eigen//:eigen",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800226 ],
227)
228
229cc_test(
230 name = "line_follow_drivetrain_test",
231 srcs = ["line_follow_drivetrain_test.cc"],
232 linkstatic = True,
233 restricted_to = ["//tools:k8"],
234 deps = [
235 ":drivetrain_config",
236 ":drivetrain_test_lib",
237 ":line_follow_drivetrain",
238 ":trajectory",
239 "//aos/testing:googletest",
240 "//aos/testing:test_shm",
241 "//third_party/matplotlib-cpp",
242 "@com_github_gflags_gflags//:gflags",
243 ],
244)
245
246cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700247 name = "ssdrivetrain",
248 srcs = [
249 "ssdrivetrain.cc",
250 ],
251 hdrs = [
252 "ssdrivetrain.h",
253 ],
254 deps = [
255 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700256 ":drivetrain_goal_fbs",
257 ":drivetrain_output_fbs",
258 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700259 ":gear",
James Kuszmaul3431d622019-02-17 17:07:44 -0800260 ":localizer",
John Park33858a32018-09-28 23:05:48 -0700261 "//aos:math",
262 "//aos/controls:control_loop",
263 "//aos/controls:polytope",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700264 "//aos/robot_state:robot_state_fbs",
John Park33858a32018-09-28 23:05:48 -0700265 "//aos/util:log_interval",
266 "//aos/util:trapezoid_profile",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700267 "//frc971:shifter_hall_effect",
268 "//frc971/control_loops:coerce_goal",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700269 "//frc971/control_loops:control_loops_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700270 "//frc971/control_loops:state_feedback_loop",
271 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000272)
273
274cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700275 name = "polydrivetrain",
276 srcs = [
277 "polydrivetrain.cc",
278 ],
279 hdrs = [
280 "polydrivetrain.h",
281 ],
282 deps = [
283 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700284 ":drivetrain_goal_fbs",
285 ":drivetrain_output_fbs",
286 ":drivetrain_position_fbs",
287 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700288 ":gear",
John Park33858a32018-09-28 23:05:48 -0700289 "//aos:math",
290 "//aos/controls:polytope",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700291 "//aos/robot_state:robot_state_fbs",
John Park33858a32018-09-28 23:05:48 -0700292 "//aos/util:log_interval",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700293 "//frc971/control_loops:coerce_goal",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700294 "//frc971/control_loops:control_loops_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700295 "//frc971/control_loops:state_feedback_loop",
296 ],
297)
298
299cc_library(
300 name = "drivetrain_config_uc",
301 hdrs = [
302 "drivetrain_config.h",
303 ],
304 restricted_to = mcu_cpus,
305 deps = [
306 "//frc971:shifter_hall_effect",
307 "//frc971/control_loops:state_feedback_loop_uc",
308 ],
309)
310
311cc_library(
312 name = "polydrivetrain_uc",
313 srcs = [
Austin Schuhbcce26a2018-03-26 23:41:24 -0700314 "polydrivetrain.cc",
315 ],
316 hdrs = [
Austin Schuhbcce26a2018-03-26 23:41:24 -0700317 "polydrivetrain.h",
318 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700319 copts = ["-Wno-type-limits"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700320 restricted_to = mcu_cpus,
321 deps = [
322 ":drivetrain_config_uc",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700323 ":drivetrain_goal_float_fbs",
324 ":drivetrain_output_float_fbs",
325 ":drivetrain_position_float_fbs",
326 ":drivetrain_status_float_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700327 ":gear",
John Park33858a32018-09-28 23:05:48 -0700328 "//aos:math",
329 "//aos/controls:polytope_uc",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700330 "//frc971/control_loops:coerce_goal_uc",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700331 "//frc971/control_loops:control_loops_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700332 "//frc971/control_loops:state_feedback_loop_uc",
333 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000334)
335
Austin Schuh05c5a612016-04-02 15:10:25 -0700336genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700337 name = "genrule_down_estimator",
338 outs = [
339 "down_estimator.h",
340 "down_estimator.cc",
341 ],
342 cmd = "$(location //frc971/control_loops/python:down_estimator) $(OUTS)",
343 tools = [
344 "//frc971/control_loops/python:down_estimator",
345 ],
346 visibility = ["//visibility:private"],
Austin Schuh05c5a612016-04-02 15:10:25 -0700347)
348
349cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700350 name = "down_estimator",
351 srcs = [
352 "down_estimator.cc",
353 ],
354 hdrs = [
355 "down_estimator.h",
356 ],
357 deps = [
358 "//frc971/control_loops:state_feedback_loop",
359 ],
Austin Schuh05c5a612016-04-02 15:10:25 -0700360)
361
Comran Morshed5323ecb2015-12-26 20:50:55 +0000362cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700363 name = "drivetrain_lib",
364 srcs = [
365 "drivetrain.cc",
366 ],
367 hdrs = [
368 "drivetrain.h",
369 ],
370 deps = [
371 ":down_estimator",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700372 ":drivetrain_goal_fbs",
373 ":drivetrain_output_fbs",
374 ":drivetrain_position_fbs",
375 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700376 ":gear",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800377 ":improved_down_estimator",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800378 ":line_follow_drivetrain",
James Kuszmaul3431d622019-02-17 17:07:44 -0800379 ":localizer",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700380 ":localizer_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700381 ":polydrivetrain",
Alex Perry731b4602019-02-02 22:13:01 -0800382 ":splinedrivetrain",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800383 ":ssdrivetrain",
John Park33858a32018-09-28 23:05:48 -0700384 "//aos/controls:control_loop",
John Park33858a32018-09-28 23:05:48 -0700385 "//aos/util:log_interval",
Austin Schuh3a378462019-01-04 21:48:04 -0800386 "//frc971/control_loops:runge_kutta",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800387 "//frc971/queues:gyro_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700388 "//frc971/wpilib:imu_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800389 "//frc971/zeroing:imu_zeroer",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700390 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000391)
392
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800393cc_library(
394 name = "drivetrain_test_lib",
395 testonly = True,
396 srcs = ["drivetrain_test_lib.cc"],
397 hdrs = ["drivetrain_test_lib.h"],
398 deps = [
399 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700400 ":drivetrain_goal_fbs",
401 ":drivetrain_output_fbs",
402 ":drivetrain_position_fbs",
403 ":drivetrain_status_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800404 ":trajectory",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700405 "//aos/events:event_loop",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800406 "//aos/testing:googletest",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700407 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800408 "//frc971/control_loops:state_feedback_loop",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800409 "//frc971/queues:gyro_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800410 "//frc971/wpilib:imu_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800411 "//y2016:constants",
412 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
413 ],
414)
415
Comran Morshed5323ecb2015-12-26 20:50:55 +0000416cc_test(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700417 name = "drivetrain_lib_test",
418 srcs = [
419 "drivetrain_lib_test.cc",
420 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700421 data = ["config.json"],
Alex Perry04300d62019-02-17 14:37:04 -0800422 defines =
423 cpu_select({
424 "amd64": [
425 "SUPPORT_PLOT=1",
426 ],
427 "arm": [],
428 }),
429 linkstatic = True,
Austin Schuhbcce26a2018-03-26 23:41:24 -0700430 deps = [
431 ":drivetrain_config",
432 ":drivetrain_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700433 ":localizer_fbs",
434 ":drivetrain_goal_fbs",
435 ":drivetrain_status_fbs",
436 ":drivetrain_position_fbs",
437 ":drivetrain_output_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800438 ":drivetrain_test_lib",
John Park33858a32018-09-28 23:05:48 -0700439 "//aos/controls:control_loop_test",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700440 "//aos/testing:googletest",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800441 "//frc971/queues:gyro_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800442 "//frc971/wpilib:imu_fbs",
Alex Perry04300d62019-02-17 14:37:04 -0800443 ] + cpu_select({
444 "amd64": [
445 "//third_party/matplotlib-cpp",
446 ],
447 "arm": [],
448 }),
Comran Morshed5323ecb2015-12-26 20:50:55 +0000449)
Brian Silverman6260c092018-01-14 15:21:36 -0800450
451genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700452 name = "genrule_haptic_wheel",
453 outs = [
454 "haptic_wheel.h",
455 "haptic_wheel.cc",
456 "integral_haptic_wheel.h",
457 "integral_haptic_wheel.cc",
458 "haptic_trigger.h",
459 "haptic_trigger.cc",
460 "integral_haptic_trigger.h",
461 "integral_haptic_trigger.cc",
462 ],
463 cmd = "$(location //frc971/control_loops/python:haptic_wheel) $(OUTS)",
464 compatible_with = mcu_cpus,
465 tools = [
466 "//frc971/control_loops/python:haptic_wheel",
467 ],
468 visibility = ["//visibility:private"],
Brian Silverman6260c092018-01-14 15:21:36 -0800469)
470
471cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700472 name = "haptic_input_uc",
473 srcs = [
474 "haptic_trigger.cc",
475 "haptic_wheel.cc",
476 "integral_haptic_trigger.cc",
477 "integral_haptic_wheel.cc",
478 ],
479 hdrs = [
480 "haptic_trigger.h",
481 "haptic_wheel.h",
482 "integral_haptic_trigger.h",
483 "integral_haptic_wheel.h",
484 ],
485 restricted_to = mcu_cpus,
486 deps = [
487 "//frc971/control_loops:state_feedback_loop_uc",
488 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800489)
490
491cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700492 name = "haptic_wheel",
493 srcs = [
494 "haptic_trigger.cc",
495 "haptic_wheel.cc",
496 "integral_haptic_trigger.cc",
497 "integral_haptic_wheel.cc",
498 ],
499 hdrs = [
500 "haptic_trigger.h",
501 "haptic_wheel.h",
502 "integral_haptic_trigger.h",
503 "integral_haptic_wheel.h",
504 ],
505 deps = [
506 "//frc971/control_loops:state_feedback_loop",
507 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800508)
Austin Schuhc2b08772018-12-19 18:05:06 +1100509
510cc_library(
511 name = "spline",
512 srcs = ["spline.cc"],
513 hdrs = ["spline.h"],
514 deps = [
Austin Schuhf49b4e32019-01-13 17:26:58 -0800515 "//frc971/control_loops:binomial",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700516 "@org_tuxfamily_eigen//:eigen",
Austin Schuhc2b08772018-12-19 18:05:06 +1100517 ],
518)
519
Alex Perrya60da442019-01-21 19:00:27 -0500520cc_binary(
521 name = "spline.so",
522 srcs = ["libspline.cc"],
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800523 linkshared = True,
Alex Perrya60da442019-01-21 19:00:27 -0500524 deps = [
525 ":distance_spline",
526 ":spline",
Alex Perry0603b542019-01-25 20:29:51 -0800527 ":trajectory",
528 "//aos/logging:implementations",
529 "//aos/network:team_number",
Alex Perry0603b542019-01-25 20:29:51 -0800530 "//y2019/control_loops/drivetrain:drivetrain_base",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700531 "@org_tuxfamily_eigen//:eigen",
Alex Perrya60da442019-01-21 19:00:27 -0500532 ],
Alex Perrya60da442019-01-21 19:00:27 -0500533)
534
Austin Schuhc2b08772018-12-19 18:05:06 +1100535cc_test(
536 name = "spline_test",
537 srcs = [
538 "spline_test.cc",
539 ],
540 restricted_to = ["//tools:k8"],
541 deps = [
542 ":spline",
543 "//aos/testing:googletest",
544 "//third_party/matplotlib-cpp",
545 "@com_github_gflags_gflags//:gflags",
546 ],
547)
Austin Schuh941b46d2018-12-19 18:06:05 +1100548
549cc_library(
550 name = "distance_spline",
551 srcs = ["distance_spline.cc"],
552 hdrs = ["distance_spline.h"],
553 deps = [
554 ":spline",
Austin Schuha6e7b212019-01-20 13:53:01 -0800555 "//aos/logging",
Austin Schuh941b46d2018-12-19 18:06:05 +1100556 "//frc971/control_loops:fixed_quadrature",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700557 "@org_tuxfamily_eigen//:eigen",
Austin Schuh941b46d2018-12-19 18:06:05 +1100558 ],
559)
560
561cc_test(
562 name = "distance_spline_test",
563 srcs = [
564 "distance_spline_test.cc",
565 ],
Austin Schuh9b0b6432019-01-13 21:15:17 -0800566 defines =
567 cpu_select({
568 "amd64": [
569 "SUPPORT_PLOT=1",
570 ],
571 "arm": [],
572 }),
573 linkstatic = True,
Austin Schuh941b46d2018-12-19 18:06:05 +1100574 deps = [
575 ":distance_spline",
576 "//aos/testing:googletest",
Austin Schuha6e7b212019-01-20 13:53:01 -0800577 "//aos/testing:test_shm",
Austin Schuh941b46d2018-12-19 18:06:05 +1100578 "@com_github_gflags_gflags//:gflags",
Austin Schuh9b0b6432019-01-13 21:15:17 -0800579 ] + cpu_select({
580 "amd64": [
581 "//third_party/matplotlib-cpp",
582 ],
583 "arm": [],
584 }),
Austin Schuh941b46d2018-12-19 18:06:05 +1100585)
Austin Schuhec7f06d2019-01-04 07:47:15 +1100586
587cc_library(
588 name = "trajectory",
589 srcs = ["trajectory.cc"],
590 hdrs = ["trajectory.h"],
591 deps = [
592 ":distance_spline",
593 ":drivetrain_config",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100594 "//frc971/control_loops:c2d",
595 "//frc971/control_loops:dlqr",
596 "//frc971/control_loops:hybrid_state_feedback_loop",
597 "//frc971/control_loops:runge_kutta",
598 "//frc971/control_loops:state_feedback_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700599 "@org_tuxfamily_eigen//:eigen",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100600 ],
601)
602
603cc_binary(
604 name = "trajectory_plot",
605 srcs = [
606 "trajectory_plot.cc",
607 ],
608 restricted_to = ["//tools:k8"],
609 deps = [
610 ":distance_spline",
611 ":trajectory",
612 "//aos/logging:implementations",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100613 "//aos/network:team_number",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100614 "//third_party/matplotlib-cpp",
Austin Schuh11043182019-03-23 22:29:12 -0700615 "//y2019/control_loops/drivetrain:drivetrain_base",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100616 "@com_github_gflags_gflags//:gflags",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700617 "@org_tuxfamily_eigen//:eigen",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100618 ],
619)
620
621cc_test(
622 name = "trajectory_test",
623 srcs = [
624 "trajectory_test.cc",
625 ],
Austin Schuh719a33e2019-01-07 15:13:34 -0800626 defines =
627 cpu_select({
628 "amd64": [
629 "SUPPORT_PLOT=1",
630 ],
631 "arm": [],
632 }),
633 linkstatic = True,
Austin Schuhec7f06d2019-01-04 07:47:15 +1100634 deps = [
635 ":trajectory",
James Kuszmaulea314d92019-02-18 19:45:06 -0800636 ":drivetrain_test_lib",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100637 "//aos/testing:googletest",
638 "//aos/testing:test_shm",
639 "//y2016:constants",
640 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
James Kuszmaulea314d92019-02-18 19:45:06 -0800641 "//y2019/control_loops/drivetrain:drivetrain_base",
Austin Schuh719a33e2019-01-07 15:13:34 -0800642 ] + cpu_select({
643 "amd64": [
644 "//third_party/matplotlib-cpp",
645 ],
646 "arm": [],
647 }),
Austin Schuhec7f06d2019-01-04 07:47:15 +1100648)
Austin Schuhca080812017-05-10 19:31:55 -0700649
650cc_library(
651 name = "improved_down_estimator",
652 srcs = [
653 "improved_down_estimator.cc",
654 ],
655 hdrs = [
656 "improved_down_estimator.h",
657 ],
658 deps = [
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800659 ":drivetrain_status_fbs",
660 "//aos/events:event_loop",
661 "//frc971/control_loops:control_loops_fbs",
Austin Schuhca080812017-05-10 19:31:55 -0700662 "//frc971/control_loops:runge_kutta",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800663 "@//aos/time",
Austin Schuhca080812017-05-10 19:31:55 -0700664 "@com_github_google_glog//:glog",
665 "@org_tuxfamily_eigen//:eigen",
666 ],
667)
668
669cc_test(
670 name = "improved_down_estimator_test",
671 srcs = [
672 "improved_down_estimator_test.cc",
673 ],
674 deps = [
675 "//aos/testing:googletest",
676 "//aos/testing:random_seed",
677 "//frc971/control_loops/drivetrain:improved_down_estimator",
678 "@org_tuxfamily_eigen//:eigen",
679 ],
680)
James Kuszmaulf4ede202020-02-14 08:47:40 -0800681
682cc_library(
683 name = "camera",
684 srcs = ["camera.h"],
685 visibility = ["//visibility:public"],
686 deps = [
687 "//aos/containers:sized_array",
688 "//frc971/control_loops:pose",
689 ],
690)
691
692cc_test(
693 name = "camera_test",
694 srcs = ["camera_test.cc"],
695 deps = [
696 ":camera",
697 "//aos/testing:googletest",
698 ],
699)