blob: 30abc87f217e497e9ce39bba22422a91b15bcb75 [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",
James Kuszmaul3c5b4d32020-02-11 17:22:14 -0800155 "//aos:math",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800156 "//aos/containers:priority_queue",
James Kuszmaulfedc4612019-03-10 11:24:51 -0700157 "//aos/util:math",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800158 "//frc971/control_loops:c2d",
159 "//frc971/control_loops:runge_kutta",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700160 "@org_tuxfamily_eigen//:eigen",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800161 ],
162)
163
164cc_test(
165 name = "hybrid_ekf_test",
166 srcs = ["hybrid_ekf_test.cc"],
167 deps = [
168 ":drivetrain_test_lib",
169 ":hybrid_ekf",
170 ":trajectory",
171 "//aos/testing:googletest",
172 "//aos/testing:random_seed",
173 "//aos/testing:test_shm",
174 ],
175)
176
Alex Perrycb7da4b2019-08-28 19:35:56 -0700177flatbuffer_cc_library(
178 name = "localizer_fbs",
179 srcs = ["localizer.fbs"],
180 gen_reflections = 1,
James Kuszmaulef428a02019-03-02 22:19:41 -0800181)
182
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800183cc_library(
James Kuszmaul3431d622019-02-17 17:07:44 -0800184 name = "localizer",
185 hdrs = ["localizer.h"],
186 deps = [
187 ":drivetrain_config",
James Kuszmaul3c5b4d32020-02-11 17:22:14 -0800188 ":drivetrain_status_fbs",
James Kuszmaul3431d622019-02-17 17:07:44 -0800189 ":hybrid_ekf",
James Kuszmaul5398fae2020-02-17 16:44:03 -0800190 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul5bc6fc92019-03-01 21:50:06 -0800191 "//frc971/control_loops:pose",
James Kuszmaul3431d622019-02-17 17:07:44 -0800192 ],
193)
194
195cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700196 name = "gear",
197 hdrs = [
198 "gear.h",
199 ],
200 compatible_with = mcu_cpus,
Austin Schuh093535c2016-03-05 23:21:00 -0800201)
202
203cc_library(
Alex Perry731b4602019-02-02 22:13:01 -0800204 name = "splinedrivetrain",
205 srcs = [
206 "splinedrivetrain.cc",
207 ],
208 hdrs = [
209 "splinedrivetrain.h",
210 ],
211 deps = [
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800212 ":distance_spline",
Alex Perry731b4602019-02-02 22:13:01 -0800213 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700214 ":drivetrain_goal_fbs",
215 ":drivetrain_output_fbs",
216 ":drivetrain_status_fbs",
Alex Perry731b4602019-02-02 22:13:01 -0800217 ":spline",
Alex Perry731b4602019-02-02 22:13:01 -0800218 ":trajectory",
Alex Perry1ec34522019-02-17 22:44:10 -0800219 "//aos:init",
James Kuszmaulc73bb222019-04-07 12:15:35 -0700220 "//aos/util:math",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700221 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800222 ],
Alex Perry731b4602019-02-02 22:13:01 -0800223)
224
225cc_library(
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800226 name = "line_follow_drivetrain",
227 srcs = [
228 "line_follow_drivetrain.cc",
229 ],
230 hdrs = [
231 "line_follow_drivetrain.h",
232 ],
233 deps = [
234 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700235 ":drivetrain_goal_fbs",
236 ":drivetrain_output_fbs",
237 ":drivetrain_status_fbs",
James Kuszmaul5bc6fc92019-03-01 21:50:06 -0800238 ":localizer",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800239 "//aos:math",
240 "//aos/util:math",
241 "//frc971/control_loops:c2d",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700242 "//frc971/control_loops:control_loops_fbs",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800243 "//frc971/control_loops:dlqr",
244 "//frc971/control_loops:pose",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700245 "//frc971/control_loops:profiled_subsystem_fbs",
246 "//y2019/control_loops/superstructure:superstructure_goal_fbs",
247 "@org_tuxfamily_eigen//:eigen",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800248 ],
249)
250
251cc_test(
252 name = "line_follow_drivetrain_test",
253 srcs = ["line_follow_drivetrain_test.cc"],
254 linkstatic = True,
255 restricted_to = ["//tools:k8"],
256 deps = [
257 ":drivetrain_config",
258 ":drivetrain_test_lib",
259 ":line_follow_drivetrain",
260 ":trajectory",
261 "//aos/testing:googletest",
262 "//aos/testing:test_shm",
263 "//third_party/matplotlib-cpp",
264 "@com_github_gflags_gflags//:gflags",
265 ],
266)
267
268cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700269 name = "ssdrivetrain",
270 srcs = [
271 "ssdrivetrain.cc",
272 ],
273 hdrs = [
274 "ssdrivetrain.h",
275 ],
276 deps = [
277 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700278 ":drivetrain_goal_fbs",
279 ":drivetrain_output_fbs",
280 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700281 ":gear",
James Kuszmaul3431d622019-02-17 17:07:44 -0800282 ":localizer",
John Park33858a32018-09-28 23:05:48 -0700283 "//aos:math",
284 "//aos/controls:control_loop",
285 "//aos/controls:polytope",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700286 "//aos/robot_state:robot_state_fbs",
John Park33858a32018-09-28 23:05:48 -0700287 "//aos/util:log_interval",
288 "//aos/util:trapezoid_profile",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700289 "//frc971:shifter_hall_effect",
290 "//frc971/control_loops:coerce_goal",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700291 "//frc971/control_loops:control_loops_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700292 "//frc971/control_loops:state_feedback_loop",
293 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000294)
295
296cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700297 name = "polydrivetrain",
298 srcs = [
299 "polydrivetrain.cc",
300 ],
301 hdrs = [
302 "polydrivetrain.h",
303 ],
304 deps = [
305 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700306 ":drivetrain_goal_fbs",
307 ":drivetrain_output_fbs",
308 ":drivetrain_position_fbs",
309 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700310 ":gear",
John Park33858a32018-09-28 23:05:48 -0700311 "//aos:math",
312 "//aos/controls:polytope",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700313 "//aos/robot_state:robot_state_fbs",
John Park33858a32018-09-28 23:05:48 -0700314 "//aos/util:log_interval",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700315 "//frc971/control_loops:coerce_goal",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700316 "//frc971/control_loops:control_loops_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700317 "//frc971/control_loops:state_feedback_loop",
318 ],
319)
320
321cc_library(
322 name = "drivetrain_config_uc",
323 hdrs = [
324 "drivetrain_config.h",
325 ],
326 restricted_to = mcu_cpus,
327 deps = [
328 "//frc971:shifter_hall_effect",
329 "//frc971/control_loops:state_feedback_loop_uc",
330 ],
331)
332
333cc_library(
334 name = "polydrivetrain_uc",
335 srcs = [
Austin Schuhbcce26a2018-03-26 23:41:24 -0700336 "polydrivetrain.cc",
337 ],
338 hdrs = [
Austin Schuhbcce26a2018-03-26 23:41:24 -0700339 "polydrivetrain.h",
340 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700341 copts = ["-Wno-type-limits"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700342 restricted_to = mcu_cpus,
343 deps = [
344 ":drivetrain_config_uc",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700345 ":drivetrain_goal_float_fbs",
346 ":drivetrain_output_float_fbs",
347 ":drivetrain_position_float_fbs",
348 ":drivetrain_status_float_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700349 ":gear",
John Park33858a32018-09-28 23:05:48 -0700350 "//aos:math",
351 "//aos/controls:polytope_uc",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700352 "//frc971/control_loops:coerce_goal_uc",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700353 "//frc971/control_loops:control_loops_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700354 "//frc971/control_loops:state_feedback_loop_uc",
355 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000356)
357
Austin Schuh05c5a612016-04-02 15:10:25 -0700358genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700359 name = "genrule_down_estimator",
360 outs = [
361 "down_estimator.h",
362 "down_estimator.cc",
363 ],
364 cmd = "$(location //frc971/control_loops/python:down_estimator) $(OUTS)",
365 tools = [
366 "//frc971/control_loops/python:down_estimator",
367 ],
368 visibility = ["//visibility:private"],
Austin Schuh05c5a612016-04-02 15:10:25 -0700369)
370
371cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700372 name = "down_estimator",
373 srcs = [
374 "down_estimator.cc",
375 ],
376 hdrs = [
377 "down_estimator.h",
378 ],
379 deps = [
380 "//frc971/control_loops:state_feedback_loop",
381 ],
Austin Schuh05c5a612016-04-02 15:10:25 -0700382)
383
Comran Morshed5323ecb2015-12-26 20:50:55 +0000384cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700385 name = "drivetrain_lib",
386 srcs = [
387 "drivetrain.cc",
388 ],
389 hdrs = [
390 "drivetrain.h",
391 ],
392 deps = [
393 ":down_estimator",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700394 ":drivetrain_goal_fbs",
395 ":drivetrain_output_fbs",
396 ":drivetrain_position_fbs",
397 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700398 ":gear",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800399 ":improved_down_estimator",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800400 ":line_follow_drivetrain",
James Kuszmaul3431d622019-02-17 17:07:44 -0800401 ":localizer",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700402 ":localizer_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700403 ":polydrivetrain",
Alex Perry731b4602019-02-02 22:13:01 -0800404 ":splinedrivetrain",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800405 ":ssdrivetrain",
John Park33858a32018-09-28 23:05:48 -0700406 "//aos/controls:control_loop",
John Park33858a32018-09-28 23:05:48 -0700407 "//aos/util:log_interval",
Austin Schuh3a378462019-01-04 21:48:04 -0800408 "//frc971/control_loops:runge_kutta",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800409 "//frc971/queues:gyro_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700410 "//frc971/wpilib:imu_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800411 "//frc971/zeroing:imu_zeroer",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700412 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000413)
414
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800415cc_library(
416 name = "drivetrain_test_lib",
417 testonly = True,
418 srcs = ["drivetrain_test_lib.cc"],
419 hdrs = ["drivetrain_test_lib.h"],
James Kuszmaul74d8f972020-02-11 17:13:17 -0800420 defines =
421 cpu_select({
422 "amd64": [
423 "SUPPORT_PLOT=1",
424 ],
425 "arm": [],
426 }),
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800427 deps = [
428 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700429 ":drivetrain_goal_fbs",
430 ":drivetrain_output_fbs",
431 ":drivetrain_position_fbs",
432 ":drivetrain_status_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800433 ":trajectory",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700434 "//aos/events:event_loop",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800435 "//aos/testing:googletest",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700436 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800437 "//frc971/control_loops:state_feedback_loop",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800438 "//frc971/queues:gyro_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800439 "//frc971/wpilib:imu_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800440 "//y2016:constants",
441 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
James Kuszmaul74d8f972020-02-11 17:13:17 -0800442 ] + cpu_select({
443 "amd64": [
444 "//third_party/matplotlib-cpp",
445 ],
446 "arm": [],
447 }),
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800448)
449
Comran Morshed5323ecb2015-12-26 20:50:55 +0000450cc_test(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700451 name = "drivetrain_lib_test",
452 srcs = [
453 "drivetrain_lib_test.cc",
454 ],
James Kuszmaul74d8f972020-02-11 17:13:17 -0800455 data = ["simulation_config.json"],
Alex Perry04300d62019-02-17 14:37:04 -0800456 defines =
457 cpu_select({
458 "amd64": [
459 "SUPPORT_PLOT=1",
460 ],
461 "arm": [],
462 }),
463 linkstatic = True,
Austin Schuhbcce26a2018-03-26 23:41:24 -0700464 deps = [
465 ":drivetrain_config",
466 ":drivetrain_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700467 ":localizer_fbs",
468 ":drivetrain_goal_fbs",
469 ":drivetrain_status_fbs",
470 ":drivetrain_position_fbs",
471 ":drivetrain_output_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800472 ":drivetrain_test_lib",
John Park33858a32018-09-28 23:05:48 -0700473 "//aos/controls:control_loop_test",
James Kuszmaul74d8f972020-02-11 17:13:17 -0800474 "//aos/events/logging:logger",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700475 "//aos/testing:googletest",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800476 "//frc971/queues:gyro_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800477 "//frc971/wpilib:imu_fbs",
Alex Perry04300d62019-02-17 14:37:04 -0800478 ] + cpu_select({
479 "amd64": [
480 "//third_party/matplotlib-cpp",
481 ],
482 "arm": [],
483 }),
Comran Morshed5323ecb2015-12-26 20:50:55 +0000484)
Brian Silverman6260c092018-01-14 15:21:36 -0800485
486genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700487 name = "genrule_haptic_wheel",
488 outs = [
489 "haptic_wheel.h",
490 "haptic_wheel.cc",
491 "integral_haptic_wheel.h",
492 "integral_haptic_wheel.cc",
493 "haptic_trigger.h",
494 "haptic_trigger.cc",
495 "integral_haptic_trigger.h",
496 "integral_haptic_trigger.cc",
497 ],
498 cmd = "$(location //frc971/control_loops/python:haptic_wheel) $(OUTS)",
499 compatible_with = mcu_cpus,
500 tools = [
501 "//frc971/control_loops/python:haptic_wheel",
502 ],
503 visibility = ["//visibility:private"],
Brian Silverman6260c092018-01-14 15:21:36 -0800504)
505
506cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700507 name = "haptic_input_uc",
508 srcs = [
509 "haptic_trigger.cc",
510 "haptic_wheel.cc",
511 "integral_haptic_trigger.cc",
512 "integral_haptic_wheel.cc",
513 ],
514 hdrs = [
515 "haptic_trigger.h",
516 "haptic_wheel.h",
517 "integral_haptic_trigger.h",
518 "integral_haptic_wheel.h",
519 ],
520 restricted_to = mcu_cpus,
521 deps = [
522 "//frc971/control_loops:state_feedback_loop_uc",
523 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800524)
525
526cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700527 name = "haptic_wheel",
528 srcs = [
529 "haptic_trigger.cc",
530 "haptic_wheel.cc",
531 "integral_haptic_trigger.cc",
532 "integral_haptic_wheel.cc",
533 ],
534 hdrs = [
535 "haptic_trigger.h",
536 "haptic_wheel.h",
537 "integral_haptic_trigger.h",
538 "integral_haptic_wheel.h",
539 ],
540 deps = [
541 "//frc971/control_loops:state_feedback_loop",
542 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800543)
Austin Schuhc2b08772018-12-19 18:05:06 +1100544
545cc_library(
546 name = "spline",
547 srcs = ["spline.cc"],
548 hdrs = ["spline.h"],
549 deps = [
Austin Schuhf49b4e32019-01-13 17:26:58 -0800550 "//frc971/control_loops:binomial",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700551 "@org_tuxfamily_eigen//:eigen",
Austin Schuhc2b08772018-12-19 18:05:06 +1100552 ],
553)
554
Alex Perrya60da442019-01-21 19:00:27 -0500555cc_binary(
556 name = "spline.so",
557 srcs = ["libspline.cc"],
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800558 linkshared = True,
Alex Perrya60da442019-01-21 19:00:27 -0500559 deps = [
560 ":distance_spline",
561 ":spline",
Alex Perry0603b542019-01-25 20:29:51 -0800562 ":trajectory",
563 "//aos/logging:implementations",
564 "//aos/network:team_number",
Alex Perry0603b542019-01-25 20:29:51 -0800565 "//y2019/control_loops/drivetrain:drivetrain_base",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700566 "@org_tuxfamily_eigen//:eigen",
Alex Perrya60da442019-01-21 19:00:27 -0500567 ],
Alex Perrya60da442019-01-21 19:00:27 -0500568)
569
Austin Schuhc2b08772018-12-19 18:05:06 +1100570cc_test(
571 name = "spline_test",
572 srcs = [
573 "spline_test.cc",
574 ],
575 restricted_to = ["//tools:k8"],
576 deps = [
577 ":spline",
578 "//aos/testing:googletest",
579 "//third_party/matplotlib-cpp",
580 "@com_github_gflags_gflags//:gflags",
581 ],
582)
Austin Schuh941b46d2018-12-19 18:06:05 +1100583
584cc_library(
585 name = "distance_spline",
586 srcs = ["distance_spline.cc"],
587 hdrs = ["distance_spline.h"],
588 deps = [
589 ":spline",
Austin Schuha6e7b212019-01-20 13:53:01 -0800590 "//aos/logging",
Austin Schuh941b46d2018-12-19 18:06:05 +1100591 "//frc971/control_loops:fixed_quadrature",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700592 "@org_tuxfamily_eigen//:eigen",
Austin Schuh941b46d2018-12-19 18:06:05 +1100593 ],
594)
595
596cc_test(
597 name = "distance_spline_test",
598 srcs = [
599 "distance_spline_test.cc",
600 ],
Austin Schuh9b0b6432019-01-13 21:15:17 -0800601 defines =
602 cpu_select({
603 "amd64": [
604 "SUPPORT_PLOT=1",
605 ],
606 "arm": [],
607 }),
608 linkstatic = True,
Austin Schuh941b46d2018-12-19 18:06:05 +1100609 deps = [
610 ":distance_spline",
611 "//aos/testing:googletest",
Austin Schuha6e7b212019-01-20 13:53:01 -0800612 "//aos/testing:test_shm",
Austin Schuh941b46d2018-12-19 18:06:05 +1100613 "@com_github_gflags_gflags//:gflags",
Austin Schuh9b0b6432019-01-13 21:15:17 -0800614 ] + cpu_select({
615 "amd64": [
616 "//third_party/matplotlib-cpp",
617 ],
618 "arm": [],
619 }),
Austin Schuh941b46d2018-12-19 18:06:05 +1100620)
Austin Schuhec7f06d2019-01-04 07:47:15 +1100621
622cc_library(
623 name = "trajectory",
624 srcs = ["trajectory.cc"],
625 hdrs = ["trajectory.h"],
626 deps = [
627 ":distance_spline",
628 ":drivetrain_config",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100629 "//frc971/control_loops:c2d",
630 "//frc971/control_loops:dlqr",
631 "//frc971/control_loops:hybrid_state_feedback_loop",
632 "//frc971/control_loops:runge_kutta",
633 "//frc971/control_loops:state_feedback_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700634 "@org_tuxfamily_eigen//:eigen",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100635 ],
636)
637
638cc_binary(
639 name = "trajectory_plot",
640 srcs = [
641 "trajectory_plot.cc",
642 ],
643 restricted_to = ["//tools:k8"],
644 deps = [
645 ":distance_spline",
646 ":trajectory",
647 "//aos/logging:implementations",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100648 "//aos/network:team_number",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100649 "//third_party/matplotlib-cpp",
Austin Schuh11043182019-03-23 22:29:12 -0700650 "//y2019/control_loops/drivetrain:drivetrain_base",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100651 "@com_github_gflags_gflags//:gflags",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700652 "@org_tuxfamily_eigen//:eigen",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100653 ],
654)
655
656cc_test(
657 name = "trajectory_test",
658 srcs = [
659 "trajectory_test.cc",
660 ],
Austin Schuh719a33e2019-01-07 15:13:34 -0800661 defines =
662 cpu_select({
663 "amd64": [
664 "SUPPORT_PLOT=1",
665 ],
666 "arm": [],
667 }),
668 linkstatic = True,
Austin Schuhec7f06d2019-01-04 07:47:15 +1100669 deps = [
670 ":trajectory",
James Kuszmaulea314d92019-02-18 19:45:06 -0800671 ":drivetrain_test_lib",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100672 "//aos/testing:googletest",
673 "//aos/testing:test_shm",
674 "//y2016:constants",
675 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
James Kuszmaulea314d92019-02-18 19:45:06 -0800676 "//y2019/control_loops/drivetrain:drivetrain_base",
Austin Schuh719a33e2019-01-07 15:13:34 -0800677 ] + cpu_select({
678 "amd64": [
679 "//third_party/matplotlib-cpp",
680 ],
681 "arm": [],
682 }),
Austin Schuhec7f06d2019-01-04 07:47:15 +1100683)
Austin Schuhca080812017-05-10 19:31:55 -0700684
685cc_library(
686 name = "improved_down_estimator",
687 srcs = [
688 "improved_down_estimator.cc",
689 ],
690 hdrs = [
691 "improved_down_estimator.h",
692 ],
693 deps = [
James Kuszmaul7f55f072020-03-01 10:21:26 -0800694 ":drivetrain_config",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800695 ":drivetrain_status_fbs",
696 "//aos/events:event_loop",
697 "//frc971/control_loops:control_loops_fbs",
Austin Schuhca080812017-05-10 19:31:55 -0700698 "//frc971/control_loops:runge_kutta",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800699 "@//aos/time",
Austin Schuhca080812017-05-10 19:31:55 -0700700 "@com_github_google_glog//:glog",
701 "@org_tuxfamily_eigen//:eigen",
702 ],
703)
704
705cc_test(
706 name = "improved_down_estimator_test",
707 srcs = [
708 "improved_down_estimator_test.cc",
709 ],
710 deps = [
James Kuszmaul7f55f072020-03-01 10:21:26 -0800711 ":drivetrain_test_lib",
Austin Schuhca080812017-05-10 19:31:55 -0700712 "//aos/testing:googletest",
713 "//aos/testing:random_seed",
714 "//frc971/control_loops/drivetrain:improved_down_estimator",
715 "@org_tuxfamily_eigen//:eigen",
716 ],
717)
James Kuszmaulf4ede202020-02-14 08:47:40 -0800718
719cc_library(
720 name = "camera",
721 srcs = ["camera.h"],
722 visibility = ["//visibility:public"],
723 deps = [
724 "//aos/containers:sized_array",
725 "//frc971/control_loops:pose",
726 ],
727)
728
729cc_test(
730 name = "camera_test",
731 srcs = ["camera_test.cc"],
732 deps = [
733 ":camera",
734 "//aos/testing:googletest",
735 ],
736)