blob: 2e357c7ebc8d6036e2ce47f854b7ddb22f4b8770 [file] [log] [blame]
Austin Schuhbcce26a2018-03-26 23:41:24 -07001package(default_visibility = ["//visibility:public"])
Comran Morshed5323ecb2015-12-26 20:50:55 +00002
Alex Perry2124ae82020-03-07 14:19:06 -08003load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_ts_library")
Alex Perrycb7da4b2019-08-28 19:35:56 -07004load("//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
Alex Perry2124ae82020-03-07 14:19:06 -080038flatbuffer_ts_library(
39 name = "drivetrain_status_ts_fbs",
40 srcs = ["drivetrain_status.fbs"],
41 includes = ["//frc971/control_loops:control_loops_fbs_includes"],
42)
43
Alex Perrycb7da4b2019-08-28 19:35:56 -070044genrule(
45 name = "drivetrain_goal_float_fbs_generated",
46 srcs = ["drivetrain_goal.fbs"],
47 outs = ["drivetrain_goal_float.fbs"],
48 cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
49 compatible_with = mcu_cpus,
50)
51
52genrule(
53 name = "drivetrain_position_float_fbs_generated",
54 srcs = ["drivetrain_position.fbs"],
55 outs = ["drivetrain_position_float.fbs"],
56 cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
57 compatible_with = mcu_cpus,
58)
59
60genrule(
61 name = "drivetrain_output_float_fbs_generated",
62 srcs = ["drivetrain_output.fbs"],
63 outs = ["drivetrain_output_float.fbs"],
64 cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
65 compatible_with = mcu_cpus,
66)
67
68genrule(
69 name = "drivetrain_status_float_fbs_generated",
70 srcs = ["drivetrain_status.fbs"],
71 outs = ["drivetrain_status_float.fbs"],
72 cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
73 compatible_with = mcu_cpus,
74)
75
76flatbuffer_cc_library(
77 name = "drivetrain_goal_float_fbs",
78 srcs = ["drivetrain_goal_float.fbs"],
79 compatible_with = mcu_cpus,
80 gen_reflections = 1,
81 includes = ["//frc971/control_loops:control_loops_fbs_includes"],
82)
83
84flatbuffer_cc_library(
85 name = "drivetrain_output_float_fbs",
86 srcs = ["drivetrain_output_float.fbs"],
87 compatible_with = mcu_cpus,
88 gen_reflections = 1,
89)
90
91flatbuffer_cc_library(
92 name = "drivetrain_position_float_fbs",
93 srcs = ["drivetrain_position_float.fbs"],
94 compatible_with = mcu_cpus,
95 gen_reflections = 1,
96)
97
98flatbuffer_cc_library(
99 name = "drivetrain_status_float_fbs",
100 srcs = ["drivetrain_status_float.fbs"],
101 compatible_with = mcu_cpus,
102 gen_reflections = 1,
103 includes = ["//frc971/control_loops:control_loops_fbs_includes"],
104)
105
106aos_config(
James Kuszmaul74d8f972020-02-11 17:13:17 -0800107 name = "simulation_channels",
108 src = "drivetrain_simulation_channels.json",
109 flatbuffers = [
110 ":drivetrain_status_fbs",
111 ],
112 visibility = ["//visibility:public"],
113)
114
115aos_config(
116 name = "simulation_config",
117 src = "drivetrain_simulation_config.json",
118 visibility = ["//visibility:public"],
119 deps = [
120 ":config",
121 ":simulation_channels",
122 ],
123)
124
125aos_config(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700126 name = "config",
127 src = "drivetrain_config.json",
128 flatbuffers = [
129 ":drivetrain_goal_fbs",
130 ":drivetrain_output_fbs",
131 ":drivetrain_status_fbs",
132 ":drivetrain_position_fbs",
133 ":localizer_fbs",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800134 "//frc971/queues:gyro_fbs",
135 "//frc971/queues:gyro_uid_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700136 "//frc971/wpilib:imu_fbs",
Austin Schuhac17fba2020-03-28 15:55:33 -0700137 "//frc971/wpilib:imu_batch_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700138 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700139 visibility = ["//visibility:public"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700140 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700141 "//aos/robot_state:config",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700142 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000143)
144
145cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700146 name = "drivetrain_config",
147 hdrs = [
148 "drivetrain_config.h",
149 ],
150 deps = [
151 "//frc971:shifter_hall_effect",
Austin Schuha062edb2019-01-03 13:17:13 -0800152 "//frc971/control_loops:hybrid_state_feedback_loop",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700153 "//frc971/control_loops:state_feedback_loop",
154 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000155)
156
157cc_library(
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800158 name = "hybrid_ekf",
159 hdrs = ["hybrid_ekf.h"],
160 deps = [
161 ":drivetrain_config",
James Kuszmaul3c5b4d32020-02-11 17:22:14 -0800162 "//aos:math",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800163 "//aos/containers:priority_queue",
James Kuszmaulfedc4612019-03-10 11:24:51 -0700164 "//aos/util:math",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800165 "//frc971/control_loops:c2d",
166 "//frc971/control_loops:runge_kutta",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700167 "@org_tuxfamily_eigen//:eigen",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800168 ],
169)
170
171cc_test(
172 name = "hybrid_ekf_test",
173 srcs = ["hybrid_ekf_test.cc"],
174 deps = [
175 ":drivetrain_test_lib",
176 ":hybrid_ekf",
177 ":trajectory",
178 "//aos/testing:googletest",
179 "//aos/testing:random_seed",
180 "//aos/testing:test_shm",
181 ],
182)
183
Alex Perrycb7da4b2019-08-28 19:35:56 -0700184flatbuffer_cc_library(
185 name = "localizer_fbs",
186 srcs = ["localizer.fbs"],
187 gen_reflections = 1,
James Kuszmaulef428a02019-03-02 22:19:41 -0800188)
189
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800190cc_library(
James Kuszmaul3431d622019-02-17 17:07:44 -0800191 name = "localizer",
192 hdrs = ["localizer.h"],
193 deps = [
194 ":drivetrain_config",
James Kuszmaul3c5b4d32020-02-11 17:22:14 -0800195 ":drivetrain_status_fbs",
James Kuszmaul3431d622019-02-17 17:07:44 -0800196 ":hybrid_ekf",
James Kuszmaul5398fae2020-02-17 16:44:03 -0800197 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul5bc6fc92019-03-01 21:50:06 -0800198 "//frc971/control_loops:pose",
James Kuszmaul3431d622019-02-17 17:07:44 -0800199 ],
200)
201
202cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700203 name = "gear",
204 hdrs = [
205 "gear.h",
206 ],
207 compatible_with = mcu_cpus,
Austin Schuh093535c2016-03-05 23:21:00 -0800208)
209
210cc_library(
Alex Perry731b4602019-02-02 22:13:01 -0800211 name = "splinedrivetrain",
212 srcs = [
213 "splinedrivetrain.cc",
214 ],
215 hdrs = [
216 "splinedrivetrain.h",
217 ],
218 deps = [
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800219 ":distance_spline",
Alex Perry731b4602019-02-02 22:13:01 -0800220 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700221 ":drivetrain_goal_fbs",
222 ":drivetrain_output_fbs",
223 ":drivetrain_status_fbs",
Alex Perry731b4602019-02-02 22:13:01 -0800224 ":spline",
Alex Perry731b4602019-02-02 22:13:01 -0800225 ":trajectory",
Austin Schuh3d9ccd72020-08-01 15:42:40 -0700226 "//aos:condition",
Alex Perry1ec34522019-02-17 22:44:10 -0800227 "//aos:init",
James Kuszmaulc73bb222019-04-07 12:15:35 -0700228 "//aos/util:math",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700229 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800230 ],
Alex Perry731b4602019-02-02 22:13:01 -0800231)
232
233cc_library(
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800234 name = "line_follow_drivetrain",
235 srcs = [
236 "line_follow_drivetrain.cc",
237 ],
238 hdrs = [
239 "line_follow_drivetrain.h",
240 ],
241 deps = [
242 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700243 ":drivetrain_goal_fbs",
244 ":drivetrain_output_fbs",
245 ":drivetrain_status_fbs",
James Kuszmaul5bc6fc92019-03-01 21:50:06 -0800246 ":localizer",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800247 "//aos:math",
248 "//aos/util:math",
249 "//frc971/control_loops:c2d",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700250 "//frc971/control_loops:control_loops_fbs",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800251 "//frc971/control_loops:dlqr",
252 "//frc971/control_loops:pose",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700253 "//frc971/control_loops:profiled_subsystem_fbs",
254 "//y2019/control_loops/superstructure:superstructure_goal_fbs",
255 "@org_tuxfamily_eigen//:eigen",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800256 ],
257)
258
259cc_test(
260 name = "line_follow_drivetrain_test",
261 srcs = ["line_follow_drivetrain_test.cc"],
262 linkstatic = True,
263 restricted_to = ["//tools:k8"],
264 deps = [
265 ":drivetrain_config",
266 ":drivetrain_test_lib",
267 ":line_follow_drivetrain",
268 ":trajectory",
269 "//aos/testing:googletest",
270 "//aos/testing:test_shm",
271 "//third_party/matplotlib-cpp",
272 "@com_github_gflags_gflags//:gflags",
273 ],
274)
275
276cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700277 name = "ssdrivetrain",
278 srcs = [
279 "ssdrivetrain.cc",
280 ],
281 hdrs = [
282 "ssdrivetrain.h",
283 ],
284 deps = [
285 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700286 ":drivetrain_goal_fbs",
287 ":drivetrain_output_fbs",
288 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700289 ":gear",
James Kuszmaul3431d622019-02-17 17:07:44 -0800290 ":localizer",
John Park33858a32018-09-28 23:05:48 -0700291 "//aos:math",
292 "//aos/controls:control_loop",
293 "//aos/controls:polytope",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700294 "//aos/robot_state:robot_state_fbs",
John Park33858a32018-09-28 23:05:48 -0700295 "//aos/util:log_interval",
296 "//aos/util:trapezoid_profile",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700297 "//frc971:shifter_hall_effect",
298 "//frc971/control_loops:coerce_goal",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700299 "//frc971/control_loops:control_loops_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700300 "//frc971/control_loops:state_feedback_loop",
301 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000302)
303
304cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700305 name = "polydrivetrain",
306 srcs = [
307 "polydrivetrain.cc",
308 ],
309 hdrs = [
310 "polydrivetrain.h",
311 ],
312 deps = [
313 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700314 ":drivetrain_goal_fbs",
315 ":drivetrain_output_fbs",
316 ":drivetrain_position_fbs",
317 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700318 ":gear",
John Park33858a32018-09-28 23:05:48 -0700319 "//aos:math",
320 "//aos/controls:polytope",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700321 "//aos/robot_state:robot_state_fbs",
John Park33858a32018-09-28 23:05:48 -0700322 "//aos/util:log_interval",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700323 "//frc971/control_loops:coerce_goal",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700324 "//frc971/control_loops:control_loops_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700325 "//frc971/control_loops:state_feedback_loop",
326 ],
327)
328
329cc_library(
330 name = "drivetrain_config_uc",
331 hdrs = [
332 "drivetrain_config.h",
333 ],
334 restricted_to = mcu_cpus,
335 deps = [
336 "//frc971:shifter_hall_effect",
337 "//frc971/control_loops:state_feedback_loop_uc",
338 ],
339)
340
341cc_library(
342 name = "polydrivetrain_uc",
343 srcs = [
Austin Schuhbcce26a2018-03-26 23:41:24 -0700344 "polydrivetrain.cc",
345 ],
346 hdrs = [
Austin Schuhbcce26a2018-03-26 23:41:24 -0700347 "polydrivetrain.h",
348 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700349 copts = ["-Wno-type-limits"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700350 restricted_to = mcu_cpus,
351 deps = [
352 ":drivetrain_config_uc",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700353 ":drivetrain_goal_float_fbs",
354 ":drivetrain_output_float_fbs",
355 ":drivetrain_position_float_fbs",
356 ":drivetrain_status_float_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700357 ":gear",
John Park33858a32018-09-28 23:05:48 -0700358 "//aos:math",
359 "//aos/controls:polytope_uc",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700360 "//frc971/control_loops:coerce_goal_uc",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700361 "//frc971/control_loops:control_loops_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700362 "//frc971/control_loops:state_feedback_loop_uc",
363 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000364)
365
Austin Schuh05c5a612016-04-02 15:10:25 -0700366genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700367 name = "genrule_down_estimator",
368 outs = [
369 "down_estimator.h",
370 "down_estimator.cc",
371 ],
372 cmd = "$(location //frc971/control_loops/python:down_estimator) $(OUTS)",
373 tools = [
374 "//frc971/control_loops/python:down_estimator",
375 ],
376 visibility = ["//visibility:private"],
Austin Schuh05c5a612016-04-02 15:10:25 -0700377)
378
379cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700380 name = "down_estimator",
381 srcs = [
382 "down_estimator.cc",
383 ],
384 hdrs = [
385 "down_estimator.h",
386 ],
387 deps = [
388 "//frc971/control_loops:state_feedback_loop",
389 ],
Austin Schuh05c5a612016-04-02 15:10:25 -0700390)
391
Comran Morshed5323ecb2015-12-26 20:50:55 +0000392cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700393 name = "drivetrain_lib",
394 srcs = [
395 "drivetrain.cc",
396 ],
397 hdrs = [
398 "drivetrain.h",
399 ],
400 deps = [
401 ":down_estimator",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700402 ":drivetrain_goal_fbs",
403 ":drivetrain_output_fbs",
404 ":drivetrain_position_fbs",
405 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700406 ":gear",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800407 ":improved_down_estimator",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800408 ":line_follow_drivetrain",
James Kuszmaul3431d622019-02-17 17:07:44 -0800409 ":localizer",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700410 ":localizer_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700411 ":polydrivetrain",
Alex Perry731b4602019-02-02 22:13:01 -0800412 ":splinedrivetrain",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800413 ":ssdrivetrain",
John Park33858a32018-09-28 23:05:48 -0700414 "//aos/controls:control_loop",
John Park33858a32018-09-28 23:05:48 -0700415 "//aos/util:log_interval",
Austin Schuh3a378462019-01-04 21:48:04 -0800416 "//frc971/control_loops:runge_kutta",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800417 "//frc971/queues:gyro_fbs",
Austin Schuhac17fba2020-03-28 15:55:33 -0700418 "//frc971/wpilib:imu_batch_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700419 "//frc971/wpilib:imu_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800420 "//frc971/zeroing:imu_zeroer",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700421 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000422)
423
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800424cc_library(
425 name = "drivetrain_test_lib",
426 testonly = True,
427 srcs = ["drivetrain_test_lib.cc"],
428 hdrs = ["drivetrain_test_lib.h"],
James Kuszmaul74d8f972020-02-11 17:13:17 -0800429 defines =
430 cpu_select({
431 "amd64": [
432 "SUPPORT_PLOT=1",
433 ],
434 "arm": [],
435 }),
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800436 deps = [
437 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700438 ":drivetrain_goal_fbs",
439 ":drivetrain_output_fbs",
440 ":drivetrain_position_fbs",
441 ":drivetrain_status_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800442 ":trajectory",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700443 "//aos/events:event_loop",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800444 "//aos/testing:googletest",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700445 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800446 "//frc971/control_loops:state_feedback_loop",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800447 "//frc971/queues:gyro_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800448 "//frc971/wpilib:imu_fbs",
Austin Schuhac17fba2020-03-28 15:55:33 -0700449 "//frc971/wpilib:imu_batch_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800450 "//y2016:constants",
451 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
James Kuszmaul74d8f972020-02-11 17:13:17 -0800452 ] + cpu_select({
453 "amd64": [
454 "//third_party/matplotlib-cpp",
455 ],
456 "arm": [],
457 }),
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800458)
459
Comran Morshed5323ecb2015-12-26 20:50:55 +0000460cc_test(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700461 name = "drivetrain_lib_test",
462 srcs = [
463 "drivetrain_lib_test.cc",
464 ],
James Kuszmaul74d8f972020-02-11 17:13:17 -0800465 data = ["simulation_config.json"],
Alex Perry04300d62019-02-17 14:37:04 -0800466 defines =
467 cpu_select({
468 "amd64": [
469 "SUPPORT_PLOT=1",
470 ],
471 "arm": [],
472 }),
473 linkstatic = True,
Austin Schuhbcce26a2018-03-26 23:41:24 -0700474 deps = [
475 ":drivetrain_config",
476 ":drivetrain_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700477 ":localizer_fbs",
478 ":drivetrain_goal_fbs",
479 ":drivetrain_status_fbs",
480 ":drivetrain_position_fbs",
481 ":drivetrain_output_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800482 ":drivetrain_test_lib",
John Park33858a32018-09-28 23:05:48 -0700483 "//aos/controls:control_loop_test",
James Kuszmaul74d8f972020-02-11 17:13:17 -0800484 "//aos/events/logging:logger",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700485 "//aos/testing:googletest",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800486 "//frc971/queues:gyro_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800487 "//frc971/wpilib:imu_fbs",
Alex Perry04300d62019-02-17 14:37:04 -0800488 ] + cpu_select({
489 "amd64": [
490 "//third_party/matplotlib-cpp",
491 ],
492 "arm": [],
493 }),
Comran Morshed5323ecb2015-12-26 20:50:55 +0000494)
Brian Silverman6260c092018-01-14 15:21:36 -0800495
496genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700497 name = "genrule_haptic_wheel",
498 outs = [
499 "haptic_wheel.h",
500 "haptic_wheel.cc",
501 "integral_haptic_wheel.h",
502 "integral_haptic_wheel.cc",
503 "haptic_trigger.h",
504 "haptic_trigger.cc",
505 "integral_haptic_trigger.h",
506 "integral_haptic_trigger.cc",
507 ],
508 cmd = "$(location //frc971/control_loops/python:haptic_wheel) $(OUTS)",
509 compatible_with = mcu_cpus,
510 tools = [
511 "//frc971/control_loops/python:haptic_wheel",
512 ],
513 visibility = ["//visibility:private"],
Brian Silverman6260c092018-01-14 15:21:36 -0800514)
515
516cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700517 name = "haptic_input_uc",
518 srcs = [
519 "haptic_trigger.cc",
520 "haptic_wheel.cc",
521 "integral_haptic_trigger.cc",
522 "integral_haptic_wheel.cc",
523 ],
524 hdrs = [
525 "haptic_trigger.h",
526 "haptic_wheel.h",
527 "integral_haptic_trigger.h",
528 "integral_haptic_wheel.h",
529 ],
530 restricted_to = mcu_cpus,
531 deps = [
532 "//frc971/control_loops:state_feedback_loop_uc",
533 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800534)
535
536cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700537 name = "haptic_wheel",
538 srcs = [
539 "haptic_trigger.cc",
540 "haptic_wheel.cc",
541 "integral_haptic_trigger.cc",
542 "integral_haptic_wheel.cc",
543 ],
544 hdrs = [
545 "haptic_trigger.h",
546 "haptic_wheel.h",
547 "integral_haptic_trigger.h",
548 "integral_haptic_wheel.h",
549 ],
550 deps = [
551 "//frc971/control_loops:state_feedback_loop",
552 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800553)
Austin Schuhc2b08772018-12-19 18:05:06 +1100554
555cc_library(
556 name = "spline",
557 srcs = ["spline.cc"],
558 hdrs = ["spline.h"],
559 deps = [
Austin Schuhf49b4e32019-01-13 17:26:58 -0800560 "//frc971/control_loops:binomial",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700561 "@org_tuxfamily_eigen//:eigen",
Austin Schuhc2b08772018-12-19 18:05:06 +1100562 ],
563)
564
Alex Perrya60da442019-01-21 19:00:27 -0500565cc_binary(
566 name = "spline.so",
567 srcs = ["libspline.cc"],
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800568 linkshared = True,
Alex Perrya60da442019-01-21 19:00:27 -0500569 deps = [
570 ":distance_spline",
571 ":spline",
Alex Perry0603b542019-01-25 20:29:51 -0800572 ":trajectory",
573 "//aos/logging:implementations",
574 "//aos/network:team_number",
James Kuszmaul8aa37cb2020-03-01 10:27:58 -0800575 "//y2020/control_loops/drivetrain:drivetrain_base",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700576 "@org_tuxfamily_eigen//:eigen",
Alex Perrya60da442019-01-21 19:00:27 -0500577 ],
Alex Perrya60da442019-01-21 19:00:27 -0500578)
579
Austin Schuhc2b08772018-12-19 18:05:06 +1100580cc_test(
581 name = "spline_test",
582 srcs = [
583 "spline_test.cc",
584 ],
585 restricted_to = ["//tools:k8"],
586 deps = [
587 ":spline",
588 "//aos/testing:googletest",
589 "//third_party/matplotlib-cpp",
590 "@com_github_gflags_gflags//:gflags",
591 ],
592)
Austin Schuh941b46d2018-12-19 18:06:05 +1100593
594cc_library(
595 name = "distance_spline",
596 srcs = ["distance_spline.cc"],
597 hdrs = ["distance_spline.h"],
598 deps = [
599 ":spline",
Austin Schuha6e7b212019-01-20 13:53:01 -0800600 "//aos/logging",
Austin Schuh941b46d2018-12-19 18:06:05 +1100601 "//frc971/control_loops:fixed_quadrature",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700602 "@org_tuxfamily_eigen//:eigen",
Austin Schuh941b46d2018-12-19 18:06:05 +1100603 ],
604)
605
606cc_test(
607 name = "distance_spline_test",
608 srcs = [
609 "distance_spline_test.cc",
610 ],
Austin Schuh9b0b6432019-01-13 21:15:17 -0800611 defines =
612 cpu_select({
613 "amd64": [
614 "SUPPORT_PLOT=1",
615 ],
616 "arm": [],
617 }),
618 linkstatic = True,
Austin Schuh941b46d2018-12-19 18:06:05 +1100619 deps = [
620 ":distance_spline",
621 "//aos/testing:googletest",
Austin Schuha6e7b212019-01-20 13:53:01 -0800622 "//aos/testing:test_shm",
Austin Schuh941b46d2018-12-19 18:06:05 +1100623 "@com_github_gflags_gflags//:gflags",
Austin Schuh9b0b6432019-01-13 21:15:17 -0800624 ] + cpu_select({
625 "amd64": [
626 "//third_party/matplotlib-cpp",
627 ],
628 "arm": [],
629 }),
Austin Schuh941b46d2018-12-19 18:06:05 +1100630)
Austin Schuhec7f06d2019-01-04 07:47:15 +1100631
632cc_library(
633 name = "trajectory",
634 srcs = ["trajectory.cc"],
635 hdrs = ["trajectory.h"],
636 deps = [
637 ":distance_spline",
638 ":drivetrain_config",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100639 "//frc971/control_loops:c2d",
640 "//frc971/control_loops:dlqr",
641 "//frc971/control_loops:hybrid_state_feedback_loop",
642 "//frc971/control_loops:runge_kutta",
643 "//frc971/control_loops:state_feedback_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700644 "@org_tuxfamily_eigen//:eigen",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100645 ],
646)
647
648cc_binary(
649 name = "trajectory_plot",
650 srcs = [
651 "trajectory_plot.cc",
652 ],
653 restricted_to = ["//tools:k8"],
654 deps = [
655 ":distance_spline",
656 ":trajectory",
657 "//aos/logging:implementations",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100658 "//aos/network:team_number",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100659 "//third_party/matplotlib-cpp",
Austin Schuh11043182019-03-23 22:29:12 -0700660 "//y2019/control_loops/drivetrain:drivetrain_base",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100661 "@com_github_gflags_gflags//:gflags",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700662 "@org_tuxfamily_eigen//:eigen",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100663 ],
664)
665
666cc_test(
667 name = "trajectory_test",
668 srcs = [
669 "trajectory_test.cc",
670 ],
Austin Schuh719a33e2019-01-07 15:13:34 -0800671 defines =
672 cpu_select({
673 "amd64": [
674 "SUPPORT_PLOT=1",
675 ],
676 "arm": [],
677 }),
678 linkstatic = True,
Austin Schuhec7f06d2019-01-04 07:47:15 +1100679 deps = [
680 ":trajectory",
James Kuszmaulea314d92019-02-18 19:45:06 -0800681 ":drivetrain_test_lib",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100682 "//aos/testing:googletest",
683 "//aos/testing:test_shm",
684 "//y2016:constants",
685 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
James Kuszmaulea314d92019-02-18 19:45:06 -0800686 "//y2019/control_loops/drivetrain:drivetrain_base",
Austin Schuh719a33e2019-01-07 15:13:34 -0800687 ] + cpu_select({
688 "amd64": [
689 "//third_party/matplotlib-cpp",
690 ],
691 "arm": [],
692 }),
Austin Schuhec7f06d2019-01-04 07:47:15 +1100693)
Austin Schuhca080812017-05-10 19:31:55 -0700694
695cc_library(
696 name = "improved_down_estimator",
697 srcs = [
698 "improved_down_estimator.cc",
699 ],
700 hdrs = [
701 "improved_down_estimator.h",
702 ],
703 deps = [
James Kuszmaul7f55f072020-03-01 10:21:26 -0800704 ":drivetrain_config",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800705 ":drivetrain_status_fbs",
Brian Silvermandac0a4b2020-06-23 17:03:09 -0700706 "//aos/controls:quaternion_utils",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800707 "//aos/events:event_loop",
708 "//frc971/control_loops:control_loops_fbs",
Austin Schuhca080812017-05-10 19:31:55 -0700709 "//frc971/control_loops:runge_kutta",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800710 "@//aos/time",
Austin Schuhca080812017-05-10 19:31:55 -0700711 "@com_github_google_glog//:glog",
712 "@org_tuxfamily_eigen//:eigen",
713 ],
714)
715
716cc_test(
717 name = "improved_down_estimator_test",
718 srcs = [
719 "improved_down_estimator_test.cc",
720 ],
721 deps = [
James Kuszmaul7f55f072020-03-01 10:21:26 -0800722 ":drivetrain_test_lib",
Brian Silvermandac0a4b2020-06-23 17:03:09 -0700723 "//aos/controls:quaternion_utils",
Austin Schuhca080812017-05-10 19:31:55 -0700724 "//aos/testing:googletest",
725 "//aos/testing:random_seed",
726 "//frc971/control_loops/drivetrain:improved_down_estimator",
727 "@org_tuxfamily_eigen//:eigen",
728 ],
729)
James Kuszmaulf4ede202020-02-14 08:47:40 -0800730
731cc_library(
732 name = "camera",
733 srcs = ["camera.h"],
734 visibility = ["//visibility:public"],
735 deps = [
736 "//aos/containers:sized_array",
737 "//frc971/control_loops:pose",
738 ],
739)
740
741cc_test(
742 name = "camera_test",
743 srcs = ["camera_test.cc"],
744 deps = [
745 ":camera",
746 "//aos/testing:googletest",
747 ],
748)