blob: 35aebc79ba12d7aa49e09df5510528e7b20f4aa4 [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 Kuszmaul5bc6fc92019-03-01 21:50:06 -0800190 "//frc971/control_loops:pose",
James Kuszmaul3431d622019-02-17 17:07:44 -0800191 ],
192)
193
194cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700195 name = "gear",
196 hdrs = [
197 "gear.h",
198 ],
199 compatible_with = mcu_cpus,
Austin Schuh093535c2016-03-05 23:21:00 -0800200)
201
202cc_library(
Alex Perry731b4602019-02-02 22:13:01 -0800203 name = "splinedrivetrain",
204 srcs = [
205 "splinedrivetrain.cc",
206 ],
207 hdrs = [
208 "splinedrivetrain.h",
209 ],
210 deps = [
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800211 ":distance_spline",
Alex Perry731b4602019-02-02 22:13:01 -0800212 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700213 ":drivetrain_goal_fbs",
214 ":drivetrain_output_fbs",
215 ":drivetrain_status_fbs",
Alex Perry731b4602019-02-02 22:13:01 -0800216 ":spline",
Alex Perry731b4602019-02-02 22:13:01 -0800217 ":trajectory",
Alex Perry1ec34522019-02-17 22:44:10 -0800218 "//aos:init",
James Kuszmaulc73bb222019-04-07 12:15:35 -0700219 "//aos/util:math",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700220 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800221 ],
Alex Perry731b4602019-02-02 22:13:01 -0800222)
223
224cc_library(
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800225 name = "line_follow_drivetrain",
226 srcs = [
227 "line_follow_drivetrain.cc",
228 ],
229 hdrs = [
230 "line_follow_drivetrain.h",
231 ],
232 deps = [
233 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700234 ":drivetrain_goal_fbs",
235 ":drivetrain_output_fbs",
236 ":drivetrain_status_fbs",
James Kuszmaul5bc6fc92019-03-01 21:50:06 -0800237 ":localizer",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800238 "//aos:math",
239 "//aos/util:math",
240 "//frc971/control_loops:c2d",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700241 "//frc971/control_loops:control_loops_fbs",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800242 "//frc971/control_loops:dlqr",
243 "//frc971/control_loops:pose",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700244 "//frc971/control_loops:profiled_subsystem_fbs",
245 "//y2019/control_loops/superstructure:superstructure_goal_fbs",
246 "@org_tuxfamily_eigen//:eigen",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800247 ],
248)
249
250cc_test(
251 name = "line_follow_drivetrain_test",
252 srcs = ["line_follow_drivetrain_test.cc"],
253 linkstatic = True,
254 restricted_to = ["//tools:k8"],
255 deps = [
256 ":drivetrain_config",
257 ":drivetrain_test_lib",
258 ":line_follow_drivetrain",
259 ":trajectory",
260 "//aos/testing:googletest",
261 "//aos/testing:test_shm",
262 "//third_party/matplotlib-cpp",
263 "@com_github_gflags_gflags//:gflags",
264 ],
265)
266
267cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700268 name = "ssdrivetrain",
269 srcs = [
270 "ssdrivetrain.cc",
271 ],
272 hdrs = [
273 "ssdrivetrain.h",
274 ],
275 deps = [
276 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700277 ":drivetrain_goal_fbs",
278 ":drivetrain_output_fbs",
279 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700280 ":gear",
James Kuszmaul3431d622019-02-17 17:07:44 -0800281 ":localizer",
John Park33858a32018-09-28 23:05:48 -0700282 "//aos:math",
283 "//aos/controls:control_loop",
284 "//aos/controls:polytope",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700285 "//aos/robot_state:robot_state_fbs",
John Park33858a32018-09-28 23:05:48 -0700286 "//aos/util:log_interval",
287 "//aos/util:trapezoid_profile",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700288 "//frc971:shifter_hall_effect",
289 "//frc971/control_loops:coerce_goal",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700290 "//frc971/control_loops:control_loops_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700291 "//frc971/control_loops:state_feedback_loop",
292 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000293)
294
295cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700296 name = "polydrivetrain",
297 srcs = [
298 "polydrivetrain.cc",
299 ],
300 hdrs = [
301 "polydrivetrain.h",
302 ],
303 deps = [
304 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700305 ":drivetrain_goal_fbs",
306 ":drivetrain_output_fbs",
307 ":drivetrain_position_fbs",
308 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700309 ":gear",
John Park33858a32018-09-28 23:05:48 -0700310 "//aos:math",
311 "//aos/controls:polytope",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700312 "//aos/robot_state:robot_state_fbs",
John Park33858a32018-09-28 23:05:48 -0700313 "//aos/util:log_interval",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700314 "//frc971/control_loops:coerce_goal",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700315 "//frc971/control_loops:control_loops_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700316 "//frc971/control_loops:state_feedback_loop",
317 ],
318)
319
320cc_library(
321 name = "drivetrain_config_uc",
322 hdrs = [
323 "drivetrain_config.h",
324 ],
325 restricted_to = mcu_cpus,
326 deps = [
327 "//frc971:shifter_hall_effect",
328 "//frc971/control_loops:state_feedback_loop_uc",
329 ],
330)
331
332cc_library(
333 name = "polydrivetrain_uc",
334 srcs = [
Austin Schuhbcce26a2018-03-26 23:41:24 -0700335 "polydrivetrain.cc",
336 ],
337 hdrs = [
Austin Schuhbcce26a2018-03-26 23:41:24 -0700338 "polydrivetrain.h",
339 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700340 copts = ["-Wno-type-limits"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700341 restricted_to = mcu_cpus,
342 deps = [
343 ":drivetrain_config_uc",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700344 ":drivetrain_goal_float_fbs",
345 ":drivetrain_output_float_fbs",
346 ":drivetrain_position_float_fbs",
347 ":drivetrain_status_float_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700348 ":gear",
John Park33858a32018-09-28 23:05:48 -0700349 "//aos:math",
350 "//aos/controls:polytope_uc",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700351 "//frc971/control_loops:coerce_goal_uc",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700352 "//frc971/control_loops:control_loops_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700353 "//frc971/control_loops:state_feedback_loop_uc",
354 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000355)
356
Austin Schuh05c5a612016-04-02 15:10:25 -0700357genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700358 name = "genrule_down_estimator",
359 outs = [
360 "down_estimator.h",
361 "down_estimator.cc",
362 ],
363 cmd = "$(location //frc971/control_loops/python:down_estimator) $(OUTS)",
364 tools = [
365 "//frc971/control_loops/python:down_estimator",
366 ],
367 visibility = ["//visibility:private"],
Austin Schuh05c5a612016-04-02 15:10:25 -0700368)
369
370cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700371 name = "down_estimator",
372 srcs = [
373 "down_estimator.cc",
374 ],
375 hdrs = [
376 "down_estimator.h",
377 ],
378 deps = [
379 "//frc971/control_loops:state_feedback_loop",
380 ],
Austin Schuh05c5a612016-04-02 15:10:25 -0700381)
382
Comran Morshed5323ecb2015-12-26 20:50:55 +0000383cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700384 name = "drivetrain_lib",
385 srcs = [
386 "drivetrain.cc",
387 ],
388 hdrs = [
389 "drivetrain.h",
390 ],
391 deps = [
392 ":down_estimator",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700393 ":drivetrain_goal_fbs",
394 ":drivetrain_output_fbs",
395 ":drivetrain_position_fbs",
396 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700397 ":gear",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800398 ":improved_down_estimator",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800399 ":line_follow_drivetrain",
James Kuszmaul3431d622019-02-17 17:07:44 -0800400 ":localizer",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700401 ":localizer_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700402 ":polydrivetrain",
Alex Perry731b4602019-02-02 22:13:01 -0800403 ":splinedrivetrain",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800404 ":ssdrivetrain",
John Park33858a32018-09-28 23:05:48 -0700405 "//aos/controls:control_loop",
John Park33858a32018-09-28 23:05:48 -0700406 "//aos/util:log_interval",
Austin Schuh3a378462019-01-04 21:48:04 -0800407 "//frc971/control_loops:runge_kutta",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800408 "//frc971/queues:gyro_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700409 "//frc971/wpilib:imu_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800410 "//frc971/zeroing:imu_zeroer",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700411 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000412)
413
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800414cc_library(
415 name = "drivetrain_test_lib",
416 testonly = True,
417 srcs = ["drivetrain_test_lib.cc"],
418 hdrs = ["drivetrain_test_lib.h"],
James Kuszmaul74d8f972020-02-11 17:13:17 -0800419 defines =
420 cpu_select({
421 "amd64": [
422 "SUPPORT_PLOT=1",
423 ],
424 "arm": [],
425 }),
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800426 deps = [
427 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700428 ":drivetrain_goal_fbs",
429 ":drivetrain_output_fbs",
430 ":drivetrain_position_fbs",
431 ":drivetrain_status_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800432 ":trajectory",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700433 "//aos/events:event_loop",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800434 "//aos/testing:googletest",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700435 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800436 "//frc971/control_loops:state_feedback_loop",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800437 "//frc971/queues:gyro_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800438 "//frc971/wpilib:imu_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800439 "//y2016:constants",
440 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
James Kuszmaul74d8f972020-02-11 17:13:17 -0800441 ] + cpu_select({
442 "amd64": [
443 "//third_party/matplotlib-cpp",
444 ],
445 "arm": [],
446 }),
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800447)
448
Comran Morshed5323ecb2015-12-26 20:50:55 +0000449cc_test(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700450 name = "drivetrain_lib_test",
451 srcs = [
452 "drivetrain_lib_test.cc",
453 ],
James Kuszmaul74d8f972020-02-11 17:13:17 -0800454 data = ["simulation_config.json"],
Alex Perry04300d62019-02-17 14:37:04 -0800455 defines =
456 cpu_select({
457 "amd64": [
458 "SUPPORT_PLOT=1",
459 ],
460 "arm": [],
461 }),
462 linkstatic = True,
Austin Schuhbcce26a2018-03-26 23:41:24 -0700463 deps = [
464 ":drivetrain_config",
465 ":drivetrain_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700466 ":localizer_fbs",
467 ":drivetrain_goal_fbs",
468 ":drivetrain_status_fbs",
469 ":drivetrain_position_fbs",
470 ":drivetrain_output_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800471 ":drivetrain_test_lib",
John Park33858a32018-09-28 23:05:48 -0700472 "//aos/controls:control_loop_test",
James Kuszmaul74d8f972020-02-11 17:13:17 -0800473 "//aos/events/logging:logger",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700474 "//aos/testing:googletest",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800475 "//frc971/queues:gyro_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800476 "//frc971/wpilib:imu_fbs",
Alex Perry04300d62019-02-17 14:37:04 -0800477 ] + cpu_select({
478 "amd64": [
479 "//third_party/matplotlib-cpp",
480 ],
481 "arm": [],
482 }),
Comran Morshed5323ecb2015-12-26 20:50:55 +0000483)
Brian Silverman6260c092018-01-14 15:21:36 -0800484
485genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700486 name = "genrule_haptic_wheel",
487 outs = [
488 "haptic_wheel.h",
489 "haptic_wheel.cc",
490 "integral_haptic_wheel.h",
491 "integral_haptic_wheel.cc",
492 "haptic_trigger.h",
493 "haptic_trigger.cc",
494 "integral_haptic_trigger.h",
495 "integral_haptic_trigger.cc",
496 ],
497 cmd = "$(location //frc971/control_loops/python:haptic_wheel) $(OUTS)",
498 compatible_with = mcu_cpus,
499 tools = [
500 "//frc971/control_loops/python:haptic_wheel",
501 ],
502 visibility = ["//visibility:private"],
Brian Silverman6260c092018-01-14 15:21:36 -0800503)
504
505cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700506 name = "haptic_input_uc",
507 srcs = [
508 "haptic_trigger.cc",
509 "haptic_wheel.cc",
510 "integral_haptic_trigger.cc",
511 "integral_haptic_wheel.cc",
512 ],
513 hdrs = [
514 "haptic_trigger.h",
515 "haptic_wheel.h",
516 "integral_haptic_trigger.h",
517 "integral_haptic_wheel.h",
518 ],
519 restricted_to = mcu_cpus,
520 deps = [
521 "//frc971/control_loops:state_feedback_loop_uc",
522 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800523)
524
525cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700526 name = "haptic_wheel",
527 srcs = [
528 "haptic_trigger.cc",
529 "haptic_wheel.cc",
530 "integral_haptic_trigger.cc",
531 "integral_haptic_wheel.cc",
532 ],
533 hdrs = [
534 "haptic_trigger.h",
535 "haptic_wheel.h",
536 "integral_haptic_trigger.h",
537 "integral_haptic_wheel.h",
538 ],
539 deps = [
540 "//frc971/control_loops:state_feedback_loop",
541 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800542)
Austin Schuhc2b08772018-12-19 18:05:06 +1100543
544cc_library(
545 name = "spline",
546 srcs = ["spline.cc"],
547 hdrs = ["spline.h"],
548 deps = [
Austin Schuhf49b4e32019-01-13 17:26:58 -0800549 "//frc971/control_loops:binomial",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700550 "@org_tuxfamily_eigen//:eigen",
Austin Schuhc2b08772018-12-19 18:05:06 +1100551 ],
552)
553
Alex Perrya60da442019-01-21 19:00:27 -0500554cc_binary(
555 name = "spline.so",
556 srcs = ["libspline.cc"],
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800557 linkshared = True,
Alex Perrya60da442019-01-21 19:00:27 -0500558 deps = [
559 ":distance_spline",
560 ":spline",
Alex Perry0603b542019-01-25 20:29:51 -0800561 ":trajectory",
562 "//aos/logging:implementations",
563 "//aos/network:team_number",
Alex Perry0603b542019-01-25 20:29:51 -0800564 "//y2019/control_loops/drivetrain:drivetrain_base",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700565 "@org_tuxfamily_eigen//:eigen",
Alex Perrya60da442019-01-21 19:00:27 -0500566 ],
Alex Perrya60da442019-01-21 19:00:27 -0500567)
568
Austin Schuhc2b08772018-12-19 18:05:06 +1100569cc_test(
570 name = "spline_test",
571 srcs = [
572 "spline_test.cc",
573 ],
574 restricted_to = ["//tools:k8"],
575 deps = [
576 ":spline",
577 "//aos/testing:googletest",
578 "//third_party/matplotlib-cpp",
579 "@com_github_gflags_gflags//:gflags",
580 ],
581)
Austin Schuh941b46d2018-12-19 18:06:05 +1100582
583cc_library(
584 name = "distance_spline",
585 srcs = ["distance_spline.cc"],
586 hdrs = ["distance_spline.h"],
587 deps = [
588 ":spline",
Austin Schuha6e7b212019-01-20 13:53:01 -0800589 "//aos/logging",
Austin Schuh941b46d2018-12-19 18:06:05 +1100590 "//frc971/control_loops:fixed_quadrature",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700591 "@org_tuxfamily_eigen//:eigen",
Austin Schuh941b46d2018-12-19 18:06:05 +1100592 ],
593)
594
595cc_test(
596 name = "distance_spline_test",
597 srcs = [
598 "distance_spline_test.cc",
599 ],
Austin Schuh9b0b6432019-01-13 21:15:17 -0800600 defines =
601 cpu_select({
602 "amd64": [
603 "SUPPORT_PLOT=1",
604 ],
605 "arm": [],
606 }),
607 linkstatic = True,
Austin Schuh941b46d2018-12-19 18:06:05 +1100608 deps = [
609 ":distance_spline",
610 "//aos/testing:googletest",
Austin Schuha6e7b212019-01-20 13:53:01 -0800611 "//aos/testing:test_shm",
Austin Schuh941b46d2018-12-19 18:06:05 +1100612 "@com_github_gflags_gflags//:gflags",
Austin Schuh9b0b6432019-01-13 21:15:17 -0800613 ] + cpu_select({
614 "amd64": [
615 "//third_party/matplotlib-cpp",
616 ],
617 "arm": [],
618 }),
Austin Schuh941b46d2018-12-19 18:06:05 +1100619)
Austin Schuhec7f06d2019-01-04 07:47:15 +1100620
621cc_library(
622 name = "trajectory",
623 srcs = ["trajectory.cc"],
624 hdrs = ["trajectory.h"],
625 deps = [
626 ":distance_spline",
627 ":drivetrain_config",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100628 "//frc971/control_loops:c2d",
629 "//frc971/control_loops:dlqr",
630 "//frc971/control_loops:hybrid_state_feedback_loop",
631 "//frc971/control_loops:runge_kutta",
632 "//frc971/control_loops:state_feedback_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700633 "@org_tuxfamily_eigen//:eigen",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100634 ],
635)
636
637cc_binary(
638 name = "trajectory_plot",
639 srcs = [
640 "trajectory_plot.cc",
641 ],
642 restricted_to = ["//tools:k8"],
643 deps = [
644 ":distance_spline",
645 ":trajectory",
646 "//aos/logging:implementations",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100647 "//aos/network:team_number",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100648 "//third_party/matplotlib-cpp",
Austin Schuh11043182019-03-23 22:29:12 -0700649 "//y2019/control_loops/drivetrain:drivetrain_base",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100650 "@com_github_gflags_gflags//:gflags",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700651 "@org_tuxfamily_eigen//:eigen",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100652 ],
653)
654
655cc_test(
656 name = "trajectory_test",
657 srcs = [
658 "trajectory_test.cc",
659 ],
Austin Schuh719a33e2019-01-07 15:13:34 -0800660 defines =
661 cpu_select({
662 "amd64": [
663 "SUPPORT_PLOT=1",
664 ],
665 "arm": [],
666 }),
667 linkstatic = True,
Austin Schuhec7f06d2019-01-04 07:47:15 +1100668 deps = [
669 ":trajectory",
James Kuszmaulea314d92019-02-18 19:45:06 -0800670 ":drivetrain_test_lib",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100671 "//aos/testing:googletest",
672 "//aos/testing:test_shm",
673 "//y2016:constants",
674 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
James Kuszmaulea314d92019-02-18 19:45:06 -0800675 "//y2019/control_loops/drivetrain:drivetrain_base",
Austin Schuh719a33e2019-01-07 15:13:34 -0800676 ] + cpu_select({
677 "amd64": [
678 "//third_party/matplotlib-cpp",
679 ],
680 "arm": [],
681 }),
Austin Schuhec7f06d2019-01-04 07:47:15 +1100682)
Austin Schuhca080812017-05-10 19:31:55 -0700683
684cc_library(
685 name = "improved_down_estimator",
686 srcs = [
687 "improved_down_estimator.cc",
688 ],
689 hdrs = [
690 "improved_down_estimator.h",
691 ],
692 deps = [
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800693 ":drivetrain_status_fbs",
694 "//aos/events:event_loop",
695 "//frc971/control_loops:control_loops_fbs",
Austin Schuhca080812017-05-10 19:31:55 -0700696 "//frc971/control_loops:runge_kutta",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800697 "@//aos/time",
Austin Schuhca080812017-05-10 19:31:55 -0700698 "@com_github_google_glog//:glog",
699 "@org_tuxfamily_eigen//:eigen",
700 ],
701)
702
703cc_test(
704 name = "improved_down_estimator_test",
705 srcs = [
706 "improved_down_estimator_test.cc",
707 ],
708 deps = [
709 "//aos/testing:googletest",
710 "//aos/testing:random_seed",
711 "//frc971/control_loops/drivetrain:improved_down_estimator",
712 "@org_tuxfamily_eigen//:eigen",
713 ],
714)
James Kuszmaulf4ede202020-02-14 08:47:40 -0800715
716cc_library(
717 name = "camera",
718 srcs = ["camera.h"],
719 visibility = ["//visibility:public"],
720 deps = [
721 "//aos/containers:sized_array",
722 "//frc971/control_loops:pose",
723 ],
724)
725
726cc_test(
727 name = "camera_test",
728 srcs = ["camera_test.cc"],
729 deps = [
730 ":camera",
731 "//aos/testing:googletest",
732 ],
733)