blob: 409c75afe11ff40556c3d4f1ad080cf80414f27f [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",
Austin Schuh99f7c6a2024-06-25 22:07:44 -070056 "@com_google_absl//absl/log",
57 "@com_google_absl//absl/log:check",
James Kuszmaul61750662021-06-21 21:32:33 -070058 ],
59 "//conditions:default": [],
60 }),
61)
62
63cc_test(
64 name = "polytope_test",
65 srcs = [
66 "polytope_test.cc",
67 ],
68 target_compatible_with = ["@platforms//os:linux"],
69 deps = [
70 ":polytope",
71 "//aos/testing:googletest",
72 "//aos/testing:test_logging",
73 "@org_tuxfamily_eigen//:eigen",
74 ],
75)
76
77cc_library(
78 name = "control_loop",
79 srcs = [
80 "control_loop.cc",
81 "control_loop-tmpl.h",
82 ],
83 hdrs = [
84 "control_loop.h",
85 ],
86 target_compatible_with = ["@platforms//os:linux"],
87 deps = [
Stephan Pleines743f83a2024-02-02 18:32:09 -080088 "//aos/actions:action_lib",
James Kuszmaul61750662021-06-21 21:32:33 -070089 "//aos/events:event_loop",
90 "//aos/events:shm_event_loop",
Nikolai Sohmers2df6f302024-05-30 13:12:29 -070091 "//aos/flatbuffers:static_table",
James Kuszmaul61750662021-06-21 21:32:33 -070092 "//aos/logging",
93 "//aos/time",
94 "//aos/util:log_interval",
95 "//frc971/input:joystick_state_fbs",
96 "//frc971/input:robot_state_fbs",
97 ],
98)
99
100cc_library(
101 name = "quaternion_utils",
102 srcs = [
103 "quaternion_utils.cc",
104 ],
105 hdrs = [
106 "quaternion_utils.h",
107 ],
108 target_compatible_with = ["@platforms//os:linux"],
109 deps = [
Austin Schuh99f7c6a2024-06-25 22:07:44 -0700110 "@com_google_absl//absl/log",
111 "@com_google_absl//absl/log:check",
James Kuszmaul61750662021-06-21 21:32:33 -0700112 "@org_tuxfamily_eigen//:eigen",
113 ],
114)
115
116cc_test(
117 name = "quarternion_utils_test",
118 srcs = [
119 "quaternion_utils_test.cc",
120 ],
121 target_compatible_with = ["@platforms//os:linux"],
122 deps = [
milind-ue53bf552021-12-11 14:42:00 -0800123 ":jacobian",
James Kuszmaul61750662021-06-21 21:32:33 -0700124 ":quaternion_utils",
milind-ue53bf552021-12-11 14:42:00 -0800125 ":runge_kutta",
James Kuszmaul61750662021-06-21 21:32:33 -0700126 "//aos/testing:googletest",
127 "//aos/testing:random_seed",
Austin Schuh99f7c6a2024-06-25 22:07:44 -0700128 "@com_google_absl//absl/log",
129 "@com_google_absl//absl/log:check",
James Kuszmaul61750662021-06-21 21:32:33 -0700130 "@org_tuxfamily_eigen//:eigen",
131 ],
132)
133
134cc_library(
Austin Schuha647d602018-02-18 14:05:15 -0800135 name = "team_number_test_environment",
136 testonly = True,
137 srcs = [
138 "team_number_test_environment.cc",
139 ],
140 hdrs = [
141 "team_number_test_environment.h",
142 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800143 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800144 deps = [
John Park33858a32018-09-28 23:05:48 -0700145 "//aos/network:team_number",
Austin Schuha647d602018-02-18 14:05:15 -0800146 "//aos/testing:googletest",
147 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400148)
149
150cc_test(
Austin Schuha647d602018-02-18 14:05:15 -0800151 name = "hybrid_state_feedback_loop_test",
152 srcs = [
153 "hybrid_state_feedback_loop_test.cc",
154 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800155 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800156 deps = [
157 ":hybrid_state_feedback_loop",
158 "//aos/testing:googletest",
159 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400160)
161
162cc_library(
James Kuszmaul9f9676d2019-01-25 21:27:58 -0800163 name = "pose",
164 hdrs = ["pose.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800165 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul9f9676d2019-01-25 21:27:58 -0800166 deps = [
167 "//aos/util:math",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700168 "@org_tuxfamily_eigen//:eigen",
James Kuszmaul9f9676d2019-01-25 21:27:58 -0800169 ],
170)
171
172cc_test(
173 name = "pose_test",
174 srcs = ["pose_test.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800175 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul9f9676d2019-01-25 21:27:58 -0800176 deps = [
177 ":pose",
178 "//aos/testing:googletest",
179 ],
180)
181
182cc_library(
Niko Sohmers4a5bef82023-12-30 15:16:16 -0800183 name = "encoder_fault_detector",
184 srcs = ["encoder_fault_detector.cc"],
185 hdrs = ["encoder_fault_detector.h"],
186 target_compatible_with = ["@platforms//os:linux"],
187 deps = [
188 ":encoder_fault_status_fbs",
189 "//aos/containers:sized_array",
190 "//aos/time",
191 "//frc971/control_loops:can_talonfx_fbs",
192 ],
193)
194
195cc_test(
196 name = "encoder_fault_detector_test",
197 srcs = ["encoder_fault_detector_test.cc"],
198 target_compatible_with = ["@platforms//os:linux"],
199 deps = [
200 ":encoder_fault_detector",
201 "//aos:json_to_flatbuffer",
202 "//aos/testing:googletest",
203 ],
204)
205
206cc_library(
Austin Schuha647d602018-02-18 14:05:15 -0800207 name = "hall_effect_tracker",
208 hdrs = [
209 "hall_effect_tracker.h",
210 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800211 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800212 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700213 ":control_loops_fbs",
Austin Schuha647d602018-02-18 14:05:15 -0800214 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400215)
216
James Kuszmauldac091f2022-03-22 09:35:06 -0700217flatbuffer_ts_library(
218 name = "control_loops_ts_fbs",
219 srcs = [
220 "control_loops.fbs",
221 ],
222)
223
James Kuszmaulf01da392023-12-14 11:22:14 -0800224static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700225 name = "control_loops_fbs",
Austin Schuha647d602018-02-18 14:05:15 -0800226 srcs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700227 "control_loops.fbs",
Austin Schuha647d602018-02-18 14:05:15 -0800228 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400229)
230
Niko Sohmers76f47562023-12-20 20:59:06 -0800231flatbuffer_ts_library(
Niko Sohmers4a5bef82023-12-30 15:16:16 -0800232 name = "encoder_fault_status_ts_fbs",
233 srcs = [
234 "encoder_fault_status.fbs",
235 ],
236)
237
238static_flatbuffer(
239 name = "encoder_fault_status_fbs",
240 srcs = [
241 "encoder_fault_status.fbs",
242 ],
243)
244
245flatbuffer_ts_library(
Maxwell Henderson10ed5c32024-01-09 12:40:54 -0800246 name = "can_talonfx_ts_fbs",
Niko Sohmers76f47562023-12-20 20:59:06 -0800247 srcs = [
Maxwell Henderson10ed5c32024-01-09 12:40:54 -0800248 "can_talonfx.fbs",
Niko Sohmers76f47562023-12-20 20:59:06 -0800249 ],
250)
251
James Kuszmaulf01da392023-12-14 11:22:14 -0800252static_flatbuffer(
Maxwell Henderson10ed5c32024-01-09 12:40:54 -0800253 name = "can_talonfx_fbs",
Maxwell Hendersonca1d18f2023-07-26 21:06:14 -0700254 srcs = [
Maxwell Henderson10ed5c32024-01-09 12:40:54 -0800255 "can_talonfx.fbs",
Maxwell Hendersonca1d18f2023-07-26 21:06:14 -0700256 ],
257)
258
Brian Silverman100534c2015-09-07 15:51:23 -0400259cc_test(
Austin Schuha647d602018-02-18 14:05:15 -0800260 name = "position_sensor_sim_test",
261 srcs = [
262 "position_sensor_sim_test.cc",
263 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800264 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800265 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700266 ":control_loops_fbs",
Austin Schuha647d602018-02-18 14:05:15 -0800267 ":position_sensor_sim",
John Park33858a32018-09-28 23:05:48 -0700268 "//aos/logging",
Austin Schuha647d602018-02-18 14:05:15 -0800269 "//aos/testing:googletest",
270 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400271)
272
273cc_library(
Austin Schuha647d602018-02-18 14:05:15 -0800274 name = "position_sensor_sim",
275 testonly = True,
276 srcs = [
277 "position_sensor_sim.cc",
278 ],
279 hdrs = [
280 "position_sensor_sim.h",
281 ],
Brian Silverman6470f442018-08-05 12:08:16 -0700282 linkopts = [
283 "-lm",
284 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800285 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800286 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700287 ":control_loops_fbs",
Austin Schuha647d602018-02-18 14:05:15 -0800288 ":gaussian_noise",
Austin Schuha647d602018-02-18 14:05:15 -0800289 "//aos/testing:random_seed",
Philipp Schraderb3a057e2018-03-10 18:59:40 -0800290 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400291)
292
293cc_library(
Austin Schuha647d602018-02-18 14:05:15 -0800294 name = "gaussian_noise",
295 srcs = [
296 "gaussian_noise.cc",
297 ],
298 hdrs = [
299 "gaussian_noise.h",
300 ],
Philipp Schraderb3a057e2018-03-10 18:59:40 -0800301 linkopts = [
302 "-lm",
Austin Schuha647d602018-02-18 14:05:15 -0800303 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800304 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700305)
306
307cc_library(
Austin Schuha647d602018-02-18 14:05:15 -0800308 name = "coerce_goal",
309 srcs = [
310 "coerce_goal.cc",
311 ],
312 hdrs = [
313 "coerce_goal.h",
314 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800315 linkopts = select({
316 "@platforms//os:linux": ["-lm"],
317 "//conditions:default": [],
318 }),
Austin Schuha647d602018-02-18 14:05:15 -0800319 deps = [
James Kuszmaul61750662021-06-21 21:32:33 -0700320 "//frc971/control_loops:polytope",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700321 "@org_tuxfamily_eigen//:eigen",
Austin Schuha647d602018-02-18 14:05:15 -0800322 ],
Brian Silverman100534c2015-09-07 15:51:23 -0400323)
324
Lee Mracek65686142020-01-10 22:21:39 -0500325cc_test(
326 name = "coerce_goal_test",
327 srcs = [
328 "coerce_goal_test.cc",
329 ],
330 linkopts = [
331 "-lm",
332 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800333 target_compatible_with = ["@platforms//os:linux"],
Lee Mracek65686142020-01-10 22:21:39 -0500334 deps = [
335 ":coerce_goal",
Lee Mracek65686142020-01-10 22:21:39 -0500336 "//aos/testing:googletest",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700337 "//frc971/control_loops:polytope",
Lee Mracek65686142020-01-10 22:21:39 -0500338 "@org_tuxfamily_eigen//:eigen",
339 ],
340)
341
Austin Schuh4cc4fe22017-11-23 19:13:09 -0800342cc_library(
Austin Schuha647d602018-02-18 14:05:15 -0800343 name = "state_feedback_loop",
344 hdrs = [
345 "state_feedback_loop.h",
346 ],
347 deps = [
John Park33858a32018-09-28 23:05:48 -0700348 "//aos:macros",
James Kuszmaul9ea3ff92024-06-14 15:02:15 -0700349 "//frc971/zeroing:wrap",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700350 "@org_tuxfamily_eigen//:eigen",
Philipp Schraderdada1072020-11-24 11:34:46 -0800351 ] + select({
352 "@platforms//os:linux": ["//aos/logging"],
353 "//conditions:default": [],
354 }),
Brian Silverman100534c2015-09-07 15:51:23 -0400355)
Brian Silverman2b1957a2016-02-14 20:29:57 -0500356
357cc_library(
Austin Schuha647d602018-02-18 14:05:15 -0800358 name = "hybrid_state_feedback_loop",
359 hdrs = [
360 "hybrid_state_feedback_loop.h",
361 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800362 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800363 deps = [
Austin Schuh9b881ae2019-01-04 07:29:20 +1100364 ":c2d",
Austin Schuha647d602018-02-18 14:05:15 -0800365 ":state_feedback_loop",
John Park33858a32018-09-28 23:05:48 -0700366 "//aos:macros",
John Park33858a32018-09-28 23:05:48 -0700367 "//aos/logging",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700368 "//frc971/control_loops:control_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700369 "@org_tuxfamily_eigen//:eigen",
Austin Schuha647d602018-02-18 14:05:15 -0800370 ],
Brian Silverman2b1957a2016-02-14 20:29:57 -0500371)
Austin Schuhacd335a2017-01-01 16:20:54 -0800372
373cc_library(
Austin Schuha647d602018-02-18 14:05:15 -0800374 name = "simple_capped_state_feedback_loop",
375 hdrs = [
376 "simple_capped_state_feedback_loop.h",
377 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800378 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800379 deps = [
380 ":state_feedback_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700381 "@org_tuxfamily_eigen//:eigen",
Austin Schuha647d602018-02-18 14:05:15 -0800382 ],
383)
384
385cc_library(
386 name = "runge_kutta",
387 hdrs = [
388 "runge_kutta.h",
Austin Schuhb0bfaf82024-06-19 19:47:23 -0700389 "runge_kutta_helpers.h",
Austin Schuha647d602018-02-18 14:05:15 -0800390 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800391 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800392 deps = [
Austin Schuh99f7c6a2024-06-25 22:07:44 -0700393 "@com_google_absl//absl/log",
394 "@com_google_absl//absl/log:check",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700395 "@org_tuxfamily_eigen//:eigen",
Austin Schuha647d602018-02-18 14:05:15 -0800396 ],
Austin Schuhacd335a2017-01-01 16:20:54 -0800397)
398
399cc_test(
Austin Schuha647d602018-02-18 14:05:15 -0800400 name = "runge_kutta_test",
401 srcs = [
402 "runge_kutta_test.cc",
403 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800404 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800405 deps = [
406 ":runge_kutta",
407 "//aos/testing:googletest",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700408 "@org_tuxfamily_eigen//:eigen",
Austin Schuha647d602018-02-18 14:05:15 -0800409 ],
Austin Schuhacd335a2017-01-01 16:20:54 -0800410)
Austin Schuh473a5652017-02-05 01:30:42 -0800411
Austin Schuh173a1592018-12-19 16:20:54 +1100412cc_library(
413 name = "fixed_quadrature",
414 hdrs = [
415 "fixed_quadrature.h",
416 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800417 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha935a082023-02-20 21:45:54 -0800418 deps = [
419 "@org_tuxfamily_eigen//:eigen",
420 ],
Austin Schuh173a1592018-12-19 16:20:54 +1100421)
422
423cc_test(
424 name = "fixed_quadrature_test",
425 srcs = [
426 "fixed_quadrature_test.cc",
427 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800428 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh173a1592018-12-19 16:20:54 +1100429 deps = [
430 ":fixed_quadrature",
431 "//aos/testing:googletest",
432 ],
433)
434
James Kuszmauldac091f2022-03-22 09:35:06 -0700435flatbuffer_ts_library(
436 name = "profiled_subsystem_ts_fbs",
437 srcs = [
438 "profiled_subsystem.fbs",
439 ],
440 deps = [
441 ":control_loops_ts_fbs",
James Kuszmauleeb98e92024-01-14 22:15:32 -0800442 ":state_feedback_loop_ts_fbs",
James Kuszmauldac091f2022-03-22 09:35:06 -0700443 ],
444)
445
James Kuszmaulf01da392023-12-14 11:22:14 -0800446static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700447 name = "profiled_subsystem_fbs",
Austin Schuha647d602018-02-18 14:05:15 -0800448 srcs = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700449 "profiled_subsystem.fbs",
Austin Schuha647d602018-02-18 14:05:15 -0800450 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800451 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800452 deps = [
453 ":control_loops_fbs",
James Kuszmauleeb98e92024-01-14 22:15:32 -0800454 ":state_feedback_loop_fbs",
James Kuszmaulf01da392023-12-14 11:22:14 -0800455 ],
Austin Schuh9fe68f72019-08-10 19:32:03 -0700456)
457
Austin Schuh473a5652017-02-05 01:30:42 -0800458cc_library(
Austin Schuha647d602018-02-18 14:05:15 -0800459 name = "profiled_subsystem",
460 srcs = [
461 "profiled_subsystem.cc",
462 ],
463 hdrs = [
464 "profiled_subsystem.h",
465 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800466 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800467 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700468 ":control_loops_fbs",
469 ":profiled_subsystem_fbs",
Austin Schuha647d602018-02-18 14:05:15 -0800470 ":simple_capped_state_feedback_loop",
471 ":state_feedback_loop",
James Kuszmauleeb98e92024-01-14 22:15:32 -0800472 ":state_feedback_loop_converters",
473 "//aos:flatbuffer_merge",
John Park33858a32018-09-28 23:05:48 -0700474 "//aos/util:trapezoid_profile",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700475 "//frc971/control_loops:control_loop",
Austin Schuha647d602018-02-18 14:05:15 -0800476 "//frc971/zeroing",
James Kuszmaulec635d22023-08-12 18:39:24 -0700477 "//frc971/zeroing:pot_and_index",
Austin Schuha647d602018-02-18 14:05:15 -0800478 ],
Austin Schuh473a5652017-02-05 01:30:42 -0800479)
Austin Schuha647d602018-02-18 14:05:15 -0800480
481cc_library(
482 name = "jacobian",
483 hdrs = [
484 "jacobian.h",
485 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800486 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800487 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700488 "@org_tuxfamily_eigen//:eigen",
Austin Schuha647d602018-02-18 14:05:15 -0800489 ],
490)
491
492cc_test(
493 name = "jacobian_test",
494 srcs = [
495 "jacobian_test.cc",
496 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800497 target_compatible_with = ["@platforms//os:linux"],
Austin Schuha647d602018-02-18 14:05:15 -0800498 deps = [
499 ":jacobian",
500 "//aos/testing:googletest",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700501 "@org_tuxfamily_eigen//:eigen",
Austin Schuha647d602018-02-18 14:05:15 -0800502 ],
503)
504
James Kuszmaul59a5c612019-01-22 07:56:08 -0800505cc_test(
506 name = "c2d_test",
507 srcs = [
508 "c2d_test.cc",
509 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800510 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul59a5c612019-01-22 07:56:08 -0800511 visibility = ["//visibility:public"],
512 deps = [
513 ":c2d",
514 ":runge_kutta",
515 "//aos/testing:googletest",
516 ],
517)
518
Austin Schuh03785132018-02-19 18:29:06 -0800519cc_library(
Austin Schuh9b881ae2019-01-04 07:29:20 +1100520 name = "c2d",
521 hdrs = [
522 "c2d.h",
523 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800524 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh9b881ae2019-01-04 07:29:20 +1100525 visibility = ["//visibility:public"],
526 deps = [
James Kuszmaul651fc3f2019-05-15 21:14:25 -0700527 "//aos/time",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700528 "@org_tuxfamily_eigen//:eigen",
Austin Schuh9b881ae2019-01-04 07:29:20 +1100529 ],
530)
531
532cc_library(
Austin Schuh03785132018-02-19 18:29:06 -0800533 name = "dlqr",
534 hdrs = [
535 "dlqr.h",
536 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800537 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh03785132018-02-19 18:29:06 -0800538 visibility = ["//visibility:public"],
539 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700540 "@org_tuxfamily_eigen//:eigen",
Austin Schuh03785132018-02-19 18:29:06 -0800541 "@slycot_repo//:slicot",
542 ],
543)
Brian Silverman6470f442018-08-05 12:08:16 -0700544
545py_library(
546 name = "python_init",
547 srcs = ["__init__.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800548 target_compatible_with = ["@platforms//os:linux"],
Brian Silverman6470f442018-08-05 12:08:16 -0700549 visibility = ["//visibility:public"],
550 deps = ["//frc971:python_init"],
551)
Austin Schuhe6e7ea52019-01-13 17:26:36 -0800552
553cc_library(
554 name = "binomial",
555 hdrs = ["binomial.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800556 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe6e7ea52019-01-13 17:26:36 -0800557)
558
559cc_test(
560 name = "binomial_test",
561 srcs = [
562 "binomial_test.cc",
563 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800564 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhe6e7ea52019-01-13 17:26:36 -0800565 deps = [
566 ":binomial",
567 "//aos/testing:googletest",
568 ],
569)
Tyler Chatow12581562019-01-26 20:42:42 -0800570
571cc_library(
572 name = "capped_test_plant",
573 testonly = True,
574 srcs = [
575 "capped_test_plant.cc",
576 ],
577 hdrs = [
578 "capped_test_plant.h",
579 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800580 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow12581562019-01-26 20:42:42 -0800581 deps = [
582 ":state_feedback_loop",
583 "//aos/testing:googletest",
584 ],
585)
586
587cc_library(
588 name = "static_zeroing_single_dof_profiled_subsystem",
Tyler Chatow12581562019-01-26 20:42:42 -0800589 hdrs = [
590 "static_zeroing_single_dof_profiled_subsystem.h",
591 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800592 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow12581562019-01-26 20:42:42 -0800593 deps = [
594 "//frc971/control_loops:profiled_subsystem",
595 ],
596)
597
598genrule(
599 name = "genrule_static_zeroing_single_dof_profiled_subsystem_test",
600 outs = [
601 "static_zeroing_single_dof_profiled_subsystem_test_plant.h",
602 "static_zeroing_single_dof_profiled_subsystem_test_plant.cc",
James Kuszmauleeb98e92024-01-14 22:15:32 -0800603 "static_zeroing_single_dof_profiled_subsystem_test_plant.json",
Tyler Chatow12581562019-01-26 20:42:42 -0800604 "static_zeroing_single_dof_profiled_subsystem_test_integral_plant.h",
605 "static_zeroing_single_dof_profiled_subsystem_test_integral_plant.cc",
James Kuszmauleeb98e92024-01-14 22:15:32 -0800606 "static_zeroing_single_dof_profiled_subsystem_test_integral_plant.json",
Tyler Chatow12581562019-01-26 20:42:42 -0800607 ],
608 cmd = "$(location //frc971/control_loops/python:static_zeroing_single_dof_profiled_subsystem_test) $(OUTS)",
Philipp Schraderdada1072020-11-24 11:34:46 -0800609 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow12581562019-01-26 20:42:42 -0800610 tools = [
611 "//frc971/control_loops/python:static_zeroing_single_dof_profiled_subsystem_test",
612 ],
613)
614
James Kuszmaul9ea3ff92024-06-14 15:02:15 -0700615genrule(
616 name = "genrule_wrapped_subsystem_test",
617 outs = [
618 "wrapped_subsystem_test_plant.h",
619 "wrapped_subsystem_test_plant.cc",
620 "wrapped_subsystem_test_plant.json",
621 "wrapped_subsystem_test_integral_plant.h",
622 "wrapped_subsystem_test_integral_plant.cc",
623 "wrapped_subsystem_test_integral_plant.json",
624 ],
625 cmd = "$(location //frc971/control_loops/python:wrapped_subsystem_test) $(OUTS)",
626 target_compatible_with = ["@platforms//os:linux"],
627 tools = [
628 "//frc971/control_loops/python:wrapped_subsystem_test",
629 ],
630)
631
632cc_library(
633 name = "wrapped_subsystem_test_plants",
634 srcs = [
635 "wrapped_subsystem_test_integral_plant.cc",
636 "wrapped_subsystem_test_plant.cc",
637 ],
638 hdrs = [
639 "wrapped_subsystem_test_integral_plant.h",
640 "wrapped_subsystem_test_plant.h",
641 ],
642 target_compatible_with = ["@platforms//os:linux"],
643 deps = [
644 ":state_feedback_loop",
645 ],
646)
647
Tyler Chatow12581562019-01-26 20:42:42 -0800648cc_library(
649 name = "static_zeroing_single_dof_profiled_subsystem_test_plants",
650 srcs = [
651 "static_zeroing_single_dof_profiled_subsystem_test_integral_plant.cc",
652 "static_zeroing_single_dof_profiled_subsystem_test_plant.cc",
653 ],
654 hdrs = [
655 "static_zeroing_single_dof_profiled_subsystem_test_integral_plant.h",
656 "static_zeroing_single_dof_profiled_subsystem_test_plant.h",
657 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800658 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow12581562019-01-26 20:42:42 -0800659 deps = [
660 ":state_feedback_loop",
661 ],
662)
663
James Kuszmaulf01da392023-12-14 11:22:14 -0800664static_flatbuffer(
Austin Schuha9df9ad2021-06-16 14:49:39 -0700665 name = "static_zeroing_single_dof_profiled_subsystem_test_subsystem_goal_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700666 srcs = [
Austin Schuha9df9ad2021-06-16 14:49:39 -0700667 "static_zeroing_single_dof_profiled_subsystem_test_subsystem_goal.fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700668 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700669 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800670 deps = [
671 ":control_loops_fbs",
672 ":profiled_subsystem_fbs",
673 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700674)
675
James Kuszmaulf01da392023-12-14 11:22:14 -0800676static_flatbuffer(
Austin Schuha9df9ad2021-06-16 14:49:39 -0700677 name = "static_zeroing_single_dof_profiled_subsystem_test_subsystem_output_fbs",
678 srcs = [
679 "static_zeroing_single_dof_profiled_subsystem_test_subsystem_output.fbs",
680 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700681 target_compatible_with = ["@platforms//os:linux"],
682)
683
James Kuszmaulf01da392023-12-14 11:22:14 -0800684static_flatbuffer(
Austin Schuha9df9ad2021-06-16 14:49:39 -0700685 name = "static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_position_fbs",
686 srcs = [
687 "static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_position.fbs",
688 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700689 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800690 deps = [
691 ":control_loops_fbs",
692 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700693)
694
James Kuszmaulf01da392023-12-14 11:22:14 -0800695static_flatbuffer(
Austin Schuha9df9ad2021-06-16 14:49:39 -0700696 name = "static_zeroing_single_dof_profiled_subsystem_test_absolute_position_fbs",
697 srcs = [
698 "static_zeroing_single_dof_profiled_subsystem_test_absolute_position.fbs",
699 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700700 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800701 deps = [
702 ":control_loops_fbs",
703 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700704)
705
James Kuszmaulf01da392023-12-14 11:22:14 -0800706static_flatbuffer(
Austin Schuha9df9ad2021-06-16 14:49:39 -0700707 name = "static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_encoder_status_fbs",
708 srcs = [
709 "static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_encoder_status.fbs",
710 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700711 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800712 deps = [
713 ":control_loops_fbs",
714 ":profiled_subsystem_fbs",
715 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700716)
717
James Kuszmaulf01da392023-12-14 11:22:14 -0800718static_flatbuffer(
Austin Schuha9df9ad2021-06-16 14:49:39 -0700719 name = "static_zeroing_single_dof_profiled_subsystem_test_absolute_encoder_status_fbs",
720 srcs = [
721 "static_zeroing_single_dof_profiled_subsystem_test_absolute_encoder_status.fbs",
722 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800723 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800724 deps = [
725 ":control_loops_fbs",
726 ":profiled_subsystem_fbs",
727 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700728)
729
Tyler Chatow12581562019-01-26 20:42:42 -0800730cc_test(
731 name = "static_zeroing_single_dof_profiled_subsystem_test",
732 srcs = [
733 "static_zeroing_single_dof_profiled_subsystem_test.cc",
734 ],
Austin Schuha9df9ad2021-06-16 14:49:39 -0700735 data = [
736 ":static_zeroing_single_dof_profiled_subsystem_test_config",
737 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800738 target_compatible_with = ["@platforms//os:linux"],
Tyler Chatow12581562019-01-26 20:42:42 -0800739 deps = [
740 ":capped_test_plant",
741 ":position_sensor_sim",
742 ":static_zeroing_single_dof_profiled_subsystem",
Austin Schuha9df9ad2021-06-16 14:49:39 -0700743 ":static_zeroing_single_dof_profiled_subsystem_test_absolute_encoder_status_fbs",
744 ":static_zeroing_single_dof_profiled_subsystem_test_absolute_position_fbs",
Tyler Chatow12581562019-01-26 20:42:42 -0800745 ":static_zeroing_single_dof_profiled_subsystem_test_plants",
Austin Schuha9df9ad2021-06-16 14:49:39 -0700746 ":static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_encoder_status_fbs",
747 ":static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_position_fbs",
748 ":static_zeroing_single_dof_profiled_subsystem_test_subsystem_goal_fbs",
749 ":static_zeroing_single_dof_profiled_subsystem_test_subsystem_output_fbs",
James Kuszmaul9ea3ff92024-06-14 15:02:15 -0700750 ":wrapped_subsystem_test_plants",
Tyler Chatow12581562019-01-26 20:42:42 -0800751 "//aos/testing:googletest",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700752 "//frc971/control_loops:control_loop_test",
James Kuszmaulec635d22023-08-12 18:39:24 -0700753 "//frc971/zeroing:absolute_and_absolute_encoder",
754 "//frc971/zeroing:absolute_encoder",
James Kuszmaul9ea3ff92024-06-14 15:02:15 -0700755 "//frc971/zeroing:continuous_absolute_encoder",
James Kuszmaulec635d22023-08-12 18:39:24 -0700756 "//frc971/zeroing:pot_and_absolute_encoder",
Tyler Chatow12581562019-01-26 20:42:42 -0800757 ],
758)
Austin Schuha9df9ad2021-06-16 14:49:39 -0700759
760aos_config(
761 name = "static_zeroing_single_dof_profiled_subsystem_test_config",
762 src = "static_zeroing_single_dof_profiled_subsystem_test_config_source.json",
763 flatbuffers = [
764 "//frc971/input:joystick_state_fbs",
765 "//frc971/input:robot_state_fbs",
766 "//aos/logging:log_message_fbs",
767 "//aos/events:event_loop_fbs",
768 ":static_zeroing_single_dof_profiled_subsystem_test_subsystem_output_fbs",
769 ":static_zeroing_single_dof_profiled_subsystem_test_absolute_encoder_status_fbs",
770 ":static_zeroing_single_dof_profiled_subsystem_test_subsystem_goal_fbs",
771 ":static_zeroing_single_dof_profiled_subsystem_test_absolute_position_fbs",
772 ":static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_encoder_status_fbs",
773 ":static_zeroing_single_dof_profiled_subsystem_test_pot_and_absolute_position_fbs",
774 ],
775 target_compatible_with = ["@platforms//os:linux"],
776)
James Kuszmauleeb98e92024-01-14 22:15:32 -0800777
778static_flatbuffer(
779 name = "state_feedback_loop_fbs",
780 srcs = ["state_feedback_loop.fbs"],
781 deps = ["//frc971/math:matrix_fbs"],
782)
783
784flatbuffer_ts_library(
785 name = "state_feedback_loop_ts_fbs",
786 srcs = ["state_feedback_loop.fbs"],
787 deps = ["//frc971/math:matrix_ts_fbs"],
788)
789
790cc_library(
791 name = "hybrid_state_feedback_loop_converters",
792 srcs = ["hybrid_state_feedback_loop_converters.h"],
793 deps = [
794 ":hybrid_state_feedback_loop",
795 ":state_feedback_loop_converters",
796 ":state_feedback_loop_fbs",
797 "//frc971/math:flatbuffers_matrix",
798 ],
799)
800
801cc_library(
802 name = "state_feedback_loop_converters",
803 srcs = ["state_feedback_loop_converters.h"],
804 deps = [
805 ":state_feedback_loop",
806 ":state_feedback_loop_fbs",
807 "//frc971/math:flatbuffers_matrix",
808 ],
809)