blob: 2c9447393b84dbf52feb938cd6f3e7dff2f33c40 [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(
James Kuszmaul74d8f972020-02-11 17:13:17 -0800101 name = "simulation_channels",
102 src = "drivetrain_simulation_channels.json",
103 flatbuffers = [
104 ":drivetrain_status_fbs",
105 ],
106 visibility = ["//visibility:public"],
107)
108
109aos_config(
110 name = "simulation_config",
111 src = "drivetrain_simulation_config.json",
112 visibility = ["//visibility:public"],
113 deps = [
114 ":config",
115 ":simulation_channels",
116 ],
117)
118
119aos_config(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700120 name = "config",
121 src = "drivetrain_config.json",
122 flatbuffers = [
123 ":drivetrain_goal_fbs",
124 ":drivetrain_output_fbs",
125 ":drivetrain_status_fbs",
126 ":drivetrain_position_fbs",
127 ":localizer_fbs",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800128 "//frc971/queues:gyro_fbs",
129 "//frc971/queues:gyro_uid_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700130 "//frc971/wpilib:imu_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700131 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700132 visibility = ["//visibility:public"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700133 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700134 "//aos/robot_state:config",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700135 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000136)
137
138cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700139 name = "drivetrain_config",
140 hdrs = [
141 "drivetrain_config.h",
142 ],
143 deps = [
144 "//frc971:shifter_hall_effect",
Austin Schuha062edb2019-01-03 13:17:13 -0800145 "//frc971/control_loops:hybrid_state_feedback_loop",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700146 "//frc971/control_loops:state_feedback_loop",
147 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000148)
149
150cc_library(
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800151 name = "hybrid_ekf",
152 hdrs = ["hybrid_ekf.h"],
153 deps = [
154 ":drivetrain_config",
155 "//aos/containers:priority_queue",
James Kuszmaulfedc4612019-03-10 11:24:51 -0700156 "//aos/util:math",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800157 "//frc971/control_loops:c2d",
158 "//frc971/control_loops:runge_kutta",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700159 "@org_tuxfamily_eigen//:eigen",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800160 ],
161)
162
163cc_test(
164 name = "hybrid_ekf_test",
165 srcs = ["hybrid_ekf_test.cc"],
166 deps = [
167 ":drivetrain_test_lib",
168 ":hybrid_ekf",
169 ":trajectory",
170 "//aos/testing:googletest",
171 "//aos/testing:random_seed",
172 "//aos/testing:test_shm",
173 ],
174)
175
Alex Perrycb7da4b2019-08-28 19:35:56 -0700176flatbuffer_cc_library(
177 name = "localizer_fbs",
178 srcs = ["localizer.fbs"],
179 gen_reflections = 1,
James Kuszmaulef428a02019-03-02 22:19:41 -0800180)
181
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800182cc_library(
James Kuszmaul3431d622019-02-17 17:07:44 -0800183 name = "localizer",
184 hdrs = ["localizer.h"],
185 deps = [
186 ":drivetrain_config",
187 ":hybrid_ekf",
James Kuszmaul5bc6fc92019-03-01 21:50:06 -0800188 "//frc971/control_loops:pose",
James Kuszmaul3431d622019-02-17 17:07:44 -0800189 ],
190)
191
192cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700193 name = "gear",
194 hdrs = [
195 "gear.h",
196 ],
197 compatible_with = mcu_cpus,
Austin Schuh093535c2016-03-05 23:21:00 -0800198)
199
200cc_library(
Alex Perry731b4602019-02-02 22:13:01 -0800201 name = "splinedrivetrain",
202 srcs = [
203 "splinedrivetrain.cc",
204 ],
205 hdrs = [
206 "splinedrivetrain.h",
207 ],
208 deps = [
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800209 ":distance_spline",
Alex Perry731b4602019-02-02 22:13:01 -0800210 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700211 ":drivetrain_goal_fbs",
212 ":drivetrain_output_fbs",
213 ":drivetrain_status_fbs",
Alex Perry731b4602019-02-02 22:13:01 -0800214 ":spline",
Alex Perry731b4602019-02-02 22:13:01 -0800215 ":trajectory",
Alex Perry1ec34522019-02-17 22:44:10 -0800216 "//aos:init",
James Kuszmaulc73bb222019-04-07 12:15:35 -0700217 "//aos/util:math",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700218 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800219 ],
Alex Perry731b4602019-02-02 22:13:01 -0800220)
221
222cc_library(
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800223 name = "line_follow_drivetrain",
224 srcs = [
225 "line_follow_drivetrain.cc",
226 ],
227 hdrs = [
228 "line_follow_drivetrain.h",
229 ],
230 deps = [
231 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700232 ":drivetrain_goal_fbs",
233 ":drivetrain_output_fbs",
234 ":drivetrain_status_fbs",
James Kuszmaul5bc6fc92019-03-01 21:50:06 -0800235 ":localizer",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800236 "//aos:math",
237 "//aos/util:math",
238 "//frc971/control_loops:c2d",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700239 "//frc971/control_loops:control_loops_fbs",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800240 "//frc971/control_loops:dlqr",
241 "//frc971/control_loops:pose",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700242 "//frc971/control_loops:profiled_subsystem_fbs",
243 "//y2019/control_loops/superstructure:superstructure_goal_fbs",
244 "@org_tuxfamily_eigen//:eigen",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800245 ],
246)
247
248cc_test(
249 name = "line_follow_drivetrain_test",
250 srcs = ["line_follow_drivetrain_test.cc"],
251 linkstatic = True,
252 restricted_to = ["//tools:k8"],
253 deps = [
254 ":drivetrain_config",
255 ":drivetrain_test_lib",
256 ":line_follow_drivetrain",
257 ":trajectory",
258 "//aos/testing:googletest",
259 "//aos/testing:test_shm",
260 "//third_party/matplotlib-cpp",
261 "@com_github_gflags_gflags//:gflags",
262 ],
263)
264
265cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700266 name = "ssdrivetrain",
267 srcs = [
268 "ssdrivetrain.cc",
269 ],
270 hdrs = [
271 "ssdrivetrain.h",
272 ],
273 deps = [
274 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700275 ":drivetrain_goal_fbs",
276 ":drivetrain_output_fbs",
277 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700278 ":gear",
James Kuszmaul3431d622019-02-17 17:07:44 -0800279 ":localizer",
John Park33858a32018-09-28 23:05:48 -0700280 "//aos:math",
281 "//aos/controls:control_loop",
282 "//aos/controls:polytope",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700283 "//aos/robot_state:robot_state_fbs",
John Park33858a32018-09-28 23:05:48 -0700284 "//aos/util:log_interval",
285 "//aos/util:trapezoid_profile",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700286 "//frc971:shifter_hall_effect",
287 "//frc971/control_loops:coerce_goal",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700288 "//frc971/control_loops:control_loops_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700289 "//frc971/control_loops:state_feedback_loop",
290 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000291)
292
293cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700294 name = "polydrivetrain",
295 srcs = [
296 "polydrivetrain.cc",
297 ],
298 hdrs = [
299 "polydrivetrain.h",
300 ],
301 deps = [
302 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700303 ":drivetrain_goal_fbs",
304 ":drivetrain_output_fbs",
305 ":drivetrain_position_fbs",
306 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700307 ":gear",
John Park33858a32018-09-28 23:05:48 -0700308 "//aos:math",
309 "//aos/controls:polytope",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700310 "//aos/robot_state:robot_state_fbs",
John Park33858a32018-09-28 23:05:48 -0700311 "//aos/util:log_interval",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700312 "//frc971/control_loops:coerce_goal",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700313 "//frc971/control_loops:control_loops_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700314 "//frc971/control_loops:state_feedback_loop",
315 ],
316)
317
318cc_library(
319 name = "drivetrain_config_uc",
320 hdrs = [
321 "drivetrain_config.h",
322 ],
323 restricted_to = mcu_cpus,
324 deps = [
325 "//frc971:shifter_hall_effect",
326 "//frc971/control_loops:state_feedback_loop_uc",
327 ],
328)
329
330cc_library(
331 name = "polydrivetrain_uc",
332 srcs = [
Austin Schuhbcce26a2018-03-26 23:41:24 -0700333 "polydrivetrain.cc",
334 ],
335 hdrs = [
Austin Schuhbcce26a2018-03-26 23:41:24 -0700336 "polydrivetrain.h",
337 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700338 copts = ["-Wno-type-limits"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700339 restricted_to = mcu_cpus,
340 deps = [
341 ":drivetrain_config_uc",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700342 ":drivetrain_goal_float_fbs",
343 ":drivetrain_output_float_fbs",
344 ":drivetrain_position_float_fbs",
345 ":drivetrain_status_float_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700346 ":gear",
John Park33858a32018-09-28 23:05:48 -0700347 "//aos:math",
348 "//aos/controls:polytope_uc",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700349 "//frc971/control_loops:coerce_goal_uc",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700350 "//frc971/control_loops:control_loops_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700351 "//frc971/control_loops:state_feedback_loop_uc",
352 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000353)
354
Austin Schuh05c5a612016-04-02 15:10:25 -0700355genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700356 name = "genrule_down_estimator",
357 outs = [
358 "down_estimator.h",
359 "down_estimator.cc",
360 ],
361 cmd = "$(location //frc971/control_loops/python:down_estimator) $(OUTS)",
362 tools = [
363 "//frc971/control_loops/python:down_estimator",
364 ],
365 visibility = ["//visibility:private"],
Austin Schuh05c5a612016-04-02 15:10:25 -0700366)
367
368cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700369 name = "down_estimator",
370 srcs = [
371 "down_estimator.cc",
372 ],
373 hdrs = [
374 "down_estimator.h",
375 ],
376 deps = [
377 "//frc971/control_loops:state_feedback_loop",
378 ],
Austin Schuh05c5a612016-04-02 15:10:25 -0700379)
380
Comran Morshed5323ecb2015-12-26 20:50:55 +0000381cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700382 name = "drivetrain_lib",
383 srcs = [
384 "drivetrain.cc",
385 ],
386 hdrs = [
387 "drivetrain.h",
388 ],
389 deps = [
390 ":down_estimator",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700391 ":drivetrain_goal_fbs",
392 ":drivetrain_output_fbs",
393 ":drivetrain_position_fbs",
394 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700395 ":gear",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800396 ":improved_down_estimator",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800397 ":line_follow_drivetrain",
James Kuszmaul3431d622019-02-17 17:07:44 -0800398 ":localizer",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700399 ":localizer_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700400 ":polydrivetrain",
Alex Perry731b4602019-02-02 22:13:01 -0800401 ":splinedrivetrain",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800402 ":ssdrivetrain",
John Park33858a32018-09-28 23:05:48 -0700403 "//aos/controls:control_loop",
John Park33858a32018-09-28 23:05:48 -0700404 "//aos/util:log_interval",
Austin Schuh3a378462019-01-04 21:48:04 -0800405 "//frc971/control_loops:runge_kutta",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800406 "//frc971/queues:gyro_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700407 "//frc971/wpilib:imu_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800408 "//frc971/zeroing:imu_zeroer",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700409 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000410)
411
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800412cc_library(
413 name = "drivetrain_test_lib",
414 testonly = True,
415 srcs = ["drivetrain_test_lib.cc"],
416 hdrs = ["drivetrain_test_lib.h"],
James Kuszmaul74d8f972020-02-11 17:13:17 -0800417 defines =
418 cpu_select({
419 "amd64": [
420 "SUPPORT_PLOT=1",
421 ],
422 "arm": [],
423 }),
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800424 deps = [
425 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700426 ":drivetrain_goal_fbs",
427 ":drivetrain_output_fbs",
428 ":drivetrain_position_fbs",
429 ":drivetrain_status_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800430 ":trajectory",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700431 "//aos/events:event_loop",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800432 "//aos/testing:googletest",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700433 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800434 "//frc971/control_loops:state_feedback_loop",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800435 "//frc971/queues:gyro_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800436 "//frc971/wpilib:imu_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800437 "//y2016:constants",
438 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
James Kuszmaul74d8f972020-02-11 17:13:17 -0800439 ] + cpu_select({
440 "amd64": [
441 "//third_party/matplotlib-cpp",
442 ],
443 "arm": [],
444 }),
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800445)
446
Comran Morshed5323ecb2015-12-26 20:50:55 +0000447cc_test(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700448 name = "drivetrain_lib_test",
449 srcs = [
450 "drivetrain_lib_test.cc",
451 ],
James Kuszmaul74d8f972020-02-11 17:13:17 -0800452 data = ["simulation_config.json"],
Alex Perry04300d62019-02-17 14:37:04 -0800453 defines =
454 cpu_select({
455 "amd64": [
456 "SUPPORT_PLOT=1",
457 ],
458 "arm": [],
459 }),
460 linkstatic = True,
Austin Schuhbcce26a2018-03-26 23:41:24 -0700461 deps = [
462 ":drivetrain_config",
463 ":drivetrain_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700464 ":localizer_fbs",
465 ":drivetrain_goal_fbs",
466 ":drivetrain_status_fbs",
467 ":drivetrain_position_fbs",
468 ":drivetrain_output_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800469 ":drivetrain_test_lib",
John Park33858a32018-09-28 23:05:48 -0700470 "//aos/controls:control_loop_test",
James Kuszmaul74d8f972020-02-11 17:13:17 -0800471 "//aos/events/logging:logger",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700472 "//aos/testing:googletest",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800473 "//frc971/queues:gyro_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800474 "//frc971/wpilib:imu_fbs",
Alex Perry04300d62019-02-17 14:37:04 -0800475 ] + cpu_select({
476 "amd64": [
477 "//third_party/matplotlib-cpp",
478 ],
479 "arm": [],
480 }),
Comran Morshed5323ecb2015-12-26 20:50:55 +0000481)
Brian Silverman6260c092018-01-14 15:21:36 -0800482
483genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700484 name = "genrule_haptic_wheel",
485 outs = [
486 "haptic_wheel.h",
487 "haptic_wheel.cc",
488 "integral_haptic_wheel.h",
489 "integral_haptic_wheel.cc",
490 "haptic_trigger.h",
491 "haptic_trigger.cc",
492 "integral_haptic_trigger.h",
493 "integral_haptic_trigger.cc",
494 ],
495 cmd = "$(location //frc971/control_loops/python:haptic_wheel) $(OUTS)",
496 compatible_with = mcu_cpus,
497 tools = [
498 "//frc971/control_loops/python:haptic_wheel",
499 ],
500 visibility = ["//visibility:private"],
Brian Silverman6260c092018-01-14 15:21:36 -0800501)
502
503cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700504 name = "haptic_input_uc",
505 srcs = [
506 "haptic_trigger.cc",
507 "haptic_wheel.cc",
508 "integral_haptic_trigger.cc",
509 "integral_haptic_wheel.cc",
510 ],
511 hdrs = [
512 "haptic_trigger.h",
513 "haptic_wheel.h",
514 "integral_haptic_trigger.h",
515 "integral_haptic_wheel.h",
516 ],
517 restricted_to = mcu_cpus,
518 deps = [
519 "//frc971/control_loops:state_feedback_loop_uc",
520 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800521)
522
523cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700524 name = "haptic_wheel",
525 srcs = [
526 "haptic_trigger.cc",
527 "haptic_wheel.cc",
528 "integral_haptic_trigger.cc",
529 "integral_haptic_wheel.cc",
530 ],
531 hdrs = [
532 "haptic_trigger.h",
533 "haptic_wheel.h",
534 "integral_haptic_trigger.h",
535 "integral_haptic_wheel.h",
536 ],
537 deps = [
538 "//frc971/control_loops:state_feedback_loop",
539 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800540)
Austin Schuhc2b08772018-12-19 18:05:06 +1100541
542cc_library(
543 name = "spline",
544 srcs = ["spline.cc"],
545 hdrs = ["spline.h"],
546 deps = [
Austin Schuhf49b4e32019-01-13 17:26:58 -0800547 "//frc971/control_loops:binomial",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700548 "@org_tuxfamily_eigen//:eigen",
Austin Schuhc2b08772018-12-19 18:05:06 +1100549 ],
550)
551
Alex Perrya60da442019-01-21 19:00:27 -0500552cc_binary(
553 name = "spline.so",
554 srcs = ["libspline.cc"],
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800555 linkshared = True,
Alex Perrya60da442019-01-21 19:00:27 -0500556 deps = [
557 ":distance_spline",
558 ":spline",
Alex Perry0603b542019-01-25 20:29:51 -0800559 ":trajectory",
560 "//aos/logging:implementations",
561 "//aos/network:team_number",
Alex Perry0603b542019-01-25 20:29:51 -0800562 "//y2019/control_loops/drivetrain:drivetrain_base",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700563 "@org_tuxfamily_eigen//:eigen",
Alex Perrya60da442019-01-21 19:00:27 -0500564 ],
Alex Perrya60da442019-01-21 19:00:27 -0500565)
566
Austin Schuhc2b08772018-12-19 18:05:06 +1100567cc_test(
568 name = "spline_test",
569 srcs = [
570 "spline_test.cc",
571 ],
572 restricted_to = ["//tools:k8"],
573 deps = [
574 ":spline",
575 "//aos/testing:googletest",
576 "//third_party/matplotlib-cpp",
577 "@com_github_gflags_gflags//:gflags",
578 ],
579)
Austin Schuh941b46d2018-12-19 18:06:05 +1100580
581cc_library(
582 name = "distance_spline",
583 srcs = ["distance_spline.cc"],
584 hdrs = ["distance_spline.h"],
585 deps = [
586 ":spline",
Austin Schuha6e7b212019-01-20 13:53:01 -0800587 "//aos/logging",
Austin Schuh941b46d2018-12-19 18:06:05 +1100588 "//frc971/control_loops:fixed_quadrature",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700589 "@org_tuxfamily_eigen//:eigen",
Austin Schuh941b46d2018-12-19 18:06:05 +1100590 ],
591)
592
593cc_test(
594 name = "distance_spline_test",
595 srcs = [
596 "distance_spline_test.cc",
597 ],
Austin Schuh9b0b6432019-01-13 21:15:17 -0800598 defines =
599 cpu_select({
600 "amd64": [
601 "SUPPORT_PLOT=1",
602 ],
603 "arm": [],
604 }),
605 linkstatic = True,
Austin Schuh941b46d2018-12-19 18:06:05 +1100606 deps = [
607 ":distance_spline",
608 "//aos/testing:googletest",
Austin Schuha6e7b212019-01-20 13:53:01 -0800609 "//aos/testing:test_shm",
Austin Schuh941b46d2018-12-19 18:06:05 +1100610 "@com_github_gflags_gflags//:gflags",
Austin Schuh9b0b6432019-01-13 21:15:17 -0800611 ] + cpu_select({
612 "amd64": [
613 "//third_party/matplotlib-cpp",
614 ],
615 "arm": [],
616 }),
Austin Schuh941b46d2018-12-19 18:06:05 +1100617)
Austin Schuhec7f06d2019-01-04 07:47:15 +1100618
619cc_library(
620 name = "trajectory",
621 srcs = ["trajectory.cc"],
622 hdrs = ["trajectory.h"],
623 deps = [
624 ":distance_spline",
625 ":drivetrain_config",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100626 "//frc971/control_loops:c2d",
627 "//frc971/control_loops:dlqr",
628 "//frc971/control_loops:hybrid_state_feedback_loop",
629 "//frc971/control_loops:runge_kutta",
630 "//frc971/control_loops:state_feedback_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700631 "@org_tuxfamily_eigen//:eigen",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100632 ],
633)
634
635cc_binary(
636 name = "trajectory_plot",
637 srcs = [
638 "trajectory_plot.cc",
639 ],
640 restricted_to = ["//tools:k8"],
641 deps = [
642 ":distance_spline",
643 ":trajectory",
644 "//aos/logging:implementations",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100645 "//aos/network:team_number",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100646 "//third_party/matplotlib-cpp",
Austin Schuh11043182019-03-23 22:29:12 -0700647 "//y2019/control_loops/drivetrain:drivetrain_base",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100648 "@com_github_gflags_gflags//:gflags",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700649 "@org_tuxfamily_eigen//:eigen",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100650 ],
651)
652
653cc_test(
654 name = "trajectory_test",
655 srcs = [
656 "trajectory_test.cc",
657 ],
Austin Schuh719a33e2019-01-07 15:13:34 -0800658 defines =
659 cpu_select({
660 "amd64": [
661 "SUPPORT_PLOT=1",
662 ],
663 "arm": [],
664 }),
665 linkstatic = True,
Austin Schuhec7f06d2019-01-04 07:47:15 +1100666 deps = [
667 ":trajectory",
James Kuszmaulea314d92019-02-18 19:45:06 -0800668 ":drivetrain_test_lib",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100669 "//aos/testing:googletest",
670 "//aos/testing:test_shm",
671 "//y2016:constants",
672 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
James Kuszmaulea314d92019-02-18 19:45:06 -0800673 "//y2019/control_loops/drivetrain:drivetrain_base",
Austin Schuh719a33e2019-01-07 15:13:34 -0800674 ] + cpu_select({
675 "amd64": [
676 "//third_party/matplotlib-cpp",
677 ],
678 "arm": [],
679 }),
Austin Schuhec7f06d2019-01-04 07:47:15 +1100680)
Austin Schuhca080812017-05-10 19:31:55 -0700681
682cc_library(
683 name = "improved_down_estimator",
684 srcs = [
685 "improved_down_estimator.cc",
686 ],
687 hdrs = [
688 "improved_down_estimator.h",
689 ],
690 deps = [
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800691 ":drivetrain_status_fbs",
692 "//aos/events:event_loop",
693 "//frc971/control_loops:control_loops_fbs",
Austin Schuhca080812017-05-10 19:31:55 -0700694 "//frc971/control_loops:runge_kutta",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800695 "@//aos/time",
Austin Schuhca080812017-05-10 19:31:55 -0700696 "@com_github_google_glog//:glog",
697 "@org_tuxfamily_eigen//:eigen",
698 ],
699)
700
701cc_test(
702 name = "improved_down_estimator_test",
703 srcs = [
704 "improved_down_estimator_test.cc",
705 ],
706 deps = [
707 "//aos/testing:googletest",
708 "//aos/testing:random_seed",
709 "//frc971/control_loops/drivetrain:improved_down_estimator",
710 "@org_tuxfamily_eigen//:eigen",
711 ],
712)
James Kuszmaulf4ede202020-02-14 08:47:40 -0800713
714cc_library(
715 name = "camera",
716 srcs = ["camera.h"],
717 visibility = ["//visibility:public"],
718 deps = [
719 "//aos/containers:sized_array",
720 "//frc971/control_loops:pose",
721 ],
722)
723
724cc_test(
725 name = "camera_test",
726 srcs = ["camera_test.cc"],
727 deps = [
728 ":camera",
729 "//aos/testing:googletest",
730 ],
731)