blob: ccaac406e0a4a360f6b8cd45988c863673bd226e [file] [log] [blame]
Austin Schuh8f99c822024-05-05 22:43:40 -07001load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library")
Austin Schuha9df9ad2021-06-16 14:49:39 -07002load("//aos:config.bzl", "aos_config")
James Kuszmaulf01da392023-12-14 11:22:14 -08003load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
Brian Silverman100534c2015-09-07 15:51:23 -04004
Philipp Schradercc016b32021-12-30 08:59:58 -08005package(default_visibility = ["//visibility:public"])
6
Brian Silverman100534c2015-09-07 15:51:23 -04007cc_library(
Niko Sohmerse69ee2d2022-09-28 19:52:27 -07008 name = "subsystem_simulator",
9 testonly = True,
10 hdrs = [
11 "subsystem_simulator.h",
12 ],
13 target_compatible_with = ["@platforms//os:linux"],
14 deps = [
15 "//frc971:constants",
16 "//frc971/control_loops:capped_test_plant",
17 "//frc971/control_loops:control_loop_test",
18 "//frc971/control_loops:position_sensor_sim",
19 ],
20)
21
22cc_library(
James Kuszmaul61750662021-06-21 21:32:33 -070023 name = "control_loop_test",
24 testonly = True,
25 srcs = [
26 "control_loop_test.cc",
27 ],
28 hdrs = [
29 "control_loop_test.h",
30 ],
31 target_compatible_with = ["@platforms//os:linux"],
32 deps = [
33 "//aos:flatbuffers",
34 "//aos:json_to_flatbuffer",
35 "//aos/events:simulated_event_loop",
Austin Schuh0debde12022-08-17 16:25:17 -070036 "//aos/network:testing_time_converter",
James Kuszmaul61750662021-06-21 21:32:33 -070037 "//aos/testing:googletest",
38 "//aos/testing:test_logging",
39 "//aos/time",
40 "//frc971/input:joystick_state_fbs",
41 "//frc971/input:robot_state_fbs",
42 ],
43)
44
45cc_library(
46 name = "polytope",
47 hdrs = [
48 "polytope.h",
49 ],
50 deps = [
51 "@org_tuxfamily_eigen//:eigen",
52 ] + select({
53 "@platforms//os:linux": [
54 "//aos/logging",
55 "//third_party/cddlib",
56 "@com_github_google_glog//:glog",
57 ],
58 "//conditions:default": [],
59 }),
60)
61
62cc_test(
63 name = "polytope_test",
64 srcs = [
65 "polytope_test.cc",
66 ],
67 target_compatible_with = ["@platforms//os:linux"],
68 deps = [
69 ":polytope",
70 "//aos/testing:googletest",
71 "//aos/testing:test_logging",
72 "@org_tuxfamily_eigen//:eigen",
73 ],
74)
75
76cc_library(
77 name = "control_loop",
78 srcs = [
79 "control_loop.cc",
80 "control_loop-tmpl.h",
81 ],
82 hdrs = [
83 "control_loop.h",
84 ],
85 target_compatible_with = ["@platforms//os:linux"],
86 deps = [
Stephan Pleines743f83a2024-02-02 18:32:09 -080087 "//aos/actions:action_lib",
James Kuszmaul61750662021-06-21 21:32:33 -070088 "//aos/events:event_loop",
89 "//aos/events:shm_event_loop",
Nikolai Sohmers2df6f302024-05-30 13:12:29 -070090 "//aos/flatbuffers:static_table",
James Kuszmaul61750662021-06-21 21:32:33 -070091 "//aos/logging",
92 "//aos/time",
93 "//aos/util:log_interval",
94 "//frc971/input:joystick_state_fbs",
95 "//frc971/input:robot_state_fbs",
96 ],
97)
98
99cc_library(
100 name = "quaternion_utils",
101 srcs = [
102 "quaternion_utils.cc",
103 ],
104 hdrs = [
105 "quaternion_utils.h",
106 ],
107 target_compatible_with = ["@platforms//os:linux"],
108 deps = [
109 "@com_github_google_glog//:glog",
110 "@org_tuxfamily_eigen//:eigen",
111 ],
112)
113
114cc_test(
115 name = "quarternion_utils_test",
116 srcs = [
117 "quaternion_utils_test.cc",
118 ],
119 target_compatible_with = ["@platforms//os:linux"],
120 deps = [
milind-ue53bf552021-12-11 14:42:00 -0800121 ":jacobian",
James Kuszmaul61750662021-06-21 21:32:33 -0700122 ":quaternion_utils",
milind-ue53bf552021-12-11 14:42:00 -0800123 ":runge_kutta",
James Kuszmaul61750662021-06-21 21:32:33 -0700124 "//aos/testing:googletest",
125 "//aos/testing:random_seed",
126 "@com_github_google_glog//:glog",
127 "@org_tuxfamily_eigen//:eigen",
128 ],
129)
130
131cc_library(
Austin Schuha647d602018-02-18 14:05:15 -0800132 name = "team_number_test_environment",
133 testonly = True,
134 srcs = [
135 "team_number_test_environment.cc",
136 ],
137 hdrs = [
138 "team_number_test_environment.h",
139 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800140 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800141 deps = [
John Park33858a32018-09-28 23:05:48 -0700142 "//aos/network:team_number",
Austin Schuha647d602018-02-18 14:05:15 -0800143 "//aos/testing:googletest",
144 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400145)
146
147cc_test(
Austin Schuha647d602018-02-18 14:05:15 -0800148 name = "hybrid_state_feedback_loop_test",
149 srcs = [
150 "hybrid_state_feedback_loop_test.cc",
151 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800152 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800153 deps = [
154 ":hybrid_state_feedback_loop",
155 "//aos/testing:googletest",
156 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400157)
158
159cc_library(
James Kuszmaul9f9676d2019-01-25 21:27:58 -0800160 name = "pose",
161 hdrs = ["pose.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800162 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul9f9676d2019-01-25 21:27:58 -0800163 deps = [
164 "//aos/util:math",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700165 "@org_tuxfamily_eigen//:eigen",
James Kuszmaul9f9676d2019-01-25 21:27:58 -0800166 ],
167)
168
169cc_test(
170 name = "pose_test",
171 srcs = ["pose_test.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800172 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul9f9676d2019-01-25 21:27:58 -0800173 deps = [
174 ":pose",
175 "//aos/testing:googletest",
176 ],
177)
178
179cc_library(
Niko Sohmers4a5bef82023-12-30 15:16:16 -0800180 name = "encoder_fault_detector",
181 srcs = ["encoder_fault_detector.cc"],
182 hdrs = ["encoder_fault_detector.h"],
183 target_compatible_with = ["@platforms//os:linux"],
184 deps = [
185 ":encoder_fault_status_fbs",
186 "//aos/containers:sized_array",
187 "//aos/time",
188 "//frc971/control_loops:can_talonfx_fbs",
189 ],
190)
191
192cc_test(
193 name = "encoder_fault_detector_test",
194 srcs = ["encoder_fault_detector_test.cc"],
195 target_compatible_with = ["@platforms//os:linux"],
196 deps = [
197 ":encoder_fault_detector",
198 "//aos:json_to_flatbuffer",
199 "//aos/testing:googletest",
200 ],
201)
202
203cc_library(
Austin Schuha647d602018-02-18 14:05:15 -0800204 name = "hall_effect_tracker",
205 hdrs = [
206 "hall_effect_tracker.h",
207 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800208 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800209 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700210 ":control_loops_fbs",
Austin Schuha647d602018-02-18 14:05:15 -0800211 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400212)
213
James Kuszmauldac091f2022-03-22 09:35:06 -0700214flatbuffer_ts_library(
215 name = "control_loops_ts_fbs",
216 srcs = [
217 "control_loops.fbs",
218 ],
219)
220
James Kuszmaulf01da392023-12-14 11:22:14 -0800221static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700222 name = "control_loops_fbs",
Austin Schuha647d602018-02-18 14:05:15 -0800223 srcs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700224 "control_loops.fbs",
Austin Schuha647d602018-02-18 14:05:15 -0800225 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400226)
227
Niko Sohmers76f47562023-12-20 20:59:06 -0800228flatbuffer_ts_library(
Niko Sohmers4a5bef82023-12-30 15:16:16 -0800229 name = "encoder_fault_status_ts_fbs",
230 srcs = [
231 "encoder_fault_status.fbs",
232 ],
233)
234
235static_flatbuffer(
236 name = "encoder_fault_status_fbs",
237 srcs = [
238 "encoder_fault_status.fbs",
239 ],
240)
241
242flatbuffer_ts_library(
Maxwell Henderson10ed5c32024-01-09 12:40:54 -0800243 name = "can_talonfx_ts_fbs",
Niko Sohmers76f47562023-12-20 20:59:06 -0800244 srcs = [
Maxwell Henderson10ed5c32024-01-09 12:40:54 -0800245 "can_talonfx.fbs",
Niko Sohmers76f47562023-12-20 20:59:06 -0800246 ],
247)
248
James Kuszmaulf01da392023-12-14 11:22:14 -0800249static_flatbuffer(
Maxwell Henderson10ed5c32024-01-09 12:40:54 -0800250 name = "can_talonfx_fbs",
Maxwell Hendersonca1d18f2023-07-26 21:06:14 -0700251 srcs = [
Maxwell Henderson10ed5c32024-01-09 12:40:54 -0800252 "can_talonfx.fbs",
Maxwell Hendersonca1d18f2023-07-26 21:06:14 -0700253 ],
254)
255
Brian Silverman100534c2015-09-07 15:51:23 -0400256cc_test(
Austin Schuha647d602018-02-18 14:05:15 -0800257 name = "position_sensor_sim_test",
258 srcs = [
259 "position_sensor_sim_test.cc",
260 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800261 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800262 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700263 ":control_loops_fbs",
Austin Schuha647d602018-02-18 14:05:15 -0800264 ":position_sensor_sim",
John Park33858a32018-09-28 23:05:48 -0700265 "//aos/logging",
Austin Schuha647d602018-02-18 14:05:15 -0800266 "//aos/testing:googletest",
267 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400268)
269
270cc_library(
Austin Schuha647d602018-02-18 14:05:15 -0800271 name = "position_sensor_sim",
272 testonly = True,
273 srcs = [
274 "position_sensor_sim.cc",
275 ],
276 hdrs = [
277 "position_sensor_sim.h",
278 ],
Brian Silverman6470f442018-08-05 12:08:16 -0700279 linkopts = [
280 "-lm",
281 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800282 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800283 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700284 ":control_loops_fbs",
Austin Schuha647d602018-02-18 14:05:15 -0800285 ":gaussian_noise",
Austin Schuha647d602018-02-18 14:05:15 -0800286 "//aos/testing:random_seed",
Philipp Schraderb3a057e2018-03-10 18:59:40 -0800287 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400288)
289
290cc_library(
Austin Schuha647d602018-02-18 14:05:15 -0800291 name = "gaussian_noise",
292 srcs = [
293 "gaussian_noise.cc",
294 ],
295 hdrs = [
296 "gaussian_noise.h",
297 ],
Philipp Schraderb3a057e2018-03-10 18:59:40 -0800298 linkopts = [
299 "-lm",
Austin Schuha647d602018-02-18 14:05:15 -0800300 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800301 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700302)
303
304cc_library(
Austin Schuha647d602018-02-18 14:05:15 -0800305 name = "coerce_goal",
306 srcs = [
307 "coerce_goal.cc",
308 ],
309 hdrs = [
310 "coerce_goal.h",
311 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800312 linkopts = select({
313 "@platforms//os:linux": ["-lm"],
314 "//conditions:default": [],
315 }),
Austin Schuha647d602018-02-18 14:05:15 -0800316 deps = [
James Kuszmaul61750662021-06-21 21:32:33 -0700317 "//frc971/control_loops:polytope",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700318 "@org_tuxfamily_eigen//:eigen",
Austin Schuha647d602018-02-18 14:05:15 -0800319 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400320)
321
Lee Mracek65686142020-01-10 22:21:39 -0500322cc_test(
323 name = "coerce_goal_test",
324 srcs = [
325 "coerce_goal_test.cc",
326 ],
327 linkopts = [
328 "-lm",
329 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800330 target_compatible_with = ["@platforms//os:linux"],
Lee Mracek65686142020-01-10 22:21:39 -0500331 deps = [
332 ":coerce_goal",
Lee Mracek65686142020-01-10 22:21:39 -0500333 "//aos/testing:googletest",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700334 "//frc971/control_loops:polytope",
Lee Mracek65686142020-01-10 22:21:39 -0500335 "@org_tuxfamily_eigen//:eigen",
336 ],
337)
338
Austin Schuh4cc4fe22017-11-23 19:13:09 -0800339cc_library(
Austin Schuha647d602018-02-18 14:05:15 -0800340 name = "state_feedback_loop",
341 hdrs = [
342 "state_feedback_loop.h",
343 ],
344 deps = [
John Park33858a32018-09-28 23:05:48 -0700345 "//aos:macros",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700346 "@org_tuxfamily_eigen//:eigen",
Philipp Schraderdada1072020-11-24 11:34:46 -0800347 ] + select({
348 "@platforms//os:linux": ["//aos/logging"],
349 "//conditions:default": [],
350 }),
Brian Silverman100534c2015-09-07 15:51:23 -0400351)
Brian Silverman2b1957a2016-02-14 20:29:57 -0500352
353cc_library(
Austin Schuha647d602018-02-18 14:05:15 -0800354 name = "hybrid_state_feedback_loop",
355 hdrs = [
356 "hybrid_state_feedback_loop.h",
357 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800358 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800359 deps = [
Austin Schuh9b881ae2019-01-04 07:29:20 +1100360 ":c2d",
Austin Schuha647d602018-02-18 14:05:15 -0800361 ":state_feedback_loop",
John Park33858a32018-09-28 23:05:48 -0700362 "//aos:macros",
John Park33858a32018-09-28 23:05:48 -0700363 "//aos/logging",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700364 "//frc971/control_loops:control_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700365 "@org_tuxfamily_eigen//:eigen",
Austin Schuha647d602018-02-18 14:05:15 -0800366 ],
Brian Silverman2b1957a2016-02-14 20:29:57 -0500367)
Austin Schuhacd335a2017-01-01 16:20:54 -0800368
369cc_library(
Austin Schuha647d602018-02-18 14:05:15 -0800370 name = "simple_capped_state_feedback_loop",
371 hdrs = [
372 "simple_capped_state_feedback_loop.h",
373 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800374 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800375 deps = [
376 ":state_feedback_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700377 "@org_tuxfamily_eigen//:eigen",
Austin Schuha647d602018-02-18 14:05:15 -0800378 ],
379)
380
381cc_library(
382 name = "runge_kutta",
383 hdrs = [
384 "runge_kutta.h",
Austin Schuhb0bfaf82024-06-19 19:47:23 -0700385 "runge_kutta_helpers.h",
Austin Schuha647d602018-02-18 14:05:15 -0800386 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800387 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800388 deps = [
Austin Schuhb0bfaf82024-06-19 19:47:23 -0700389 "@com_github_google_glog//:glog",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700390 "@org_tuxfamily_eigen//:eigen",
Austin Schuha647d602018-02-18 14:05:15 -0800391 ],
Austin Schuhacd335a2017-01-01 16:20:54 -0800392)
393
394cc_test(
Austin Schuha647d602018-02-18 14:05:15 -0800395 name = "runge_kutta_test",
396 srcs = [
397 "runge_kutta_test.cc",
398 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800399 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800400 deps = [
401 ":runge_kutta",
402 "//aos/testing:googletest",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700403 "@org_tuxfamily_eigen//:eigen",
Austin Schuha647d602018-02-18 14:05:15 -0800404 ],
Austin Schuhacd335a2017-01-01 16:20:54 -0800405)
Austin Schuh473a5652017-02-05 01:30:42 -0800406
Austin Schuh173a1592018-12-19 16:20:54 +1100407cc_library(
408 name = "fixed_quadrature",
409 hdrs = [
410 "fixed_quadrature.h",
411 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800412 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha935a082023-02-20 21:45:54 -0800413 deps = [
414 "@org_tuxfamily_eigen//:eigen",
415 ],
Austin Schuh173a1592018-12-19 16:20:54 +1100416)
417
418cc_test(
419 name = "fixed_quadrature_test",
420 srcs = [
421 "fixed_quadrature_test.cc",
422 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800423 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh173a1592018-12-19 16:20:54 +1100424 deps = [
425 ":fixed_quadrature",
426 "//aos/testing:googletest",
427 ],
428)
429
James Kuszmauldac091f2022-03-22 09:35:06 -0700430flatbuffer_ts_library(
431 name = "profiled_subsystem_ts_fbs",
432 srcs = [
433 "profiled_subsystem.fbs",
434 ],
435 deps = [
436 ":control_loops_ts_fbs",
James Kuszmauleeb98e92024-01-14 22:15:32 -0800437 ":state_feedback_loop_ts_fbs",
James Kuszmauldac091f2022-03-22 09:35:06 -0700438 ],
439)
440
James Kuszmaulf01da392023-12-14 11:22:14 -0800441static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700442 name = "profiled_subsystem_fbs",
Austin Schuha647d602018-02-18 14:05:15 -0800443 srcs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700444 "profiled_subsystem.fbs",
Austin Schuha647d602018-02-18 14:05:15 -0800445 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800446 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800447 deps = [
448 ":control_loops_fbs",
James Kuszmauleeb98e92024-01-14 22:15:32 -0800449 ":state_feedback_loop_fbs",
James Kuszmaulf01da392023-12-14 11:22:14 -0800450 ],
Austin Schuh9fe68f72019-08-10 19:32:03 -0700451)
452
Austin Schuh473a5652017-02-05 01:30:42 -0800453cc_library(
Austin Schuha647d602018-02-18 14:05:15 -0800454 name = "profiled_subsystem",
455 srcs = [
456 "profiled_subsystem.cc",
457 ],
458 hdrs = [
459 "profiled_subsystem.h",
460 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800461 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800462 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700463 ":control_loops_fbs",
464 ":profiled_subsystem_fbs",
Austin Schuha647d602018-02-18 14:05:15 -0800465 ":simple_capped_state_feedback_loop",
466 ":state_feedback_loop",
James Kuszmauleeb98e92024-01-14 22:15:32 -0800467 ":state_feedback_loop_converters",
468 "//aos:flatbuffer_merge",
John Park33858a32018-09-28 23:05:48 -0700469 "//aos/util:trapezoid_profile",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700470 "//frc971/control_loops:control_loop",
Austin Schuha647d602018-02-18 14:05:15 -0800471 "//frc971/zeroing",
James Kuszmaulec635d22023-08-12 18:39:24 -0700472 "//frc971/zeroing:pot_and_index",
Austin Schuha647d602018-02-18 14:05:15 -0800473 ],
Austin Schuh473a5652017-02-05 01:30:42 -0800474)
Austin Schuha647d602018-02-18 14:05:15 -0800475
476cc_library(
477 name = "jacobian",
478 hdrs = [
479 "jacobian.h",
480 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800481 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800482 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700483 "@org_tuxfamily_eigen//:eigen",
Austin Schuha647d602018-02-18 14:05:15 -0800484 ],
485)
486
487cc_test(
488 name = "jacobian_test",
489 srcs = [
490 "jacobian_test.cc",
491 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800492 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800493 deps = [
494 ":jacobian",
495 "//aos/testing:googletest",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700496 "@org_tuxfamily_eigen//:eigen",
Austin Schuha647d602018-02-18 14:05:15 -0800497 ],
498)
499
James Kuszmaul59a5c612019-01-22 07:56:08 -0800500cc_test(
501 name = "c2d_test",
502 srcs = [
503 "c2d_test.cc",
504 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800505 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul59a5c612019-01-22 07:56:08 -0800506 visibility = ["//visibility:public"],
507 deps = [
508 ":c2d",
509 ":runge_kutta",
510 "//aos/testing:googletest",
511 ],
512)
513
Austin Schuh03785132018-02-19 18:29:06 -0800514cc_library(
Austin Schuh9b881ae2019-01-04 07:29:20 +1100515 name = "c2d",
516 hdrs = [
517 "c2d.h",
518 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800519 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh9b881ae2019-01-04 07:29:20 +1100520 visibility = ["//visibility:public"],
521 deps = [
James Kuszmaul651fc3f2019-05-15 21:14:25 -0700522 "//aos/time",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700523 "@org_tuxfamily_eigen//:eigen",
Austin Schuh9b881ae2019-01-04 07:29:20 +1100524 ],
525)
526
527cc_library(
Austin Schuh03785132018-02-19 18:29:06 -0800528 name = "dlqr",
529 hdrs = [
530 "dlqr.h",
531 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800532 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh03785132018-02-19 18:29:06 -0800533 visibility = ["//visibility:public"],
534 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700535 "@org_tuxfamily_eigen//:eigen",
Austin Schuh03785132018-02-19 18:29:06 -0800536 "@slycot_repo//:slicot",
537 ],
538)
Brian Silverman6470f442018-08-05 12:08:16 -0700539
540py_library(
541 name = "python_init",
542 srcs = ["__init__.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800543 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman6470f442018-08-05 12:08:16 -0700544 visibility = ["//visibility:public"],
545 deps = ["//frc971:python_init"],
546)
Austin Schuhe6e7ea52019-01-13 17:26:36 -0800547
548cc_library(
549 name = "binomial",
550 hdrs = ["binomial.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800551 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe6e7ea52019-01-13 17:26:36 -0800552)
553
554cc_test(
555 name = "binomial_test",
556 srcs = [
557 "binomial_test.cc",
558 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800559 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe6e7ea52019-01-13 17:26:36 -0800560 deps = [
561 ":binomial",
562 "//aos/testing:googletest",
563 ],
564)
Tyler Chatow12581562019-01-26 20:42:42 -0800565
566cc_library(
567 name = "capped_test_plant",
568 testonly = True,
569 srcs = [
570 "capped_test_plant.cc",
571 ],
572 hdrs = [
573 "capped_test_plant.h",
574 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800575 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow12581562019-01-26 20:42:42 -0800576 deps = [
577 ":state_feedback_loop",
578 "//aos/testing:googletest",
579 ],
580)
581
582cc_library(
583 name = "static_zeroing_single_dof_profiled_subsystem",
Tyler Chatow12581562019-01-26 20:42:42 -0800584 hdrs = [
585 "static_zeroing_single_dof_profiled_subsystem.h",
586 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800587 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow12581562019-01-26 20:42:42 -0800588 deps = [
589 "//frc971/control_loops:profiled_subsystem",
590 ],
591)
592
593genrule(
594 name = "genrule_static_zeroing_single_dof_profiled_subsystem_test",
595 outs = [
596 "static_zeroing_single_dof_profiled_subsystem_test_plant.h",
597 "static_zeroing_single_dof_profiled_subsystem_test_plant.cc",
James Kuszmauleeb98e92024-01-14 22:15:32 -0800598 "static_zeroing_single_dof_profiled_subsystem_test_plant.json",
Tyler Chatow12581562019-01-26 20:42:42 -0800599 "static_zeroing_single_dof_profiled_subsystem_test_integral_plant.h",
600 "static_zeroing_single_dof_profiled_subsystem_test_integral_plant.cc",
James Kuszmauleeb98e92024-01-14 22:15:32 -0800601 "static_zeroing_single_dof_profiled_subsystem_test_integral_plant.json",
Tyler Chatow12581562019-01-26 20:42:42 -0800602 ],
603 cmd = "$(location //frc971/control_loops/python:static_zeroing_single_dof_profiled_subsystem_test) $(OUTS)",
Philipp Schraderdada1072020-11-24 11:34:46 -0800604 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow12581562019-01-26 20:42:42 -0800605 tools = [
606 "//frc971/control_loops/python:static_zeroing_single_dof_profiled_subsystem_test",
607 ],
608)
609
610cc_library(
611 name = "static_zeroing_single_dof_profiled_subsystem_test_plants",
612 srcs = [
613 "static_zeroing_single_dof_profiled_subsystem_test_integral_plant.cc",
614 "static_zeroing_single_dof_profiled_subsystem_test_plant.cc",
615 ],
616 hdrs = [
617 "static_zeroing_single_dof_profiled_subsystem_test_integral_plant.h",
618 "static_zeroing_single_dof_profiled_subsystem_test_plant.h",
619 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800620 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow12581562019-01-26 20:42:42 -0800621 deps = [
622 ":state_feedback_loop",
623 ],
624)
625
James Kuszmaulf01da392023-12-14 11:22:14 -0800626static_flatbuffer(
Austin Schuha9df9ad2021-06-16 14:49:39 -0700627 name = "static_zeroing_single_dof_profiled_subsystem_test_subsystem_goal_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700628 srcs = [
Austin Schuha9df9ad2021-06-16 14:49:39 -0700629 "static_zeroing_single_dof_profiled_subsystem_test_subsystem_goal.fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700630 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700631 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800632 deps = [
633 ":control_loops_fbs",
634 ":profiled_subsystem_fbs",
635 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700636)
637
James Kuszmaulf01da392023-12-14 11:22:14 -0800638static_flatbuffer(
Austin Schuha9df9ad2021-06-16 14:49:39 -0700639 name = "static_zeroing_single_dof_profiled_subsystem_test_subsystem_output_fbs",
640 srcs = [
641 "static_zeroing_single_dof_profiled_subsystem_test_subsystem_output.fbs",
642 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700643 target_compatible_with = ["@platforms//os:linux"],
644)
645
James Kuszmaulf01da392023-12-14 11:22:14 -0800646static_flatbuffer(
Austin Schuha9df9ad2021-06-16 14:49:39 -0700647 name = "static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_position_fbs",
648 srcs = [
649 "static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_position.fbs",
650 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700651 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800652 deps = [
653 ":control_loops_fbs",
654 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700655)
656
James Kuszmaulf01da392023-12-14 11:22:14 -0800657static_flatbuffer(
Austin Schuha9df9ad2021-06-16 14:49:39 -0700658 name = "static_zeroing_single_dof_profiled_subsystem_test_absolute_position_fbs",
659 srcs = [
660 "static_zeroing_single_dof_profiled_subsystem_test_absolute_position.fbs",
661 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700662 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800663 deps = [
664 ":control_loops_fbs",
665 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700666)
667
James Kuszmaulf01da392023-12-14 11:22:14 -0800668static_flatbuffer(
Austin Schuha9df9ad2021-06-16 14:49:39 -0700669 name = "static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_encoder_status_fbs",
670 srcs = [
671 "static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_encoder_status.fbs",
672 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700673 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800674 deps = [
675 ":control_loops_fbs",
676 ":profiled_subsystem_fbs",
677 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700678)
679
James Kuszmaulf01da392023-12-14 11:22:14 -0800680static_flatbuffer(
Austin Schuha9df9ad2021-06-16 14:49:39 -0700681 name = "static_zeroing_single_dof_profiled_subsystem_test_absolute_encoder_status_fbs",
682 srcs = [
683 "static_zeroing_single_dof_profiled_subsystem_test_absolute_encoder_status.fbs",
684 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800685 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800686 deps = [
687 ":control_loops_fbs",
688 ":profiled_subsystem_fbs",
689 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700690)
691
Tyler Chatow12581562019-01-26 20:42:42 -0800692cc_test(
693 name = "static_zeroing_single_dof_profiled_subsystem_test",
694 srcs = [
695 "static_zeroing_single_dof_profiled_subsystem_test.cc",
696 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700697 data = [
698 ":static_zeroing_single_dof_profiled_subsystem_test_config",
699 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800700 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow12581562019-01-26 20:42:42 -0800701 deps = [
702 ":capped_test_plant",
703 ":position_sensor_sim",
704 ":static_zeroing_single_dof_profiled_subsystem",
Austin Schuha9df9ad2021-06-16 14:49:39 -0700705 ":static_zeroing_single_dof_profiled_subsystem_test_absolute_encoder_status_fbs",
706 ":static_zeroing_single_dof_profiled_subsystem_test_absolute_position_fbs",
Tyler Chatow12581562019-01-26 20:42:42 -0800707 ":static_zeroing_single_dof_profiled_subsystem_test_plants",
Austin Schuha9df9ad2021-06-16 14:49:39 -0700708 ":static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_encoder_status_fbs",
709 ":static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_position_fbs",
710 ":static_zeroing_single_dof_profiled_subsystem_test_subsystem_goal_fbs",
711 ":static_zeroing_single_dof_profiled_subsystem_test_subsystem_output_fbs",
Tyler Chatow12581562019-01-26 20:42:42 -0800712 "//aos/testing:googletest",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700713 "//frc971/control_loops:control_loop_test",
James Kuszmaulec635d22023-08-12 18:39:24 -0700714 "//frc971/zeroing:absolute_and_absolute_encoder",
715 "//frc971/zeroing:absolute_encoder",
716 "//frc971/zeroing:pot_and_absolute_encoder",
Tyler Chatow12581562019-01-26 20:42:42 -0800717 ],
718)
Austin Schuha9df9ad2021-06-16 14:49:39 -0700719
720aos_config(
721 name = "static_zeroing_single_dof_profiled_subsystem_test_config",
722 src = "static_zeroing_single_dof_profiled_subsystem_test_config_source.json",
723 flatbuffers = [
724 "//frc971/input:joystick_state_fbs",
725 "//frc971/input:robot_state_fbs",
726 "//aos/logging:log_message_fbs",
727 "//aos/events:event_loop_fbs",
728 ":static_zeroing_single_dof_profiled_subsystem_test_subsystem_output_fbs",
729 ":static_zeroing_single_dof_profiled_subsystem_test_absolute_encoder_status_fbs",
730 ":static_zeroing_single_dof_profiled_subsystem_test_subsystem_goal_fbs",
731 ":static_zeroing_single_dof_profiled_subsystem_test_absolute_position_fbs",
732 ":static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_encoder_status_fbs",
733 ":static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_position_fbs",
734 ],
735 target_compatible_with = ["@platforms//os:linux"],
736)
James Kuszmauleeb98e92024-01-14 22:15:32 -0800737
738static_flatbuffer(
739 name = "state_feedback_loop_fbs",
740 srcs = ["state_feedback_loop.fbs"],
741 deps = ["//frc971/math:matrix_fbs"],
742)
743
744flatbuffer_ts_library(
745 name = "state_feedback_loop_ts_fbs",
746 srcs = ["state_feedback_loop.fbs"],
747 deps = ["//frc971/math:matrix_ts_fbs"],
748)
749
750cc_library(
751 name = "hybrid_state_feedback_loop_converters",
752 srcs = ["hybrid_state_feedback_loop_converters.h"],
753 deps = [
754 ":hybrid_state_feedback_loop",
755 ":state_feedback_loop_converters",
756 ":state_feedback_loop_fbs",
757 "//frc971/math:flatbuffers_matrix",
758 ],
759)
760
761cc_library(
762 name = "state_feedback_loop_converters",
763 srcs = ["state_feedback_loop_converters.h"],
764 deps = [
765 ":state_feedback_loop",
766 ":state_feedback_loop_fbs",
767 "//frc971/math:flatbuffers_matrix",
768 ],
769)