blob: f263d1455df2fc9a94ce6a95c6298abf4d9d8765 [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 Kuszmaule39cbcf2019-02-27 20:48:34 -0800377 ":line_follow_drivetrain",
James Kuszmaul3431d622019-02-17 17:07:44 -0800378 ":localizer",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700379 ":localizer_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700380 ":polydrivetrain",
Alex Perry731b4602019-02-02 22:13:01 -0800381 ":splinedrivetrain",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800382 ":ssdrivetrain",
John Park33858a32018-09-28 23:05:48 -0700383 "//aos/controls:control_loop",
John Park33858a32018-09-28 23:05:48 -0700384 "//aos/util:log_interval",
Austin Schuh3a378462019-01-04 21:48:04 -0800385 "//frc971/control_loops:runge_kutta",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800386 "//frc971/queues:gyro_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700387 "//frc971/wpilib:imu_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700388 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000389)
390
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800391cc_library(
392 name = "drivetrain_test_lib",
393 testonly = True,
394 srcs = ["drivetrain_test_lib.cc"],
395 hdrs = ["drivetrain_test_lib.h"],
396 deps = [
397 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700398 ":drivetrain_goal_fbs",
399 ":drivetrain_output_fbs",
400 ":drivetrain_position_fbs",
401 ":drivetrain_status_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800402 ":trajectory",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700403 "//aos/events:event_loop",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800404 "//aos/testing:googletest",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700405 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800406 "//frc971/control_loops:state_feedback_loop",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800407 "//frc971/queues:gyro_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800408 "//y2016:constants",
409 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
410 ],
411)
412
Comran Morshed5323ecb2015-12-26 20:50:55 +0000413cc_test(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700414 name = "drivetrain_lib_test",
415 srcs = [
416 "drivetrain_lib_test.cc",
417 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700418 data = ["config.json"],
Alex Perry04300d62019-02-17 14:37:04 -0800419 defines =
420 cpu_select({
421 "amd64": [
422 "SUPPORT_PLOT=1",
423 ],
424 "arm": [],
425 }),
426 linkstatic = True,
Austin Schuhbcce26a2018-03-26 23:41:24 -0700427 deps = [
428 ":drivetrain_config",
429 ":drivetrain_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700430 ":localizer_fbs",
431 ":drivetrain_goal_fbs",
432 ":drivetrain_status_fbs",
433 ":drivetrain_position_fbs",
434 ":drivetrain_output_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800435 ":drivetrain_test_lib",
John Park33858a32018-09-28 23:05:48 -0700436 "//aos/controls:control_loop_test",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700437 "//aos/testing:googletest",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800438 "//frc971/queues:gyro_fbs",
Alex Perry04300d62019-02-17 14:37:04 -0800439 ] + cpu_select({
440 "amd64": [
441 "//third_party/matplotlib-cpp",
442 ],
443 "arm": [],
444 }),
Comran Morshed5323ecb2015-12-26 20:50:55 +0000445)
Brian Silverman6260c092018-01-14 15:21:36 -0800446
447genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700448 name = "genrule_haptic_wheel",
449 outs = [
450 "haptic_wheel.h",
451 "haptic_wheel.cc",
452 "integral_haptic_wheel.h",
453 "integral_haptic_wheel.cc",
454 "haptic_trigger.h",
455 "haptic_trigger.cc",
456 "integral_haptic_trigger.h",
457 "integral_haptic_trigger.cc",
458 ],
459 cmd = "$(location //frc971/control_loops/python:haptic_wheel) $(OUTS)",
460 compatible_with = mcu_cpus,
461 tools = [
462 "//frc971/control_loops/python:haptic_wheel",
463 ],
464 visibility = ["//visibility:private"],
Brian Silverman6260c092018-01-14 15:21:36 -0800465)
466
467cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700468 name = "haptic_input_uc",
469 srcs = [
470 "haptic_trigger.cc",
471 "haptic_wheel.cc",
472 "integral_haptic_trigger.cc",
473 "integral_haptic_wheel.cc",
474 ],
475 hdrs = [
476 "haptic_trigger.h",
477 "haptic_wheel.h",
478 "integral_haptic_trigger.h",
479 "integral_haptic_wheel.h",
480 ],
481 restricted_to = mcu_cpus,
482 deps = [
483 "//frc971/control_loops:state_feedback_loop_uc",
484 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800485)
486
487cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700488 name = "haptic_wheel",
489 srcs = [
490 "haptic_trigger.cc",
491 "haptic_wheel.cc",
492 "integral_haptic_trigger.cc",
493 "integral_haptic_wheel.cc",
494 ],
495 hdrs = [
496 "haptic_trigger.h",
497 "haptic_wheel.h",
498 "integral_haptic_trigger.h",
499 "integral_haptic_wheel.h",
500 ],
501 deps = [
502 "//frc971/control_loops:state_feedback_loop",
503 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800504)
Austin Schuhc2b08772018-12-19 18:05:06 +1100505
506cc_library(
507 name = "spline",
508 srcs = ["spline.cc"],
509 hdrs = ["spline.h"],
510 deps = [
Austin Schuhf49b4e32019-01-13 17:26:58 -0800511 "//frc971/control_loops:binomial",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700512 "@org_tuxfamily_eigen//:eigen",
Austin Schuhc2b08772018-12-19 18:05:06 +1100513 ],
514)
515
Alex Perrya60da442019-01-21 19:00:27 -0500516cc_binary(
517 name = "spline.so",
518 srcs = ["libspline.cc"],
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800519 linkshared = True,
Alex Perrya60da442019-01-21 19:00:27 -0500520 deps = [
521 ":distance_spline",
522 ":spline",
Alex Perry0603b542019-01-25 20:29:51 -0800523 ":trajectory",
524 "//aos/logging:implementations",
525 "//aos/network:team_number",
Alex Perry0603b542019-01-25 20:29:51 -0800526 "//y2019/control_loops/drivetrain:drivetrain_base",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700527 "@org_tuxfamily_eigen//:eigen",
Alex Perrya60da442019-01-21 19:00:27 -0500528 ],
Alex Perrya60da442019-01-21 19:00:27 -0500529)
530
Austin Schuhc2b08772018-12-19 18:05:06 +1100531cc_test(
532 name = "spline_test",
533 srcs = [
534 "spline_test.cc",
535 ],
536 restricted_to = ["//tools:k8"],
537 deps = [
538 ":spline",
539 "//aos/testing:googletest",
540 "//third_party/matplotlib-cpp",
541 "@com_github_gflags_gflags//:gflags",
542 ],
543)
Austin Schuh941b46d2018-12-19 18:06:05 +1100544
545cc_library(
546 name = "distance_spline",
547 srcs = ["distance_spline.cc"],
548 hdrs = ["distance_spline.h"],
549 deps = [
550 ":spline",
Austin Schuha6e7b212019-01-20 13:53:01 -0800551 "//aos/logging",
Austin Schuh941b46d2018-12-19 18:06:05 +1100552 "//frc971/control_loops:fixed_quadrature",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700553 "@org_tuxfamily_eigen//:eigen",
Austin Schuh941b46d2018-12-19 18:06:05 +1100554 ],
555)
556
557cc_test(
558 name = "distance_spline_test",
559 srcs = [
560 "distance_spline_test.cc",
561 ],
Austin Schuh9b0b6432019-01-13 21:15:17 -0800562 defines =
563 cpu_select({
564 "amd64": [
565 "SUPPORT_PLOT=1",
566 ],
567 "arm": [],
568 }),
569 linkstatic = True,
Austin Schuh941b46d2018-12-19 18:06:05 +1100570 deps = [
571 ":distance_spline",
572 "//aos/testing:googletest",
Austin Schuha6e7b212019-01-20 13:53:01 -0800573 "//aos/testing:test_shm",
Austin Schuh941b46d2018-12-19 18:06:05 +1100574 "@com_github_gflags_gflags//:gflags",
Austin Schuh9b0b6432019-01-13 21:15:17 -0800575 ] + cpu_select({
576 "amd64": [
577 "//third_party/matplotlib-cpp",
578 ],
579 "arm": [],
580 }),
Austin Schuh941b46d2018-12-19 18:06:05 +1100581)
Austin Schuhec7f06d2019-01-04 07:47:15 +1100582
583cc_library(
584 name = "trajectory",
585 srcs = ["trajectory.cc"],
586 hdrs = ["trajectory.h"],
587 deps = [
588 ":distance_spline",
589 ":drivetrain_config",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100590 "//frc971/control_loops:c2d",
591 "//frc971/control_loops:dlqr",
592 "//frc971/control_loops:hybrid_state_feedback_loop",
593 "//frc971/control_loops:runge_kutta",
594 "//frc971/control_loops:state_feedback_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700595 "@org_tuxfamily_eigen//:eigen",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100596 ],
597)
598
599cc_binary(
600 name = "trajectory_plot",
601 srcs = [
602 "trajectory_plot.cc",
603 ],
604 restricted_to = ["//tools:k8"],
605 deps = [
606 ":distance_spline",
607 ":trajectory",
608 "//aos/logging:implementations",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100609 "//aos/network:team_number",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100610 "//third_party/matplotlib-cpp",
Austin Schuh11043182019-03-23 22:29:12 -0700611 "//y2019/control_loops/drivetrain:drivetrain_base",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100612 "@com_github_gflags_gflags//:gflags",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700613 "@org_tuxfamily_eigen//:eigen",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100614 ],
615)
616
617cc_test(
618 name = "trajectory_test",
619 srcs = [
620 "trajectory_test.cc",
621 ],
Austin Schuh719a33e2019-01-07 15:13:34 -0800622 defines =
623 cpu_select({
624 "amd64": [
625 "SUPPORT_PLOT=1",
626 ],
627 "arm": [],
628 }),
629 linkstatic = True,
Austin Schuhec7f06d2019-01-04 07:47:15 +1100630 deps = [
631 ":trajectory",
James Kuszmaulea314d92019-02-18 19:45:06 -0800632 ":drivetrain_test_lib",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100633 "//aos/testing:googletest",
634 "//aos/testing:test_shm",
635 "//y2016:constants",
636 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
James Kuszmaulea314d92019-02-18 19:45:06 -0800637 "//y2019/control_loops/drivetrain:drivetrain_base",
Austin Schuh719a33e2019-01-07 15:13:34 -0800638 ] + cpu_select({
639 "amd64": [
640 "//third_party/matplotlib-cpp",
641 ],
642 "arm": [],
643 }),
Austin Schuhec7f06d2019-01-04 07:47:15 +1100644)