blob: 71c72784bcfd408e32403dea6b4fa163f597c610 [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",
109 "//frc971/queues:gyro",
110 "//frc971/wpilib:imu_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700111 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700112 visibility = ["//visibility:public"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700113 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700114 "//aos/robot_state:config",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700115 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000116)
117
118cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700119 name = "drivetrain_config",
120 hdrs = [
121 "drivetrain_config.h",
122 ],
123 deps = [
124 "//frc971:shifter_hall_effect",
Austin Schuha062edb2019-01-03 13:17:13 -0800125 "//frc971/control_loops:hybrid_state_feedback_loop",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700126 "//frc971/control_loops:state_feedback_loop",
127 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000128)
129
130cc_library(
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800131 name = "hybrid_ekf",
132 hdrs = ["hybrid_ekf.h"],
133 deps = [
134 ":drivetrain_config",
135 "//aos/containers:priority_queue",
James Kuszmaulfedc4612019-03-10 11:24:51 -0700136 "//aos/util:math",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800137 "//frc971/control_loops:c2d",
138 "//frc971/control_loops:runge_kutta",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700139 "@org_tuxfamily_eigen//:eigen",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800140 ],
141)
142
143cc_test(
144 name = "hybrid_ekf_test",
145 srcs = ["hybrid_ekf_test.cc"],
146 deps = [
147 ":drivetrain_test_lib",
148 ":hybrid_ekf",
149 ":trajectory",
150 "//aos/testing:googletest",
151 "//aos/testing:random_seed",
152 "//aos/testing:test_shm",
153 ],
154)
155
Alex Perrycb7da4b2019-08-28 19:35:56 -0700156flatbuffer_cc_library(
157 name = "localizer_fbs",
158 srcs = ["localizer.fbs"],
159 gen_reflections = 1,
James Kuszmaulef428a02019-03-02 22:19:41 -0800160)
161
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800162cc_library(
James Kuszmaul3431d622019-02-17 17:07:44 -0800163 name = "localizer",
164 hdrs = ["localizer.h"],
165 deps = [
166 ":drivetrain_config",
167 ":hybrid_ekf",
James Kuszmaul5bc6fc92019-03-01 21:50:06 -0800168 "//frc971/control_loops:pose",
James Kuszmaul3431d622019-02-17 17:07:44 -0800169 ],
170)
171
172cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700173 name = "gear",
174 hdrs = [
175 "gear.h",
176 ],
177 compatible_with = mcu_cpus,
Austin Schuh093535c2016-03-05 23:21:00 -0800178)
179
180cc_library(
Alex Perry731b4602019-02-02 22:13:01 -0800181 name = "splinedrivetrain",
182 srcs = [
183 "splinedrivetrain.cc",
184 ],
185 hdrs = [
186 "splinedrivetrain.h",
187 ],
188 deps = [
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800189 ":distance_spline",
Alex Perry731b4602019-02-02 22:13:01 -0800190 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700191 ":drivetrain_goal_fbs",
192 ":drivetrain_output_fbs",
193 ":drivetrain_status_fbs",
Alex Perry731b4602019-02-02 22:13:01 -0800194 ":spline",
Alex Perry731b4602019-02-02 22:13:01 -0800195 ":trajectory",
Alex Perry1ec34522019-02-17 22:44:10 -0800196 "//aos:init",
James Kuszmaulc73bb222019-04-07 12:15:35 -0700197 "//aos/util:math",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700198 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800199 ],
Alex Perry731b4602019-02-02 22:13:01 -0800200)
201
202cc_library(
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800203 name = "line_follow_drivetrain",
204 srcs = [
205 "line_follow_drivetrain.cc",
206 ],
207 hdrs = [
208 "line_follow_drivetrain.h",
209 ],
210 deps = [
211 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700212 ":drivetrain_goal_fbs",
213 ":drivetrain_output_fbs",
214 ":drivetrain_status_fbs",
James Kuszmaul5bc6fc92019-03-01 21:50:06 -0800215 ":localizer",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800216 "//aos:math",
217 "//aos/util:math",
218 "//frc971/control_loops:c2d",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700219 "//frc971/control_loops:control_loops_fbs",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800220 "//frc971/control_loops:dlqr",
221 "//frc971/control_loops:pose",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700222 "//frc971/control_loops:profiled_subsystem_fbs",
223 "//y2019/control_loops/superstructure:superstructure_goal_fbs",
224 "@org_tuxfamily_eigen//:eigen",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800225 ],
226)
227
228cc_test(
229 name = "line_follow_drivetrain_test",
230 srcs = ["line_follow_drivetrain_test.cc"],
231 linkstatic = True,
232 restricted_to = ["//tools:k8"],
233 deps = [
234 ":drivetrain_config",
235 ":drivetrain_test_lib",
236 ":line_follow_drivetrain",
237 ":trajectory",
238 "//aos/testing:googletest",
239 "//aos/testing:test_shm",
240 "//third_party/matplotlib-cpp",
241 "@com_github_gflags_gflags//:gflags",
242 ],
243)
244
245cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700246 name = "ssdrivetrain",
247 srcs = [
248 "ssdrivetrain.cc",
249 ],
250 hdrs = [
251 "ssdrivetrain.h",
252 ],
253 deps = [
254 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700255 ":drivetrain_goal_fbs",
256 ":drivetrain_output_fbs",
257 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700258 ":gear",
James Kuszmaul3431d622019-02-17 17:07:44 -0800259 ":localizer",
John Park33858a32018-09-28 23:05:48 -0700260 "//aos:math",
261 "//aos/controls:control_loop",
262 "//aos/controls:polytope",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700263 "//aos/robot_state:robot_state_fbs",
John Park33858a32018-09-28 23:05:48 -0700264 "//aos/util:log_interval",
265 "//aos/util:trapezoid_profile",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700266 "//frc971:shifter_hall_effect",
267 "//frc971/control_loops:coerce_goal",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700268 "//frc971/control_loops:control_loops_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700269 "//frc971/control_loops:state_feedback_loop",
270 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000271)
272
273cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700274 name = "polydrivetrain",
275 srcs = [
276 "polydrivetrain.cc",
277 ],
278 hdrs = [
279 "polydrivetrain.h",
280 ],
281 deps = [
282 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700283 ":drivetrain_goal_fbs",
284 ":drivetrain_output_fbs",
285 ":drivetrain_position_fbs",
286 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700287 ":gear",
John Park33858a32018-09-28 23:05:48 -0700288 "//aos:math",
289 "//aos/controls:polytope",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700290 "//aos/robot_state:robot_state_fbs",
John Park33858a32018-09-28 23:05:48 -0700291 "//aos/util:log_interval",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700292 "//frc971/control_loops:coerce_goal",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700293 "//frc971/control_loops:control_loops_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700294 "//frc971/control_loops:state_feedback_loop",
295 ],
296)
297
298cc_library(
299 name = "drivetrain_config_uc",
300 hdrs = [
301 "drivetrain_config.h",
302 ],
303 restricted_to = mcu_cpus,
304 deps = [
305 "//frc971:shifter_hall_effect",
306 "//frc971/control_loops:state_feedback_loop_uc",
307 ],
308)
309
310cc_library(
311 name = "polydrivetrain_uc",
312 srcs = [
Austin Schuhbcce26a2018-03-26 23:41:24 -0700313 "polydrivetrain.cc",
314 ],
315 hdrs = [
Austin Schuhbcce26a2018-03-26 23:41:24 -0700316 "polydrivetrain.h",
317 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700318 copts = ["-Wno-type-limits"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700319 restricted_to = mcu_cpus,
320 deps = [
321 ":drivetrain_config_uc",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700322 ":drivetrain_goal_float_fbs",
323 ":drivetrain_output_float_fbs",
324 ":drivetrain_position_float_fbs",
325 ":drivetrain_status_float_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700326 ":gear",
John Park33858a32018-09-28 23:05:48 -0700327 "//aos:math",
328 "//aos/controls:polytope_uc",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700329 "//frc971/control_loops:coerce_goal_uc",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700330 "//frc971/control_loops:control_loops_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700331 "//frc971/control_loops:state_feedback_loop_uc",
332 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000333)
334
Austin Schuh05c5a612016-04-02 15:10:25 -0700335genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700336 name = "genrule_down_estimator",
337 outs = [
338 "down_estimator.h",
339 "down_estimator.cc",
340 ],
341 cmd = "$(location //frc971/control_loops/python:down_estimator) $(OUTS)",
342 tools = [
343 "//frc971/control_loops/python:down_estimator",
344 ],
345 visibility = ["//visibility:private"],
Austin Schuh05c5a612016-04-02 15:10:25 -0700346)
347
348cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700349 name = "down_estimator",
350 srcs = [
351 "down_estimator.cc",
352 ],
353 hdrs = [
354 "down_estimator.h",
355 ],
356 deps = [
357 "//frc971/control_loops:state_feedback_loop",
358 ],
Austin Schuh05c5a612016-04-02 15:10:25 -0700359)
360
Comran Morshed5323ecb2015-12-26 20:50:55 +0000361cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700362 name = "drivetrain_lib",
363 srcs = [
364 "drivetrain.cc",
365 ],
366 hdrs = [
367 "drivetrain.h",
368 ],
369 deps = [
370 ":down_estimator",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700371 ":drivetrain_goal_fbs",
372 ":drivetrain_output_fbs",
373 ":drivetrain_position_fbs",
374 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700375 ":gear",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800376 ":line_follow_drivetrain",
James Kuszmaul3431d622019-02-17 17:07:44 -0800377 ":localizer",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700378 ":localizer_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700379 ":polydrivetrain",
Alex Perry731b4602019-02-02 22:13:01 -0800380 ":splinedrivetrain",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800381 ":ssdrivetrain",
John Park33858a32018-09-28 23:05:48 -0700382 "//aos/controls:control_loop",
John Park33858a32018-09-28 23:05:48 -0700383 "//aos/util:log_interval",
Austin Schuh3a378462019-01-04 21:48:04 -0800384 "//frc971/control_loops:runge_kutta",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700385 "//frc971/queues:gyro",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700386 "//frc971/wpilib:imu_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700387 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000388)
389
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800390cc_library(
391 name = "drivetrain_test_lib",
392 testonly = True,
393 srcs = ["drivetrain_test_lib.cc"],
394 hdrs = ["drivetrain_test_lib.h"],
395 deps = [
396 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700397 ":drivetrain_goal_fbs",
398 ":drivetrain_output_fbs",
399 ":drivetrain_position_fbs",
400 ":drivetrain_status_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800401 ":trajectory",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700402 "//aos/events:event_loop",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800403 "//aos/testing:googletest",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700404 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800405 "//frc971/control_loops:state_feedback_loop",
406 "//frc971/queues:gyro",
407 "//y2016:constants",
408 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
409 ],
410)
411
Comran Morshed5323ecb2015-12-26 20:50:55 +0000412cc_test(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700413 name = "drivetrain_lib_test",
414 srcs = [
415 "drivetrain_lib_test.cc",
416 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700417 data = ["config.json"],
Alex Perry04300d62019-02-17 14:37:04 -0800418 defines =
419 cpu_select({
420 "amd64": [
421 "SUPPORT_PLOT=1",
422 ],
423 "arm": [],
424 }),
425 linkstatic = True,
Austin Schuhbcce26a2018-03-26 23:41:24 -0700426 deps = [
427 ":drivetrain_config",
428 ":drivetrain_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700429 ":localizer_fbs",
430 ":drivetrain_goal_fbs",
431 ":drivetrain_status_fbs",
432 ":drivetrain_position_fbs",
433 ":drivetrain_output_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800434 ":drivetrain_test_lib",
John Park33858a32018-09-28 23:05:48 -0700435 "//aos/controls:control_loop_test",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700436 "//aos/testing:googletest",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700437 "//frc971/queues:gyro",
Alex Perry04300d62019-02-17 14:37:04 -0800438 ] + cpu_select({
439 "amd64": [
440 "//third_party/matplotlib-cpp",
441 ],
442 "arm": [],
443 }),
Comran Morshed5323ecb2015-12-26 20:50:55 +0000444)
Brian Silverman6260c092018-01-14 15:21:36 -0800445
446genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700447 name = "genrule_haptic_wheel",
448 outs = [
449 "haptic_wheel.h",
450 "haptic_wheel.cc",
451 "integral_haptic_wheel.h",
452 "integral_haptic_wheel.cc",
453 "haptic_trigger.h",
454 "haptic_trigger.cc",
455 "integral_haptic_trigger.h",
456 "integral_haptic_trigger.cc",
457 ],
458 cmd = "$(location //frc971/control_loops/python:haptic_wheel) $(OUTS)",
459 compatible_with = mcu_cpus,
460 tools = [
461 "//frc971/control_loops/python:haptic_wheel",
462 ],
463 visibility = ["//visibility:private"],
Brian Silverman6260c092018-01-14 15:21:36 -0800464)
465
466cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700467 name = "haptic_input_uc",
468 srcs = [
469 "haptic_trigger.cc",
470 "haptic_wheel.cc",
471 "integral_haptic_trigger.cc",
472 "integral_haptic_wheel.cc",
473 ],
474 hdrs = [
475 "haptic_trigger.h",
476 "haptic_wheel.h",
477 "integral_haptic_trigger.h",
478 "integral_haptic_wheel.h",
479 ],
480 restricted_to = mcu_cpus,
481 deps = [
482 "//frc971/control_loops:state_feedback_loop_uc",
483 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800484)
485
486cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700487 name = "haptic_wheel",
488 srcs = [
489 "haptic_trigger.cc",
490 "haptic_wheel.cc",
491 "integral_haptic_trigger.cc",
492 "integral_haptic_wheel.cc",
493 ],
494 hdrs = [
495 "haptic_trigger.h",
496 "haptic_wheel.h",
497 "integral_haptic_trigger.h",
498 "integral_haptic_wheel.h",
499 ],
500 deps = [
501 "//frc971/control_loops:state_feedback_loop",
502 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800503)
Austin Schuhc2b08772018-12-19 18:05:06 +1100504
505cc_library(
506 name = "spline",
507 srcs = ["spline.cc"],
508 hdrs = ["spline.h"],
509 deps = [
Austin Schuhf49b4e32019-01-13 17:26:58 -0800510 "//frc971/control_loops:binomial",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700511 "@org_tuxfamily_eigen//:eigen",
Austin Schuhc2b08772018-12-19 18:05:06 +1100512 ],
513)
514
Alex Perrya60da442019-01-21 19:00:27 -0500515cc_binary(
516 name = "spline.so",
517 srcs = ["libspline.cc"],
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800518 linkshared = True,
Alex Perrya60da442019-01-21 19:00:27 -0500519 deps = [
520 ":distance_spline",
521 ":spline",
Alex Perry0603b542019-01-25 20:29:51 -0800522 ":trajectory",
523 "//aos/logging:implementations",
524 "//aos/network:team_number",
Alex Perry0603b542019-01-25 20:29:51 -0800525 "//y2019/control_loops/drivetrain:drivetrain_base",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700526 "@org_tuxfamily_eigen//:eigen",
Alex Perrya60da442019-01-21 19:00:27 -0500527 ],
Alex Perrya60da442019-01-21 19:00:27 -0500528)
529
Austin Schuhc2b08772018-12-19 18:05:06 +1100530cc_test(
531 name = "spline_test",
532 srcs = [
533 "spline_test.cc",
534 ],
535 restricted_to = ["//tools:k8"],
536 deps = [
537 ":spline",
538 "//aos/testing:googletest",
539 "//third_party/matplotlib-cpp",
540 "@com_github_gflags_gflags//:gflags",
541 ],
542)
Austin Schuh941b46d2018-12-19 18:06:05 +1100543
544cc_library(
545 name = "distance_spline",
546 srcs = ["distance_spline.cc"],
547 hdrs = ["distance_spline.h"],
548 deps = [
549 ":spline",
Austin Schuha6e7b212019-01-20 13:53:01 -0800550 "//aos/logging",
Austin Schuh941b46d2018-12-19 18:06:05 +1100551 "//frc971/control_loops:fixed_quadrature",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700552 "@org_tuxfamily_eigen//:eigen",
Austin Schuh941b46d2018-12-19 18:06:05 +1100553 ],
554)
555
556cc_test(
557 name = "distance_spline_test",
558 srcs = [
559 "distance_spline_test.cc",
560 ],
Austin Schuh9b0b6432019-01-13 21:15:17 -0800561 defines =
562 cpu_select({
563 "amd64": [
564 "SUPPORT_PLOT=1",
565 ],
566 "arm": [],
567 }),
568 linkstatic = True,
Austin Schuh941b46d2018-12-19 18:06:05 +1100569 deps = [
570 ":distance_spline",
571 "//aos/testing:googletest",
Austin Schuha6e7b212019-01-20 13:53:01 -0800572 "//aos/testing:test_shm",
Austin Schuh941b46d2018-12-19 18:06:05 +1100573 "@com_github_gflags_gflags//:gflags",
Austin Schuh9b0b6432019-01-13 21:15:17 -0800574 ] + cpu_select({
575 "amd64": [
576 "//third_party/matplotlib-cpp",
577 ],
578 "arm": [],
579 }),
Austin Schuh941b46d2018-12-19 18:06:05 +1100580)
Austin Schuhec7f06d2019-01-04 07:47:15 +1100581
582cc_library(
583 name = "trajectory",
584 srcs = ["trajectory.cc"],
585 hdrs = ["trajectory.h"],
586 deps = [
587 ":distance_spline",
588 ":drivetrain_config",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100589 "//frc971/control_loops:c2d",
590 "//frc971/control_loops:dlqr",
591 "//frc971/control_loops:hybrid_state_feedback_loop",
592 "//frc971/control_loops:runge_kutta",
593 "//frc971/control_loops:state_feedback_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700594 "@org_tuxfamily_eigen//:eigen",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100595 ],
596)
597
598cc_binary(
599 name = "trajectory_plot",
600 srcs = [
601 "trajectory_plot.cc",
602 ],
603 restricted_to = ["//tools:k8"],
604 deps = [
605 ":distance_spline",
606 ":trajectory",
607 "//aos/logging:implementations",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100608 "//aos/network:team_number",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100609 "//third_party/matplotlib-cpp",
Austin Schuh11043182019-03-23 22:29:12 -0700610 "//y2019/control_loops/drivetrain:drivetrain_base",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100611 "@com_github_gflags_gflags//:gflags",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700612 "@org_tuxfamily_eigen//:eigen",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100613 ],
614)
615
616cc_test(
617 name = "trajectory_test",
618 srcs = [
619 "trajectory_test.cc",
620 ],
Austin Schuh719a33e2019-01-07 15:13:34 -0800621 defines =
622 cpu_select({
623 "amd64": [
624 "SUPPORT_PLOT=1",
625 ],
626 "arm": [],
627 }),
628 linkstatic = True,
Austin Schuhec7f06d2019-01-04 07:47:15 +1100629 deps = [
630 ":trajectory",
631 "//aos/testing:googletest",
632 "//aos/testing:test_shm",
633 "//y2016:constants",
634 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
Austin Schuh719a33e2019-01-07 15:13:34 -0800635 ] + cpu_select({
636 "amd64": [
637 "//third_party/matplotlib-cpp",
638 ],
639 "arm": [],
640 }),
Austin Schuhec7f06d2019-01-04 07:47:15 +1100641)