blob: 6f9883925154086748640add95e63aaa862e32ca [file] [log] [blame]
James Kuszmaulf01da392023-12-14 11:22:14 -08001load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
James Kuszmaul62c3bd82024-01-17 20:03:05 -08002load("//tools/build_rules:template.bzl", "jinja2_template")
Philipp Schrader3de4dfc2023-02-15 20:18:25 -08003load("//tools/build_rules:js.bzl", "ts_project")
Austin Schuha1d006e2022-09-14 21:50:42 -07004load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library")
Alex Perrycb7da4b2019-08-28 19:35:56 -07005load("//aos:config.bzl", "aos_config")
Philipp Schraderdada1072020-11-24 11:34:46 -08006load("//tools/build_rules:select.bzl", "cpu_select")
Austin Schuh41fad8c2021-10-23 21:25:12 -07007load("//aos:flatbuffers.bzl", "cc_static_flatbuffer")
Comran Morshed5323ecb2015-12-26 20:50:55 +00008
Philipp Schradercc016b32021-12-30 08:59:58 -08009package(default_visibility = ["//visibility:public"])
10
James Kuszmaulf01da392023-12-14 11:22:14 -080011static_flatbuffer(
Maxwell Hendersoncef6f042023-05-26 14:38:09 -070012 name = "drivetrain_can_position_fbs",
13 srcs = ["drivetrain_can_position.fbs"],
Maxwell Henderson10ed5c32024-01-09 12:40:54 -080014 deps = ["//frc971/control_loops:can_talonfx_fbs"],
Maxwell Hendersoncef6f042023-05-26 14:38:09 -070015)
16
James Kuszmaulf01da392023-12-14 11:22:14 -080017static_flatbuffer(
James Kuszmaul75a18c52021-03-10 22:02:07 -080018 name = "spline_goal_fbs",
19 srcs = ["spline_goal.fbs"],
James Kuszmaulf01da392023-12-14 11:22:14 -080020 deps = ["//frc971/control_loops:control_loops_fbs"],
James Kuszmaul75a18c52021-03-10 22:02:07 -080021)
22
James Kuszmaulf01da392023-12-14 11:22:14 -080023static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -070024 name = "drivetrain_goal_fbs",
25 srcs = ["drivetrain_goal.fbs"],
James Kuszmaulf01da392023-12-14 11:22:14 -080026 deps = [
27 ":spline_goal_fbs",
28 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul75a18c52021-03-10 22:02:07 -080029 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +000030)
31
James Kuszmaulf01da392023-12-14 11:22:14 -080032static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -070033 name = "drivetrain_output_fbs",
34 srcs = ["drivetrain_output.fbs"],
Alex Perrycb7da4b2019-08-28 19:35:56 -070035)
36
James Kuszmaulf01da392023-12-14 11:22:14 -080037static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -070038 name = "drivetrain_position_fbs",
39 srcs = ["drivetrain_position.fbs"],
Alex Perrycb7da4b2019-08-28 19:35:56 -070040)
41
James Kuszmaulf01da392023-12-14 11:22:14 -080042static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -070043 name = "drivetrain_status_fbs",
44 srcs = ["drivetrain_status.fbs"],
James Kuszmaulf01da392023-12-14 11:22:14 -080045 deps = ["//frc971/control_loops:control_loops_fbs"],
Alex Perrycb7da4b2019-08-28 19:35:56 -070046)
47
James Kuszmaulf01da392023-12-14 11:22:14 -080048static_flatbuffer(
James Kuszmaul75a18c52021-03-10 22:02:07 -080049 name = "trajectory_fbs",
50 srcs = ["trajectory.fbs"],
James Kuszmaulf01da392023-12-14 11:22:14 -080051 deps = ["//frc971/control_loops:control_loops_fbs"],
James Kuszmaul75a18c52021-03-10 22:02:07 -080052)
53
Austin Schuh41fad8c2021-10-23 21:25:12 -070054cc_static_flatbuffer(
55 name = "trajectory_schema",
56 function = "frc971::control_loops::drivetrain::fb::TrajectorySchema",
57 target = ":trajectory_fbs_reflection_out",
58 visibility = ["//visibility:public"],
59)
60
Alex Perry2124ae82020-03-07 14:19:06 -080061flatbuffer_ts_library(
62 name = "drivetrain_status_ts_fbs",
63 srcs = ["drivetrain_status.fbs"],
Philipp Schraderdada1072020-11-24 11:34:46 -080064 target_compatible_with = ["@platforms//os:linux"],
James Kuszmauldac091f2022-03-22 09:35:06 -070065 deps = ["//frc971/control_loops:control_loops_ts_fbs"],
Alex Perry2124ae82020-03-07 14:19:06 -080066)
67
Niko Sohmers76f47562023-12-20 20:59:06 -080068flatbuffer_ts_library(
69 name = "drivetrain_position_ts_fbs",
70 srcs = ["drivetrain_position.fbs"],
71 target_compatible_with = ["@platforms//os:linux"],
72)
73
74flatbuffer_ts_library(
75 name = "drivetrain_can_position_ts_fbs",
76 srcs = ["drivetrain_can_position.fbs"],
77 target_compatible_with = ["@platforms//os:linux"],
Maxwell Henderson10ed5c32024-01-09 12:40:54 -080078 deps = ["//frc971/control_loops:can_talonfx_ts_fbs"],
Niko Sohmers76f47562023-12-20 20:59:06 -080079)
80
Alex Perrycb7da4b2019-08-28 19:35:56 -070081genrule(
82 name = "drivetrain_goal_float_fbs_generated",
83 srcs = ["drivetrain_goal.fbs"],
84 outs = ["drivetrain_goal_float.fbs"],
85 cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
Alex Perrycb7da4b2019-08-28 19:35:56 -070086)
87
88genrule(
89 name = "drivetrain_position_float_fbs_generated",
90 srcs = ["drivetrain_position.fbs"],
91 outs = ["drivetrain_position_float.fbs"],
92 cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
Alex Perrycb7da4b2019-08-28 19:35:56 -070093)
94
95genrule(
96 name = "drivetrain_output_float_fbs_generated",
97 srcs = ["drivetrain_output.fbs"],
98 outs = ["drivetrain_output_float.fbs"],
99 cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700100)
101
102genrule(
103 name = "drivetrain_status_float_fbs_generated",
104 srcs = ["drivetrain_status.fbs"],
105 outs = ["drivetrain_status_float.fbs"],
106 cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700107)
108
James Kuszmaulf01da392023-12-14 11:22:14 -0800109static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700110 name = "drivetrain_goal_float_fbs",
111 srcs = ["drivetrain_goal_float.fbs"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800112 deps = [
113 ":spline_goal_fbs",
114 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800115 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700116)
117
James Kuszmaulf01da392023-12-14 11:22:14 -0800118static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700119 name = "drivetrain_output_float_fbs",
120 srcs = ["drivetrain_output_float.fbs"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700121)
122
James Kuszmaulf01da392023-12-14 11:22:14 -0800123static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700124 name = "drivetrain_position_float_fbs",
125 srcs = ["drivetrain_position_float.fbs"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700126)
127
James Kuszmaulf01da392023-12-14 11:22:14 -0800128static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700129 name = "drivetrain_status_float_fbs",
130 srcs = ["drivetrain_status_float.fbs"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800131 deps = ["//frc971/control_loops:control_loops_fbs"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700132)
133
134aos_config(
James Kuszmaul74d8f972020-02-11 17:13:17 -0800135 name = "simulation_channels",
136 src = "drivetrain_simulation_channels.json",
137 flatbuffers = [
138 ":drivetrain_status_fbs",
139 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800140 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul74d8f972020-02-11 17:13:17 -0800141 visibility = ["//visibility:public"],
142)
143
144aos_config(
145 name = "simulation_config",
146 src = "drivetrain_simulation_config.json",
Philipp Schraderdada1072020-11-24 11:34:46 -0800147 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul74d8f972020-02-11 17:13:17 -0800148 visibility = ["//visibility:public"],
149 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800150 ":aos_config",
James Kuszmaul74d8f972020-02-11 17:13:17 -0800151 ":simulation_channels",
152 ],
153)
154
155aos_config(
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800156 name = "aos_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700157 src = "drivetrain_config.json",
158 flatbuffers = [
159 ":drivetrain_goal_fbs",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800160 ":trajectory_fbs",
161 ":spline_goal_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700162 ":drivetrain_output_fbs",
163 ":drivetrain_status_fbs",
164 ":drivetrain_position_fbs",
165 ":localizer_fbs",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800166 "//frc971/queues:gyro_fbs",
167 "//frc971/queues:gyro_uid_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700168 "//frc971/wpilib:imu_fbs",
Austin Schuhac17fba2020-03-28 15:55:33 -0700169 "//frc971/wpilib:imu_batch_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700170 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800171 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700172 visibility = ["//visibility:public"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700173 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800174 "//frc971/input:aos_config",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700175 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000176)
177
178cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700179 name = "drivetrain_config",
180 hdrs = [
181 "drivetrain_config.h",
182 ],
183 deps = [
184 "//frc971:shifter_hall_effect",
185 "//frc971/control_loops:state_feedback_loop",
James Kuszmaul68025332024-01-20 17:06:02 -0800186 "//frc971/control_loops:state_feedback_loop_converters",
187 ":drivetrain_config_fbs",
Philipp Schraderdada1072020-11-24 11:34:46 -0800188 ] + select({
James Kuszmaul68025332024-01-20 17:06:02 -0800189 "@platforms//os:linux": [
190 "//frc971/control_loops:hybrid_state_feedback_loop",
191 "//frc971/control_loops:hybrid_state_feedback_loop_converters",
192 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800193 "//conditions:default": [],
194 }),
Comran Morshed5323ecb2015-12-26 20:50:55 +0000195)
196
197cc_library(
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800198 name = "hybrid_ekf",
199 hdrs = ["hybrid_ekf.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800200 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800201 deps = [
202 ":drivetrain_config",
James Kuszmaul3c5b4d32020-02-11 17:22:14 -0800203 "//aos:math",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800204 "//aos/containers:priority_queue",
James Kuszmaulfedc4612019-03-10 11:24:51 -0700205 "//aos/util:math",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800206 "//frc971/control_loops:c2d",
207 "//frc971/control_loops:runge_kutta",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700208 "@org_tuxfamily_eigen//:eigen",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800209 ],
210)
211
212cc_test(
213 name = "hybrid_ekf_test",
214 srcs = ["hybrid_ekf_test.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800215 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800216 deps = [
217 ":drivetrain_test_lib",
218 ":hybrid_ekf",
219 ":trajectory",
220 "//aos/testing:googletest",
221 "//aos/testing:random_seed",
222 "//aos/testing:test_shm",
223 ],
224)
225
James Kuszmaulf01da392023-12-14 11:22:14 -0800226static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700227 name = "localizer_fbs",
228 srcs = ["localizer.fbs"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800229 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulef428a02019-03-02 22:19:41 -0800230)
231
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800232cc_library(
James Kuszmaul3431d622019-02-17 17:07:44 -0800233 name = "localizer",
234 hdrs = ["localizer.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800235 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul3431d622019-02-17 17:07:44 -0800236 deps = [
237 ":drivetrain_config",
James Kuszmaul3c5b4d32020-02-11 17:22:14 -0800238 ":drivetrain_status_fbs",
James Kuszmaul3431d622019-02-17 17:07:44 -0800239 ":hybrid_ekf",
James Kuszmaul5398fae2020-02-17 16:44:03 -0800240 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul5bc6fc92019-03-01 21:50:06 -0800241 "//frc971/control_loops:pose",
James Kuszmaul3431d622019-02-17 17:07:44 -0800242 ],
243)
244
245cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700246 name = "gear",
247 hdrs = [
248 "gear.h",
249 ],
Austin Schuh093535c2016-03-05 23:21:00 -0800250)
251
252cc_library(
Alex Perry731b4602019-02-02 22:13:01 -0800253 name = "splinedrivetrain",
254 srcs = [
255 "splinedrivetrain.cc",
256 ],
257 hdrs = [
258 "splinedrivetrain.h",
259 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800260 target_compatible_with = ["@platforms//os:linux"],
Alex Perry731b4602019-02-02 22:13:01 -0800261 deps = [
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800262 ":distance_spline",
Alex Perry731b4602019-02-02 22:13:01 -0800263 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700264 ":drivetrain_goal_fbs",
265 ":drivetrain_output_fbs",
266 ":drivetrain_status_fbs",
Alex Perry731b4602019-02-02 22:13:01 -0800267 ":spline",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800268 ":spline_goal_fbs",
Alex Perry731b4602019-02-02 22:13:01 -0800269 ":trajectory",
Austin Schuh3d9ccd72020-08-01 15:42:40 -0700270 "//aos:condition",
Alex Perry1ec34522019-02-17 22:44:10 -0800271 "//aos:init",
James Kuszmaulc73bb222019-04-07 12:15:35 -0700272 "//aos/util:math",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700273 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800274 ],
Alex Perry731b4602019-02-02 22:13:01 -0800275)
276
277cc_library(
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800278 name = "line_follow_drivetrain",
279 srcs = [
280 "line_follow_drivetrain.cc",
281 ],
282 hdrs = [
283 "line_follow_drivetrain.h",
284 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800285 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800286 deps = [
287 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700288 ":drivetrain_goal_fbs",
289 ":drivetrain_output_fbs",
290 ":drivetrain_status_fbs",
James Kuszmaul5bc6fc92019-03-01 21:50:06 -0800291 ":localizer",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800292 ":spline_goal_fbs",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800293 "//aos:math",
294 "//aos/util:math",
295 "//frc971/control_loops:c2d",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700296 "//frc971/control_loops:control_loops_fbs",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800297 "//frc971/control_loops:dlqr",
298 "//frc971/control_loops:pose",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700299 "//frc971/control_loops:profiled_subsystem_fbs",
300 "//y2019/control_loops/superstructure:superstructure_goal_fbs",
301 "@org_tuxfamily_eigen//:eigen",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800302 ],
303)
304
305cc_test(
306 name = "line_follow_drivetrain_test",
307 srcs = ["line_follow_drivetrain_test.cc"],
308 linkstatic = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800309 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800310 deps = [
311 ":drivetrain_config",
312 ":drivetrain_test_lib",
313 ":line_follow_drivetrain",
314 ":trajectory",
315 "//aos/testing:googletest",
316 "//aos/testing:test_shm",
317 "//third_party/matplotlib-cpp",
318 "@com_github_gflags_gflags//:gflags",
319 ],
320)
321
322cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700323 name = "ssdrivetrain",
324 srcs = [
325 "ssdrivetrain.cc",
326 ],
327 hdrs = [
328 "ssdrivetrain.h",
329 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800330 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700331 deps = [
332 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700333 ":drivetrain_goal_fbs",
334 ":drivetrain_output_fbs",
Austin Schuh95771d92021-01-23 14:42:25 -0800335 ":drivetrain_states",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700336 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700337 ":gear",
James Kuszmaul3431d622019-02-17 17:07:44 -0800338 ":localizer",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800339 ":spline_goal_fbs",
John Park33858a32018-09-28 23:05:48 -0700340 "//aos:math",
John Park33858a32018-09-28 23:05:48 -0700341 "//aos/util:log_interval",
342 "//aos/util:trapezoid_profile",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700343 "//frc971:shifter_hall_effect",
344 "//frc971/control_loops:coerce_goal",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700345 "//frc971/control_loops:control_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700346 "//frc971/control_loops:control_loops_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700347 "//frc971/control_loops:polytope",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700348 "//frc971/control_loops:state_feedback_loop",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700349 "//frc971/input:robot_state_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700350 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000351)
352
353cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700354 name = "polydrivetrain",
355 srcs = [
356 "polydrivetrain.cc",
357 ],
358 hdrs = [
359 "polydrivetrain.h",
360 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800361 copts = select({
362 "@platforms//os:none": ["-Wno-type-limits"],
363 "//conditions:default": [],
364 }),
Austin Schuhbcce26a2018-03-26 23:41:24 -0700365 deps = [
366 ":drivetrain_config",
Austin Schuh95771d92021-01-23 14:42:25 -0800367 ":drivetrain_states",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700368 ":gear",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700369 ":spline_goal_fbs",
John Park33858a32018-09-28 23:05:48 -0700370 "//aos:math",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700371 "//frc971/control_loops:coerce_goal",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700372 "//frc971/control_loops:control_loops_fbs",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700373 "//frc971/control_loops:polytope",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700374 "//frc971/control_loops:state_feedback_loop",
Philipp Schraderdada1072020-11-24 11:34:46 -0800375 ] + select({
376 "@platforms//os:linux": [
377 ":drivetrain_goal_fbs",
378 ":drivetrain_output_fbs",
379 ":drivetrain_position_fbs",
380 ":drivetrain_status_fbs",
Philipp Schraderdada1072020-11-24 11:34:46 -0800381 "//aos/util:log_interval",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700382 "//frc971/input:robot_state_fbs",
Philipp Schraderdada1072020-11-24 11:34:46 -0800383 ],
384 "@platforms//os:none": [
385 ":drivetrain_goal_float_fbs",
386 ":drivetrain_output_float_fbs",
387 ":drivetrain_position_float_fbs",
388 ":drivetrain_status_float_fbs",
389 ],
390 }),
Comran Morshed5323ecb2015-12-26 20:50:55 +0000391)
392
Austin Schuh05c5a612016-04-02 15:10:25 -0700393genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700394 name = "genrule_down_estimator",
395 outs = [
396 "down_estimator.h",
397 "down_estimator.cc",
398 ],
399 cmd = "$(location //frc971/control_loops/python:down_estimator) $(OUTS)",
Philipp Schraderdada1072020-11-24 11:34:46 -0800400 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700401 tools = [
402 "//frc971/control_loops/python:down_estimator",
403 ],
404 visibility = ["//visibility:private"],
Austin Schuh05c5a612016-04-02 15:10:25 -0700405)
406
407cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700408 name = "down_estimator",
409 srcs = [
410 "down_estimator.cc",
411 ],
412 hdrs = [
413 "down_estimator.h",
414 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800415 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700416 deps = [
417 "//frc971/control_loops:state_feedback_loop",
418 ],
Austin Schuh05c5a612016-04-02 15:10:25 -0700419)
420
Comran Morshed5323ecb2015-12-26 20:50:55 +0000421cc_library(
Austin Schuh95771d92021-01-23 14:42:25 -0800422 name = "drivetrain_states",
423 hdrs = ["drivetrain_states.h"],
424)
425
426cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700427 name = "drivetrain_lib",
428 srcs = [
429 "drivetrain.cc",
430 ],
431 hdrs = [
432 "drivetrain.h",
433 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800434 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700435 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700436 ":drivetrain_goal_fbs",
437 ":drivetrain_output_fbs",
438 ":drivetrain_position_fbs",
Austin Schuh95771d92021-01-23 14:42:25 -0800439 ":drivetrain_states",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700440 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700441 ":gear",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800442 ":improved_down_estimator",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800443 ":line_follow_drivetrain",
James Kuszmaul3431d622019-02-17 17:07:44 -0800444 ":localizer",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700445 ":localizer_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700446 ":polydrivetrain",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800447 ":spline_goal_fbs",
Alex Perry731b4602019-02-02 22:13:01 -0800448 ":splinedrivetrain",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800449 ":ssdrivetrain",
John Park33858a32018-09-28 23:05:48 -0700450 "//aos/util:log_interval",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700451 "//frc971/control_loops:control_loop",
Austin Schuh3a378462019-01-04 21:48:04 -0800452 "//frc971/control_loops:runge_kutta",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800453 "//frc971/queues:gyro_fbs",
Austin Schuhac17fba2020-03-28 15:55:33 -0700454 "//frc971/wpilib:imu_batch_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700455 "//frc971/wpilib:imu_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800456 "//frc971/zeroing:imu_zeroer",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700457 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000458)
459
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800460cc_library(
461 name = "drivetrain_test_lib",
462 testonly = True,
463 srcs = ["drivetrain_test_lib.cc"],
464 hdrs = ["drivetrain_test_lib.h"],
James Kuszmaul74d8f972020-02-11 17:13:17 -0800465 defines =
466 cpu_select({
467 "amd64": [
468 "SUPPORT_PLOT=1",
469 ],
470 "arm": [],
471 }),
Philipp Schraderdada1072020-11-24 11:34:46 -0800472 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800473 deps = [
474 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700475 ":drivetrain_goal_fbs",
476 ":drivetrain_output_fbs",
477 ":drivetrain_position_fbs",
478 ":drivetrain_status_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800479 ":trajectory",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700480 "//aos/events:event_loop",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800481 "//aos/testing:googletest",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700482 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800483 "//frc971/control_loops:state_feedback_loop",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800484 "//frc971/queues:gyro_fbs",
Austin Schuhac17fba2020-03-28 15:55:33 -0700485 "//frc971/wpilib:imu_batch_fbs",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700486 "//frc971/wpilib:imu_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800487 "//y2016:constants",
488 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
James Kuszmaul74d8f972020-02-11 17:13:17 -0800489 ] + cpu_select({
490 "amd64": [
491 "//third_party/matplotlib-cpp",
492 ],
493 "arm": [],
494 }),
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800495)
496
Comran Morshed5323ecb2015-12-26 20:50:55 +0000497cc_test(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700498 name = "drivetrain_lib_test",
499 srcs = [
500 "drivetrain_lib_test.cc",
501 ],
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700502 data = [":simulation_config"],
Alex Perry04300d62019-02-17 14:37:04 -0800503 defines =
504 cpu_select({
505 "amd64": [
506 "SUPPORT_PLOT=1",
507 ],
508 "arm": [],
509 }),
510 linkstatic = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800511 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700512 deps = [
513 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700514 ":drivetrain_goal_fbs",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700515 ":drivetrain_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700516 ":drivetrain_output_fbs",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700517 ":drivetrain_position_fbs",
518 ":drivetrain_status_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800519 ":drivetrain_test_lib",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700520 ":localizer_fbs",
521 ":trajectory_generator",
Austin Schuhb06f03b2021-02-17 22:00:37 -0800522 "//aos/events/logging:log_writer",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700523 "//aos/testing:googletest",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700524 "//frc971/control_loops:control_loop_test",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800525 "//frc971/queues:gyro_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800526 "//frc971/wpilib:imu_fbs",
Alex Perry04300d62019-02-17 14:37:04 -0800527 ] + cpu_select({
528 "amd64": [
529 "//third_party/matplotlib-cpp",
530 ],
531 "arm": [],
532 }),
Comran Morshed5323ecb2015-12-26 20:50:55 +0000533)
Brian Silverman6260c092018-01-14 15:21:36 -0800534
535genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700536 name = "genrule_haptic_wheel",
537 outs = [
538 "haptic_wheel.h",
539 "haptic_wheel.cc",
540 "integral_haptic_wheel.h",
541 "integral_haptic_wheel.cc",
542 "haptic_trigger.h",
543 "haptic_trigger.cc",
544 "integral_haptic_trigger.h",
545 "integral_haptic_trigger.cc",
546 ],
547 cmd = "$(location //frc971/control_loops/python:haptic_wheel) $(OUTS)",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700548 tools = [
549 "//frc971/control_loops/python:haptic_wheel",
550 ],
551 visibility = ["//visibility:private"],
Brian Silverman6260c092018-01-14 15:21:36 -0800552)
553
554cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700555 name = "haptic_wheel",
556 srcs = [
557 "haptic_trigger.cc",
558 "haptic_wheel.cc",
559 "integral_haptic_trigger.cc",
560 "integral_haptic_wheel.cc",
561 ],
562 hdrs = [
563 "haptic_trigger.h",
564 "haptic_wheel.h",
565 "integral_haptic_trigger.h",
566 "integral_haptic_wheel.h",
567 ],
568 deps = [
569 "//frc971/control_loops:state_feedback_loop",
570 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800571)
Austin Schuhc2b08772018-12-19 18:05:06 +1100572
573cc_library(
574 name = "spline",
575 srcs = ["spline.cc"],
576 hdrs = ["spline.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800577 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhc2b08772018-12-19 18:05:06 +1100578 deps = [
Austin Schuhf49b4e32019-01-13 17:26:58 -0800579 "//frc971/control_loops:binomial",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700580 "@org_tuxfamily_eigen//:eigen",
Austin Schuhc2b08772018-12-19 18:05:06 +1100581 ],
582)
583
Alex Perrya60da442019-01-21 19:00:27 -0500584cc_binary(
585 name = "spline.so",
586 srcs = ["libspline.cc"],
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800587 linkshared = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800588 target_compatible_with = ["@platforms//os:linux"],
Alex Perrya60da442019-01-21 19:00:27 -0500589 deps = [
590 ":distance_spline",
591 ":spline",
Alex Perry0603b542019-01-25 20:29:51 -0800592 ":trajectory",
Austin Schuhfc0caa82023-08-25 14:25:03 -0700593 "//aos/logging",
Alex Perry0603b542019-01-25 20:29:51 -0800594 "//aos/network:team_number",
James Kuszmaul8aa37cb2020-03-01 10:27:58 -0800595 "//y2020/control_loops/drivetrain:drivetrain_base",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700596 "@org_tuxfamily_eigen//:eigen",
Alex Perrya60da442019-01-21 19:00:27 -0500597 ],
Alex Perrya60da442019-01-21 19:00:27 -0500598)
599
Austin Schuhc2b08772018-12-19 18:05:06 +1100600cc_test(
601 name = "spline_test",
602 srcs = [
603 "spline_test.cc",
604 ],
James Kuszmaule32fa932021-05-11 21:38:16 -0700605 linkstatic = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800606 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhc2b08772018-12-19 18:05:06 +1100607 deps = [
608 ":spline",
609 "//aos/testing:googletest",
James Kuszmaule32fa932021-05-11 21:38:16 -0700610 "//frc971/analysis:in_process_plotter",
Austin Schuhc2b08772018-12-19 18:05:06 +1100611 "@com_github_gflags_gflags//:gflags",
612 ],
613)
Austin Schuh941b46d2018-12-19 18:06:05 +1100614
615cc_library(
616 name = "distance_spline",
617 srcs = ["distance_spline.cc"],
618 hdrs = ["distance_spline.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800619 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh941b46d2018-12-19 18:06:05 +1100620 deps = [
621 ":spline",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800622 ":trajectory_fbs",
Austin Schuhf7c65202022-11-04 21:28:20 -0700623 "//aos/containers:sized_array",
Austin Schuha6e7b212019-01-20 13:53:01 -0800624 "//aos/logging",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800625 "//frc971/control_loops:control_loops_fbs",
Austin Schuh941b46d2018-12-19 18:06:05 +1100626 "//frc971/control_loops:fixed_quadrature",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800627 "@com_github_google_glog//:glog",
Austin Schuhf7c65202022-11-04 21:28:20 -0700628 "@com_google_absl//absl/types:span",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700629 "@org_tuxfamily_eigen//:eigen",
Austin Schuh941b46d2018-12-19 18:06:05 +1100630 ],
631)
632
633cc_test(
634 name = "distance_spline_test",
635 srcs = [
636 "distance_spline_test.cc",
637 ],
Austin Schuh9b0b6432019-01-13 21:15:17 -0800638 defines =
639 cpu_select({
640 "amd64": [
641 "SUPPORT_PLOT=1",
642 ],
643 "arm": [],
644 }),
645 linkstatic = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800646 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh941b46d2018-12-19 18:06:05 +1100647 deps = [
648 ":distance_spline",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800649 "//aos:flatbuffers",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700650 "//aos/testing:googletest",
Austin Schuha6e7b212019-01-20 13:53:01 -0800651 "//aos/testing:test_shm",
Austin Schuh941b46d2018-12-19 18:06:05 +1100652 "@com_github_gflags_gflags//:gflags",
Austin Schuh9b0b6432019-01-13 21:15:17 -0800653 ] + cpu_select({
654 "amd64": [
655 "//third_party/matplotlib-cpp",
656 ],
657 "arm": [],
658 }),
Austin Schuh941b46d2018-12-19 18:06:05 +1100659)
Austin Schuhec7f06d2019-01-04 07:47:15 +1100660
661cc_library(
662 name = "trajectory",
663 srcs = ["trajectory.cc"],
664 hdrs = ["trajectory.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800665 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhec7f06d2019-01-04 07:47:15 +1100666 deps = [
667 ":distance_spline",
668 ":drivetrain_config",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800669 ":spline_goal_fbs",
670 ":trajectory_fbs",
James Kuszmaul5e8ce312021-03-27 14:59:17 -0700671 "//aos/util:math",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100672 "//frc971/control_loops:c2d",
673 "//frc971/control_loops:dlqr",
674 "//frc971/control_loops:hybrid_state_feedback_loop",
675 "//frc971/control_loops:runge_kutta",
676 "//frc971/control_loops:state_feedback_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700677 "@org_tuxfamily_eigen//:eigen",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100678 ],
679)
680
James Kuszmaul75a18c52021-03-10 22:02:07 -0800681cc_library(
682 name = "trajectory_generator",
683 srcs = ["trajectory_generator.cc"],
684 hdrs = ["trajectory_generator.h"],
685 target_compatible_with = ["@platforms//os:linux"],
686 deps = [
687 ":distance_spline",
688 ":drivetrain_config",
689 ":spline_goal_fbs",
690 ":trajectory",
691 ":trajectory_fbs",
692 ],
693)
694
Austin Schuhec7f06d2019-01-04 07:47:15 +1100695cc_binary(
696 name = "trajectory_plot",
697 srcs = [
698 "trajectory_plot.cc",
699 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800700 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhec7f06d2019-01-04 07:47:15 +1100701 deps = [
702 ":distance_spline",
703 ":trajectory",
Austin Schuhfc0caa82023-08-25 14:25:03 -0700704 "//aos/logging",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100705 "//aos/network:team_number",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100706 "//third_party/matplotlib-cpp",
Austin Schuh11043182019-03-23 22:29:12 -0700707 "//y2019/control_loops/drivetrain:drivetrain_base",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100708 "@com_github_gflags_gflags//:gflags",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700709 "@org_tuxfamily_eigen//:eigen",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100710 ],
711)
712
713cc_test(
714 name = "trajectory_test",
715 srcs = [
716 "trajectory_test.cc",
717 ],
Austin Schuh719a33e2019-01-07 15:13:34 -0800718 defines =
719 cpu_select({
720 "amd64": [
721 "SUPPORT_PLOT=1",
722 ],
723 "arm": [],
724 }),
725 linkstatic = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800726 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhec7f06d2019-01-04 07:47:15 +1100727 deps = [
James Kuszmaulea314d92019-02-18 19:45:06 -0800728 ":drivetrain_test_lib",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700729 ":trajectory",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100730 "//aos/testing:googletest",
731 "//aos/testing:test_shm",
732 "//y2016:constants",
733 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
James Kuszmaulea314d92019-02-18 19:45:06 -0800734 "//y2019/control_loops/drivetrain:drivetrain_base",
Austin Schuh719a33e2019-01-07 15:13:34 -0800735 ] + cpu_select({
736 "amd64": [
737 "//third_party/matplotlib-cpp",
738 ],
739 "arm": [],
740 }),
Austin Schuhec7f06d2019-01-04 07:47:15 +1100741)
Austin Schuhca080812017-05-10 19:31:55 -0700742
743cc_library(
744 name = "improved_down_estimator",
745 srcs = [
746 "improved_down_estimator.cc",
747 ],
748 hdrs = [
749 "improved_down_estimator.h",
750 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800751 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhca080812017-05-10 19:31:55 -0700752 deps = [
James Kuszmaul7f55f072020-03-01 10:21:26 -0800753 ":drivetrain_config",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800754 ":drivetrain_status_fbs",
755 "//aos/events:event_loop",
756 "//frc971/control_loops:control_loops_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700757 "//frc971/control_loops:quaternion_utils",
Austin Schuhca080812017-05-10 19:31:55 -0700758 "//frc971/control_loops:runge_kutta",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800759 "@//aos/time",
Austin Schuhca080812017-05-10 19:31:55 -0700760 "@com_github_google_glog//:glog",
761 "@org_tuxfamily_eigen//:eigen",
762 ],
763)
764
765cc_test(
766 name = "improved_down_estimator_test",
767 srcs = [
768 "improved_down_estimator_test.cc",
769 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800770 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhca080812017-05-10 19:31:55 -0700771 deps = [
James Kuszmaul7f55f072020-03-01 10:21:26 -0800772 ":drivetrain_test_lib",
Austin Schuhca080812017-05-10 19:31:55 -0700773 "//aos/testing:googletest",
774 "//aos/testing:random_seed",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700775 "//frc971/control_loops:quaternion_utils",
Austin Schuhca080812017-05-10 19:31:55 -0700776 "//frc971/control_loops/drivetrain:improved_down_estimator",
777 "@org_tuxfamily_eigen//:eigen",
778 ],
779)
James Kuszmaulf4ede202020-02-14 08:47:40 -0800780
781cc_library(
782 name = "camera",
783 srcs = ["camera.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800784 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf4ede202020-02-14 08:47:40 -0800785 visibility = ["//visibility:public"],
786 deps = [
787 "//aos/containers:sized_array",
788 "//frc971/control_loops:pose",
789 ],
790)
791
792cc_test(
793 name = "camera_test",
794 srcs = ["camera_test.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800795 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf4ede202020-02-14 08:47:40 -0800796 deps = [
797 ":camera",
798 "//aos/testing:googletest",
799 ],
800)
James Kuszmaulc4ae11c2020-12-26 16:26:58 -0800801
Philipp Schrader3de4dfc2023-02-15 20:18:25 -0800802ts_project(
James Kuszmaulac2b6b42021-03-07 22:38:06 -0800803 name = "down_estimator_plotter",
804 srcs = ["down_estimator_plotter.ts"],
805 target_compatible_with = ["@platforms//os:linux"],
806 deps = [
807 "//aos/network/www:aos_plotter",
808 "//aos/network/www:colors",
809 "//aos/network/www:proxy",
810 "//frc971/wpilib:imu_plot_utils",
811 ],
812)
813
Philipp Schrader3de4dfc2023-02-15 20:18:25 -0800814ts_project(
James Kuszmaul73fc1352021-04-09 22:31:25 -0700815 name = "spline_plotter",
816 srcs = ["spline_plotter.ts"],
817 target_compatible_with = ["@platforms//os:linux"],
818 deps = [
819 "//aos/network/www:aos_plotter",
820 "//aos/network/www:colors",
821 "//aos/network/www:proxy",
822 ],
823)
824
Philipp Schrader3de4dfc2023-02-15 20:18:25 -0800825ts_project(
James Kuszmaulc4ae11c2020-12-26 16:26:58 -0800826 name = "drivetrain_plotter",
827 srcs = ["drivetrain_plotter.ts"],
828 target_compatible_with = ["@platforms//os:linux"],
829 deps = [
830 "//aos/network/www:aos_plotter",
James Kuszmaul933a9742021-03-07 19:59:06 -0800831 "//aos/network/www:colors",
James Kuszmaulc4ae11c2020-12-26 16:26:58 -0800832 "//aos/network/www:proxy",
833 "//frc971/wpilib:imu_plot_utils",
834 ],
835)
milind upadhyay9bd381d2021-01-23 13:44:13 -0800836
Philipp Schrader3de4dfc2023-02-15 20:18:25 -0800837ts_project(
milind upadhyay9bd381d2021-01-23 13:44:13 -0800838 name = "robot_state_plotter",
839 srcs = ["robot_state_plotter.ts"],
840 target_compatible_with = ["@platforms//os:linux"],
841 deps = [
842 "//aos/network/www:aos_plotter",
James Kuszmaul933a9742021-03-07 19:59:06 -0800843 "//aos/network/www:colors",
milind upadhyay9bd381d2021-01-23 13:44:13 -0800844 "//aos/network/www:proxy",
845 ],
846)
James Kuszmaul68025332024-01-20 17:06:02 -0800847
848static_flatbuffer(
849 name = "drivetrain_config_fbs",
850 srcs = ["drivetrain_config.fbs"],
851 visibility = ["//visibility:public"],
852 deps = ["//frc971/control_loops:state_feedback_loop_fbs"],
853)
James Kuszmaul62c3bd82024-01-17 20:03:05 -0800854
855cc_binary(
856 name = "drivetrain_config_merge",
857 srcs = ["drivetrain_config_merge.cc"],
858 visibility = ["//visibility:public"],
859 deps = [
860 ":drivetrain_config_fbs",
861 "//aos:flatbuffer_merge",
862 "//aos:init",
863 "//aos:json_to_flatbuffer",
864 ],
865)
866
867cc_test(
868 name = "drivetrain_config_test",
869 srcs = ["drivetrain_config_test.cc"],
870 data = [":drivetrain_test_config.json"],
871 deps = [
872 ":drivetrain_config_fbs",
873 ":drivetrain_test_lib",
874 "//aos/testing:googletest",
875 "//aos/testing:path",
876 ],
877)
878
879jinja2_template(
880 name = "drivetrain_test_config.json",
881 src = "drivetrain_test_config.jinja2.json",
882 includes = [
883 "//y2016/control_loops/drivetrain:drivetrain_config",
884 ],
885 parameters = {},
886 visibility = ["//visibility:public"],
887)