blob: f5a720fdc7dc7297f9931f295f691ccde2f77925 [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",
385 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800386 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800387 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700388 "@org_tuxfamily_eigen//:eigen",
Austin Schuha647d602018-02-18 14:05:15 -0800389 ],
Austin Schuhacd335a2017-01-01 16:20:54 -0800390)
391
392cc_test(
Austin Schuha647d602018-02-18 14:05:15 -0800393 name = "runge_kutta_test",
394 srcs = [
395 "runge_kutta_test.cc",
396 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800397 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800398 deps = [
399 ":runge_kutta",
400 "//aos/testing:googletest",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700401 "@org_tuxfamily_eigen//:eigen",
Austin Schuha647d602018-02-18 14:05:15 -0800402 ],
Austin Schuhacd335a2017-01-01 16:20:54 -0800403)
Austin Schuh473a5652017-02-05 01:30:42 -0800404
Austin Schuh173a1592018-12-19 16:20:54 +1100405cc_library(
406 name = "fixed_quadrature",
407 hdrs = [
408 "fixed_quadrature.h",
409 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800410 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha935a082023-02-20 21:45:54 -0800411 deps = [
412 "@org_tuxfamily_eigen//:eigen",
413 ],
Austin Schuh173a1592018-12-19 16:20:54 +1100414)
415
416cc_test(
417 name = "fixed_quadrature_test",
418 srcs = [
419 "fixed_quadrature_test.cc",
420 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800421 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh173a1592018-12-19 16:20:54 +1100422 deps = [
423 ":fixed_quadrature",
424 "//aos/testing:googletest",
425 ],
426)
427
James Kuszmauldac091f2022-03-22 09:35:06 -0700428flatbuffer_ts_library(
429 name = "profiled_subsystem_ts_fbs",
430 srcs = [
431 "profiled_subsystem.fbs",
432 ],
433 deps = [
434 ":control_loops_ts_fbs",
James Kuszmauleeb98e92024-01-14 22:15:32 -0800435 ":state_feedback_loop_ts_fbs",
James Kuszmauldac091f2022-03-22 09:35:06 -0700436 ],
437)
438
James Kuszmaulf01da392023-12-14 11:22:14 -0800439static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700440 name = "profiled_subsystem_fbs",
Austin Schuha647d602018-02-18 14:05:15 -0800441 srcs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700442 "profiled_subsystem.fbs",
Austin Schuha647d602018-02-18 14:05:15 -0800443 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800444 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800445 deps = [
446 ":control_loops_fbs",
James Kuszmauleeb98e92024-01-14 22:15:32 -0800447 ":state_feedback_loop_fbs",
James Kuszmaulf01da392023-12-14 11:22:14 -0800448 ],
Austin Schuh9fe68f72019-08-10 19:32:03 -0700449)
450
Austin Schuh473a5652017-02-05 01:30:42 -0800451cc_library(
Austin Schuha647d602018-02-18 14:05:15 -0800452 name = "profiled_subsystem",
453 srcs = [
454 "profiled_subsystem.cc",
455 ],
456 hdrs = [
457 "profiled_subsystem.h",
458 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800459 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800460 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700461 ":control_loops_fbs",
462 ":profiled_subsystem_fbs",
Austin Schuha647d602018-02-18 14:05:15 -0800463 ":simple_capped_state_feedback_loop",
464 ":state_feedback_loop",
James Kuszmauleeb98e92024-01-14 22:15:32 -0800465 ":state_feedback_loop_converters",
466 "//aos:flatbuffer_merge",
John Park33858a32018-09-28 23:05:48 -0700467 "//aos/util:trapezoid_profile",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700468 "//frc971/control_loops:control_loop",
Austin Schuha647d602018-02-18 14:05:15 -0800469 "//frc971/zeroing",
James Kuszmaulec635d22023-08-12 18:39:24 -0700470 "//frc971/zeroing:pot_and_index",
Austin Schuha647d602018-02-18 14:05:15 -0800471 ],
Austin Schuh473a5652017-02-05 01:30:42 -0800472)
Austin Schuha647d602018-02-18 14:05:15 -0800473
474cc_library(
475 name = "jacobian",
476 hdrs = [
477 "jacobian.h",
478 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800479 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800480 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700481 "@org_tuxfamily_eigen//:eigen",
Austin Schuha647d602018-02-18 14:05:15 -0800482 ],
483)
484
485cc_test(
486 name = "jacobian_test",
487 srcs = [
488 "jacobian_test.cc",
489 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800490 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800491 deps = [
492 ":jacobian",
493 "//aos/testing:googletest",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700494 "@org_tuxfamily_eigen//:eigen",
Austin Schuha647d602018-02-18 14:05:15 -0800495 ],
496)
497
James Kuszmaul59a5c612019-01-22 07:56:08 -0800498cc_test(
499 name = "c2d_test",
500 srcs = [
501 "c2d_test.cc",
502 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800503 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul59a5c612019-01-22 07:56:08 -0800504 visibility = ["//visibility:public"],
505 deps = [
506 ":c2d",
507 ":runge_kutta",
508 "//aos/testing:googletest",
509 ],
510)
511
Austin Schuh03785132018-02-19 18:29:06 -0800512cc_library(
Austin Schuh9b881ae2019-01-04 07:29:20 +1100513 name = "c2d",
514 hdrs = [
515 "c2d.h",
516 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800517 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh9b881ae2019-01-04 07:29:20 +1100518 visibility = ["//visibility:public"],
519 deps = [
James Kuszmaul651fc3f2019-05-15 21:14:25 -0700520 "//aos/time",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700521 "@org_tuxfamily_eigen//:eigen",
Austin Schuh9b881ae2019-01-04 07:29:20 +1100522 ],
523)
524
525cc_library(
Austin Schuh03785132018-02-19 18:29:06 -0800526 name = "dlqr",
527 hdrs = [
528 "dlqr.h",
529 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800530 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh03785132018-02-19 18:29:06 -0800531 visibility = ["//visibility:public"],
532 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700533 "@org_tuxfamily_eigen//:eigen",
Austin Schuh03785132018-02-19 18:29:06 -0800534 "@slycot_repo//:slicot",
535 ],
536)
Brian Silverman6470f442018-08-05 12:08:16 -0700537
538py_library(
539 name = "python_init",
540 srcs = ["__init__.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800541 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman6470f442018-08-05 12:08:16 -0700542 visibility = ["//visibility:public"],
543 deps = ["//frc971:python_init"],
544)
Austin Schuhe6e7ea52019-01-13 17:26:36 -0800545
546cc_library(
547 name = "binomial",
548 hdrs = ["binomial.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800549 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe6e7ea52019-01-13 17:26:36 -0800550)
551
552cc_test(
553 name = "binomial_test",
554 srcs = [
555 "binomial_test.cc",
556 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800557 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe6e7ea52019-01-13 17:26:36 -0800558 deps = [
559 ":binomial",
560 "//aos/testing:googletest",
561 ],
562)
Tyler Chatow12581562019-01-26 20:42:42 -0800563
564cc_library(
565 name = "capped_test_plant",
566 testonly = True,
567 srcs = [
568 "capped_test_plant.cc",
569 ],
570 hdrs = [
571 "capped_test_plant.h",
572 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800573 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow12581562019-01-26 20:42:42 -0800574 deps = [
575 ":state_feedback_loop",
576 "//aos/testing:googletest",
577 ],
578)
579
580cc_library(
581 name = "static_zeroing_single_dof_profiled_subsystem",
Tyler Chatow12581562019-01-26 20:42:42 -0800582 hdrs = [
583 "static_zeroing_single_dof_profiled_subsystem.h",
584 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800585 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow12581562019-01-26 20:42:42 -0800586 deps = [
587 "//frc971/control_loops:profiled_subsystem",
588 ],
589)
590
591genrule(
592 name = "genrule_static_zeroing_single_dof_profiled_subsystem_test",
593 outs = [
594 "static_zeroing_single_dof_profiled_subsystem_test_plant.h",
595 "static_zeroing_single_dof_profiled_subsystem_test_plant.cc",
James Kuszmauleeb98e92024-01-14 22:15:32 -0800596 "static_zeroing_single_dof_profiled_subsystem_test_plant.json",
Tyler Chatow12581562019-01-26 20:42:42 -0800597 "static_zeroing_single_dof_profiled_subsystem_test_integral_plant.h",
598 "static_zeroing_single_dof_profiled_subsystem_test_integral_plant.cc",
James Kuszmauleeb98e92024-01-14 22:15:32 -0800599 "static_zeroing_single_dof_profiled_subsystem_test_integral_plant.json",
Tyler Chatow12581562019-01-26 20:42:42 -0800600 ],
601 cmd = "$(location //frc971/control_loops/python:static_zeroing_single_dof_profiled_subsystem_test) $(OUTS)",
Philipp Schraderdada1072020-11-24 11:34:46 -0800602 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow12581562019-01-26 20:42:42 -0800603 tools = [
604 "//frc971/control_loops/python:static_zeroing_single_dof_profiled_subsystem_test",
605 ],
606)
607
608cc_library(
609 name = "static_zeroing_single_dof_profiled_subsystem_test_plants",
610 srcs = [
611 "static_zeroing_single_dof_profiled_subsystem_test_integral_plant.cc",
612 "static_zeroing_single_dof_profiled_subsystem_test_plant.cc",
613 ],
614 hdrs = [
615 "static_zeroing_single_dof_profiled_subsystem_test_integral_plant.h",
616 "static_zeroing_single_dof_profiled_subsystem_test_plant.h",
617 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800618 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow12581562019-01-26 20:42:42 -0800619 deps = [
620 ":state_feedback_loop",
621 ],
622)
623
James Kuszmaulf01da392023-12-14 11:22:14 -0800624static_flatbuffer(
Austin Schuha9df9ad2021-06-16 14:49:39 -0700625 name = "static_zeroing_single_dof_profiled_subsystem_test_subsystem_goal_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700626 srcs = [
Austin Schuha9df9ad2021-06-16 14:49:39 -0700627 "static_zeroing_single_dof_profiled_subsystem_test_subsystem_goal.fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700628 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700629 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800630 deps = [
631 ":control_loops_fbs",
632 ":profiled_subsystem_fbs",
633 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700634)
635
James Kuszmaulf01da392023-12-14 11:22:14 -0800636static_flatbuffer(
Austin Schuha9df9ad2021-06-16 14:49:39 -0700637 name = "static_zeroing_single_dof_profiled_subsystem_test_subsystem_output_fbs",
638 srcs = [
639 "static_zeroing_single_dof_profiled_subsystem_test_subsystem_output.fbs",
640 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700641 target_compatible_with = ["@platforms//os:linux"],
642)
643
James Kuszmaulf01da392023-12-14 11:22:14 -0800644static_flatbuffer(
Austin Schuha9df9ad2021-06-16 14:49:39 -0700645 name = "static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_position_fbs",
646 srcs = [
647 "static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_position.fbs",
648 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700649 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800650 deps = [
651 ":control_loops_fbs",
652 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700653)
654
James Kuszmaulf01da392023-12-14 11:22:14 -0800655static_flatbuffer(
Austin Schuha9df9ad2021-06-16 14:49:39 -0700656 name = "static_zeroing_single_dof_profiled_subsystem_test_absolute_position_fbs",
657 srcs = [
658 "static_zeroing_single_dof_profiled_subsystem_test_absolute_position.fbs",
659 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700660 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800661 deps = [
662 ":control_loops_fbs",
663 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700664)
665
James Kuszmaulf01da392023-12-14 11:22:14 -0800666static_flatbuffer(
Austin Schuha9df9ad2021-06-16 14:49:39 -0700667 name = "static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_encoder_status_fbs",
668 srcs = [
669 "static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_encoder_status.fbs",
670 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700671 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800672 deps = [
673 ":control_loops_fbs",
674 ":profiled_subsystem_fbs",
675 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700676)
677
James Kuszmaulf01da392023-12-14 11:22:14 -0800678static_flatbuffer(
Austin Schuha9df9ad2021-06-16 14:49:39 -0700679 name = "static_zeroing_single_dof_profiled_subsystem_test_absolute_encoder_status_fbs",
680 srcs = [
681 "static_zeroing_single_dof_profiled_subsystem_test_absolute_encoder_status.fbs",
682 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800683 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800684 deps = [
685 ":control_loops_fbs",
686 ":profiled_subsystem_fbs",
687 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700688)
689
Tyler Chatow12581562019-01-26 20:42:42 -0800690cc_test(
691 name = "static_zeroing_single_dof_profiled_subsystem_test",
692 srcs = [
693 "static_zeroing_single_dof_profiled_subsystem_test.cc",
694 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700695 data = [
696 ":static_zeroing_single_dof_profiled_subsystem_test_config",
697 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800698 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow12581562019-01-26 20:42:42 -0800699 deps = [
700 ":capped_test_plant",
701 ":position_sensor_sim",
702 ":static_zeroing_single_dof_profiled_subsystem",
Austin Schuha9df9ad2021-06-16 14:49:39 -0700703 ":static_zeroing_single_dof_profiled_subsystem_test_absolute_encoder_status_fbs",
704 ":static_zeroing_single_dof_profiled_subsystem_test_absolute_position_fbs",
Tyler Chatow12581562019-01-26 20:42:42 -0800705 ":static_zeroing_single_dof_profiled_subsystem_test_plants",
Austin Schuha9df9ad2021-06-16 14:49:39 -0700706 ":static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_encoder_status_fbs",
707 ":static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_position_fbs",
708 ":static_zeroing_single_dof_profiled_subsystem_test_subsystem_goal_fbs",
709 ":static_zeroing_single_dof_profiled_subsystem_test_subsystem_output_fbs",
Tyler Chatow12581562019-01-26 20:42:42 -0800710 "//aos/testing:googletest",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700711 "//frc971/control_loops:control_loop_test",
James Kuszmaulec635d22023-08-12 18:39:24 -0700712 "//frc971/zeroing:absolute_and_absolute_encoder",
713 "//frc971/zeroing:absolute_encoder",
714 "//frc971/zeroing:pot_and_absolute_encoder",
Tyler Chatow12581562019-01-26 20:42:42 -0800715 ],
716)
Austin Schuha9df9ad2021-06-16 14:49:39 -0700717
718aos_config(
719 name = "static_zeroing_single_dof_profiled_subsystem_test_config",
720 src = "static_zeroing_single_dof_profiled_subsystem_test_config_source.json",
721 flatbuffers = [
722 "//frc971/input:joystick_state_fbs",
723 "//frc971/input:robot_state_fbs",
724 "//aos/logging:log_message_fbs",
725 "//aos/events:event_loop_fbs",
726 ":static_zeroing_single_dof_profiled_subsystem_test_subsystem_output_fbs",
727 ":static_zeroing_single_dof_profiled_subsystem_test_absolute_encoder_status_fbs",
728 ":static_zeroing_single_dof_profiled_subsystem_test_subsystem_goal_fbs",
729 ":static_zeroing_single_dof_profiled_subsystem_test_absolute_position_fbs",
730 ":static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_encoder_status_fbs",
731 ":static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_position_fbs",
732 ],
733 target_compatible_with = ["@platforms//os:linux"],
734)
James Kuszmauleeb98e92024-01-14 22:15:32 -0800735
736static_flatbuffer(
737 name = "state_feedback_loop_fbs",
738 srcs = ["state_feedback_loop.fbs"],
739 deps = ["//frc971/math:matrix_fbs"],
740)
741
742flatbuffer_ts_library(
743 name = "state_feedback_loop_ts_fbs",
744 srcs = ["state_feedback_loop.fbs"],
745 deps = ["//frc971/math:matrix_ts_fbs"],
746)
747
748cc_library(
749 name = "hybrid_state_feedback_loop_converters",
750 srcs = ["hybrid_state_feedback_loop_converters.h"],
751 deps = [
752 ":hybrid_state_feedback_loop",
753 ":state_feedback_loop_converters",
754 ":state_feedback_loop_fbs",
755 "//frc971/math:flatbuffers_matrix",
756 ],
757)
758
759cc_library(
760 name = "state_feedback_loop_converters",
761 srcs = ["state_feedback_loop_converters.h"],
762 deps = [
763 ":state_feedback_loop",
764 ":state_feedback_loop_fbs",
765 "//frc971/math:flatbuffers_matrix",
766 ],
767)