blob: ac2a2e84943038c436423e770d3e7dc34d29612a [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",
Alex Perry1ec34522019-02-17 22:44:10 -0800226 "//aos:init",
James Kuszmaulc73bb222019-04-07 12:15:35 -0700227 "//aos/util:math",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700228 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800229 ],
Alex Perry731b4602019-02-02 22:13:01 -0800230)
231
232cc_library(
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800233 name = "line_follow_drivetrain",
234 srcs = [
235 "line_follow_drivetrain.cc",
236 ],
237 hdrs = [
238 "line_follow_drivetrain.h",
239 ],
240 deps = [
241 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700242 ":drivetrain_goal_fbs",
243 ":drivetrain_output_fbs",
244 ":drivetrain_status_fbs",
James Kuszmaul5bc6fc92019-03-01 21:50:06 -0800245 ":localizer",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800246 "//aos:math",
247 "//aos/util:math",
248 "//frc971/control_loops:c2d",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700249 "//frc971/control_loops:control_loops_fbs",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800250 "//frc971/control_loops:dlqr",
251 "//frc971/control_loops:pose",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700252 "//frc971/control_loops:profiled_subsystem_fbs",
253 "//y2019/control_loops/superstructure:superstructure_goal_fbs",
254 "@org_tuxfamily_eigen//:eigen",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800255 ],
256)
257
258cc_test(
259 name = "line_follow_drivetrain_test",
260 srcs = ["line_follow_drivetrain_test.cc"],
261 linkstatic = True,
262 restricted_to = ["//tools:k8"],
263 deps = [
264 ":drivetrain_config",
265 ":drivetrain_test_lib",
266 ":line_follow_drivetrain",
267 ":trajectory",
268 "//aos/testing:googletest",
269 "//aos/testing:test_shm",
270 "//third_party/matplotlib-cpp",
271 "@com_github_gflags_gflags//:gflags",
272 ],
273)
274
275cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700276 name = "ssdrivetrain",
277 srcs = [
278 "ssdrivetrain.cc",
279 ],
280 hdrs = [
281 "ssdrivetrain.h",
282 ],
283 deps = [
284 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700285 ":drivetrain_goal_fbs",
286 ":drivetrain_output_fbs",
287 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700288 ":gear",
James Kuszmaul3431d622019-02-17 17:07:44 -0800289 ":localizer",
John Park33858a32018-09-28 23:05:48 -0700290 "//aos:math",
291 "//aos/controls:control_loop",
292 "//aos/controls:polytope",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700293 "//aos/robot_state:robot_state_fbs",
John Park33858a32018-09-28 23:05:48 -0700294 "//aos/util:log_interval",
295 "//aos/util:trapezoid_profile",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700296 "//frc971:shifter_hall_effect",
297 "//frc971/control_loops:coerce_goal",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700298 "//frc971/control_loops:control_loops_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700299 "//frc971/control_loops:state_feedback_loop",
300 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000301)
302
303cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700304 name = "polydrivetrain",
305 srcs = [
306 "polydrivetrain.cc",
307 ],
308 hdrs = [
309 "polydrivetrain.h",
310 ],
311 deps = [
312 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700313 ":drivetrain_goal_fbs",
314 ":drivetrain_output_fbs",
315 ":drivetrain_position_fbs",
316 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700317 ":gear",
John Park33858a32018-09-28 23:05:48 -0700318 "//aos:math",
319 "//aos/controls:polytope",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700320 "//aos/robot_state:robot_state_fbs",
John Park33858a32018-09-28 23:05:48 -0700321 "//aos/util:log_interval",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700322 "//frc971/control_loops:coerce_goal",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700323 "//frc971/control_loops:control_loops_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700324 "//frc971/control_loops:state_feedback_loop",
325 ],
326)
327
328cc_library(
329 name = "drivetrain_config_uc",
330 hdrs = [
331 "drivetrain_config.h",
332 ],
333 restricted_to = mcu_cpus,
334 deps = [
335 "//frc971:shifter_hall_effect",
336 "//frc971/control_loops:state_feedback_loop_uc",
337 ],
338)
339
340cc_library(
341 name = "polydrivetrain_uc",
342 srcs = [
Austin Schuhbcce26a2018-03-26 23:41:24 -0700343 "polydrivetrain.cc",
344 ],
345 hdrs = [
Austin Schuhbcce26a2018-03-26 23:41:24 -0700346 "polydrivetrain.h",
347 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700348 copts = ["-Wno-type-limits"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700349 restricted_to = mcu_cpus,
350 deps = [
351 ":drivetrain_config_uc",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700352 ":drivetrain_goal_float_fbs",
353 ":drivetrain_output_float_fbs",
354 ":drivetrain_position_float_fbs",
355 ":drivetrain_status_float_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700356 ":gear",
John Park33858a32018-09-28 23:05:48 -0700357 "//aos:math",
358 "//aos/controls:polytope_uc",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700359 "//frc971/control_loops:coerce_goal_uc",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700360 "//frc971/control_loops:control_loops_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700361 "//frc971/control_loops:state_feedback_loop_uc",
362 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000363)
364
Austin Schuh05c5a612016-04-02 15:10:25 -0700365genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700366 name = "genrule_down_estimator",
367 outs = [
368 "down_estimator.h",
369 "down_estimator.cc",
370 ],
371 cmd = "$(location //frc971/control_loops/python:down_estimator) $(OUTS)",
372 tools = [
373 "//frc971/control_loops/python:down_estimator",
374 ],
375 visibility = ["//visibility:private"],
Austin Schuh05c5a612016-04-02 15:10:25 -0700376)
377
378cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700379 name = "down_estimator",
380 srcs = [
381 "down_estimator.cc",
382 ],
383 hdrs = [
384 "down_estimator.h",
385 ],
386 deps = [
387 "//frc971/control_loops:state_feedback_loop",
388 ],
Austin Schuh05c5a612016-04-02 15:10:25 -0700389)
390
Comran Morshed5323ecb2015-12-26 20:50:55 +0000391cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700392 name = "drivetrain_lib",
393 srcs = [
394 "drivetrain.cc",
395 ],
396 hdrs = [
397 "drivetrain.h",
398 ],
399 deps = [
400 ":down_estimator",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700401 ":drivetrain_goal_fbs",
402 ":drivetrain_output_fbs",
403 ":drivetrain_position_fbs",
404 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700405 ":gear",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800406 ":improved_down_estimator",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800407 ":line_follow_drivetrain",
James Kuszmaul3431d622019-02-17 17:07:44 -0800408 ":localizer",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700409 ":localizer_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700410 ":polydrivetrain",
Alex Perry731b4602019-02-02 22:13:01 -0800411 ":splinedrivetrain",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800412 ":ssdrivetrain",
John Park33858a32018-09-28 23:05:48 -0700413 "//aos/controls:control_loop",
John Park33858a32018-09-28 23:05:48 -0700414 "//aos/util:log_interval",
Austin Schuh3a378462019-01-04 21:48:04 -0800415 "//frc971/control_loops:runge_kutta",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800416 "//frc971/queues:gyro_fbs",
Austin Schuhac17fba2020-03-28 15:55:33 -0700417 "//frc971/wpilib:imu_batch_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700418 "//frc971/wpilib:imu_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800419 "//frc971/zeroing:imu_zeroer",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700420 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000421)
422
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800423cc_library(
424 name = "drivetrain_test_lib",
425 testonly = True,
426 srcs = ["drivetrain_test_lib.cc"],
427 hdrs = ["drivetrain_test_lib.h"],
James Kuszmaul74d8f972020-02-11 17:13:17 -0800428 defines =
429 cpu_select({
430 "amd64": [
431 "SUPPORT_PLOT=1",
432 ],
433 "arm": [],
434 }),
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800435 deps = [
436 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700437 ":drivetrain_goal_fbs",
438 ":drivetrain_output_fbs",
439 ":drivetrain_position_fbs",
440 ":drivetrain_status_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800441 ":trajectory",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700442 "//aos/events:event_loop",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800443 "//aos/testing:googletest",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700444 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800445 "//frc971/control_loops:state_feedback_loop",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800446 "//frc971/queues:gyro_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800447 "//frc971/wpilib:imu_fbs",
Austin Schuhac17fba2020-03-28 15:55:33 -0700448 "//frc971/wpilib:imu_batch_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800449 "//y2016:constants",
450 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
James Kuszmaul74d8f972020-02-11 17:13:17 -0800451 ] + cpu_select({
452 "amd64": [
453 "//third_party/matplotlib-cpp",
454 ],
455 "arm": [],
456 }),
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800457)
458
Comran Morshed5323ecb2015-12-26 20:50:55 +0000459cc_test(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700460 name = "drivetrain_lib_test",
461 srcs = [
462 "drivetrain_lib_test.cc",
463 ],
James Kuszmaul74d8f972020-02-11 17:13:17 -0800464 data = ["simulation_config.json"],
Alex Perry04300d62019-02-17 14:37:04 -0800465 defines =
466 cpu_select({
467 "amd64": [
468 "SUPPORT_PLOT=1",
469 ],
470 "arm": [],
471 }),
472 linkstatic = True,
Austin Schuhbcce26a2018-03-26 23:41:24 -0700473 deps = [
474 ":drivetrain_config",
475 ":drivetrain_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700476 ":localizer_fbs",
477 ":drivetrain_goal_fbs",
478 ":drivetrain_status_fbs",
479 ":drivetrain_position_fbs",
480 ":drivetrain_output_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800481 ":drivetrain_test_lib",
John Park33858a32018-09-28 23:05:48 -0700482 "//aos/controls:control_loop_test",
James Kuszmaul74d8f972020-02-11 17:13:17 -0800483 "//aos/events/logging:logger",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700484 "//aos/testing:googletest",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800485 "//frc971/queues:gyro_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800486 "//frc971/wpilib:imu_fbs",
Alex Perry04300d62019-02-17 14:37:04 -0800487 ] + cpu_select({
488 "amd64": [
489 "//third_party/matplotlib-cpp",
490 ],
491 "arm": [],
492 }),
Comran Morshed5323ecb2015-12-26 20:50:55 +0000493)
Brian Silverman6260c092018-01-14 15:21:36 -0800494
495genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700496 name = "genrule_haptic_wheel",
497 outs = [
498 "haptic_wheel.h",
499 "haptic_wheel.cc",
500 "integral_haptic_wheel.h",
501 "integral_haptic_wheel.cc",
502 "haptic_trigger.h",
503 "haptic_trigger.cc",
504 "integral_haptic_trigger.h",
505 "integral_haptic_trigger.cc",
506 ],
507 cmd = "$(location //frc971/control_loops/python:haptic_wheel) $(OUTS)",
508 compatible_with = mcu_cpus,
509 tools = [
510 "//frc971/control_loops/python:haptic_wheel",
511 ],
512 visibility = ["//visibility:private"],
Brian Silverman6260c092018-01-14 15:21:36 -0800513)
514
515cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700516 name = "haptic_input_uc",
517 srcs = [
518 "haptic_trigger.cc",
519 "haptic_wheel.cc",
520 "integral_haptic_trigger.cc",
521 "integral_haptic_wheel.cc",
522 ],
523 hdrs = [
524 "haptic_trigger.h",
525 "haptic_wheel.h",
526 "integral_haptic_trigger.h",
527 "integral_haptic_wheel.h",
528 ],
529 restricted_to = mcu_cpus,
530 deps = [
531 "//frc971/control_loops:state_feedback_loop_uc",
532 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800533)
534
535cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700536 name = "haptic_wheel",
537 srcs = [
538 "haptic_trigger.cc",
539 "haptic_wheel.cc",
540 "integral_haptic_trigger.cc",
541 "integral_haptic_wheel.cc",
542 ],
543 hdrs = [
544 "haptic_trigger.h",
545 "haptic_wheel.h",
546 "integral_haptic_trigger.h",
547 "integral_haptic_wheel.h",
548 ],
549 deps = [
550 "//frc971/control_loops:state_feedback_loop",
551 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800552)
Austin Schuhc2b08772018-12-19 18:05:06 +1100553
554cc_library(
555 name = "spline",
556 srcs = ["spline.cc"],
557 hdrs = ["spline.h"],
558 deps = [
Austin Schuhf49b4e32019-01-13 17:26:58 -0800559 "//frc971/control_loops:binomial",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700560 "@org_tuxfamily_eigen//:eigen",
Austin Schuhc2b08772018-12-19 18:05:06 +1100561 ],
562)
563
Alex Perrya60da442019-01-21 19:00:27 -0500564cc_binary(
565 name = "spline.so",
566 srcs = ["libspline.cc"],
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800567 linkshared = True,
Alex Perrya60da442019-01-21 19:00:27 -0500568 deps = [
569 ":distance_spline",
570 ":spline",
Alex Perry0603b542019-01-25 20:29:51 -0800571 ":trajectory",
572 "//aos/logging:implementations",
573 "//aos/network:team_number",
James Kuszmaul8aa37cb2020-03-01 10:27:58 -0800574 "//y2020/control_loops/drivetrain:drivetrain_base",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700575 "@org_tuxfamily_eigen//:eigen",
Alex Perrya60da442019-01-21 19:00:27 -0500576 ],
Alex Perrya60da442019-01-21 19:00:27 -0500577)
578
Austin Schuhc2b08772018-12-19 18:05:06 +1100579cc_test(
580 name = "spline_test",
581 srcs = [
582 "spline_test.cc",
583 ],
584 restricted_to = ["//tools:k8"],
585 deps = [
586 ":spline",
587 "//aos/testing:googletest",
588 "//third_party/matplotlib-cpp",
589 "@com_github_gflags_gflags//:gflags",
590 ],
591)
Austin Schuh941b46d2018-12-19 18:06:05 +1100592
593cc_library(
594 name = "distance_spline",
595 srcs = ["distance_spline.cc"],
596 hdrs = ["distance_spline.h"],
597 deps = [
598 ":spline",
Austin Schuha6e7b212019-01-20 13:53:01 -0800599 "//aos/logging",
Austin Schuh941b46d2018-12-19 18:06:05 +1100600 "//frc971/control_loops:fixed_quadrature",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700601 "@org_tuxfamily_eigen//:eigen",
Austin Schuh941b46d2018-12-19 18:06:05 +1100602 ],
603)
604
605cc_test(
606 name = "distance_spline_test",
607 srcs = [
608 "distance_spline_test.cc",
609 ],
Austin Schuh9b0b6432019-01-13 21:15:17 -0800610 defines =
611 cpu_select({
612 "amd64": [
613 "SUPPORT_PLOT=1",
614 ],
615 "arm": [],
616 }),
617 linkstatic = True,
Austin Schuh941b46d2018-12-19 18:06:05 +1100618 deps = [
619 ":distance_spline",
620 "//aos/testing:googletest",
Austin Schuha6e7b212019-01-20 13:53:01 -0800621 "//aos/testing:test_shm",
Austin Schuh941b46d2018-12-19 18:06:05 +1100622 "@com_github_gflags_gflags//:gflags",
Austin Schuh9b0b6432019-01-13 21:15:17 -0800623 ] + cpu_select({
624 "amd64": [
625 "//third_party/matplotlib-cpp",
626 ],
627 "arm": [],
628 }),
Austin Schuh941b46d2018-12-19 18:06:05 +1100629)
Austin Schuhec7f06d2019-01-04 07:47:15 +1100630
631cc_library(
632 name = "trajectory",
633 srcs = ["trajectory.cc"],
634 hdrs = ["trajectory.h"],
635 deps = [
636 ":distance_spline",
637 ":drivetrain_config",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100638 "//frc971/control_loops:c2d",
639 "//frc971/control_loops:dlqr",
640 "//frc971/control_loops:hybrid_state_feedback_loop",
641 "//frc971/control_loops:runge_kutta",
642 "//frc971/control_loops:state_feedback_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700643 "@org_tuxfamily_eigen//:eigen",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100644 ],
645)
646
647cc_binary(
648 name = "trajectory_plot",
649 srcs = [
650 "trajectory_plot.cc",
651 ],
652 restricted_to = ["//tools:k8"],
653 deps = [
654 ":distance_spline",
655 ":trajectory",
656 "//aos/logging:implementations",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100657 "//aos/network:team_number",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100658 "//third_party/matplotlib-cpp",
Austin Schuh11043182019-03-23 22:29:12 -0700659 "//y2019/control_loops/drivetrain:drivetrain_base",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100660 "@com_github_gflags_gflags//:gflags",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700661 "@org_tuxfamily_eigen//:eigen",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100662 ],
663)
664
665cc_test(
666 name = "trajectory_test",
667 srcs = [
668 "trajectory_test.cc",
669 ],
Austin Schuh719a33e2019-01-07 15:13:34 -0800670 defines =
671 cpu_select({
672 "amd64": [
673 "SUPPORT_PLOT=1",
674 ],
675 "arm": [],
676 }),
677 linkstatic = True,
Austin Schuhec7f06d2019-01-04 07:47:15 +1100678 deps = [
679 ":trajectory",
James Kuszmaulea314d92019-02-18 19:45:06 -0800680 ":drivetrain_test_lib",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100681 "//aos/testing:googletest",
682 "//aos/testing:test_shm",
683 "//y2016:constants",
684 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
James Kuszmaulea314d92019-02-18 19:45:06 -0800685 "//y2019/control_loops/drivetrain:drivetrain_base",
Austin Schuh719a33e2019-01-07 15:13:34 -0800686 ] + cpu_select({
687 "amd64": [
688 "//third_party/matplotlib-cpp",
689 ],
690 "arm": [],
691 }),
Austin Schuhec7f06d2019-01-04 07:47:15 +1100692)
Austin Schuhca080812017-05-10 19:31:55 -0700693
694cc_library(
695 name = "improved_down_estimator",
696 srcs = [
697 "improved_down_estimator.cc",
698 ],
699 hdrs = [
700 "improved_down_estimator.h",
701 ],
702 deps = [
James Kuszmaul7f55f072020-03-01 10:21:26 -0800703 ":drivetrain_config",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800704 ":drivetrain_status_fbs",
705 "//aos/events:event_loop",
706 "//frc971/control_loops:control_loops_fbs",
Austin Schuhca080812017-05-10 19:31:55 -0700707 "//frc971/control_loops:runge_kutta",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800708 "@//aos/time",
Austin Schuhca080812017-05-10 19:31:55 -0700709 "@com_github_google_glog//:glog",
710 "@org_tuxfamily_eigen//:eigen",
711 ],
712)
713
714cc_test(
715 name = "improved_down_estimator_test",
716 srcs = [
717 "improved_down_estimator_test.cc",
718 ],
719 deps = [
James Kuszmaul7f55f072020-03-01 10:21:26 -0800720 ":drivetrain_test_lib",
Austin Schuhca080812017-05-10 19:31:55 -0700721 "//aos/testing:googletest",
722 "//aos/testing:random_seed",
723 "//frc971/control_loops/drivetrain:improved_down_estimator",
724 "@org_tuxfamily_eigen//:eigen",
725 ],
726)
James Kuszmaulf4ede202020-02-14 08:47:40 -0800727
728cc_library(
729 name = "camera",
730 srcs = ["camera.h"],
731 visibility = ["//visibility:public"],
732 deps = [
733 "//aos/containers:sized_array",
734 "//frc971/control_loops:pose",
735 ],
736)
737
738cc_test(
739 name = "camera_test",
740 srcs = ["camera_test.cc"],
741 deps = [
742 ":camera",
743 "//aos/testing:googletest",
744 ],
745)