blob: 316c12f74938200b8624f706c65e6c0bc7a258fb [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"],
Niko Sohmers43f71982024-01-03 19:43:59 -080045 deps = [
46 "//frc971/control_loops:control_loops_fbs",
47 "//frc971/control_loops:encoder_fault_status_fbs",
48 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -070049)
50
James Kuszmaulf01da392023-12-14 11:22:14 -080051static_flatbuffer(
James Kuszmaul75a18c52021-03-10 22:02:07 -080052 name = "trajectory_fbs",
53 srcs = ["trajectory.fbs"],
James Kuszmaulf01da392023-12-14 11:22:14 -080054 deps = ["//frc971/control_loops:control_loops_fbs"],
James Kuszmaul75a18c52021-03-10 22:02:07 -080055)
56
Austin Schuh41fad8c2021-10-23 21:25:12 -070057cc_static_flatbuffer(
58 name = "trajectory_schema",
59 function = "frc971::control_loops::drivetrain::fb::TrajectorySchema",
60 target = ":trajectory_fbs_reflection_out",
61 visibility = ["//visibility:public"],
62)
63
Alex Perry2124ae82020-03-07 14:19:06 -080064flatbuffer_ts_library(
65 name = "drivetrain_status_ts_fbs",
66 srcs = ["drivetrain_status.fbs"],
Philipp Schraderdada1072020-11-24 11:34:46 -080067 target_compatible_with = ["@platforms//os:linux"],
Niko Sohmers43f71982024-01-03 19:43:59 -080068 deps = [
69 "//frc971/control_loops:control_loops_ts_fbs",
70 "//frc971/control_loops:encoder_fault_status_ts_fbs",
71 ],
Alex Perry2124ae82020-03-07 14:19:06 -080072)
73
Niko Sohmers76f47562023-12-20 20:59:06 -080074flatbuffer_ts_library(
75 name = "drivetrain_position_ts_fbs",
76 srcs = ["drivetrain_position.fbs"],
77 target_compatible_with = ["@platforms//os:linux"],
78)
79
80flatbuffer_ts_library(
81 name = "drivetrain_can_position_ts_fbs",
82 srcs = ["drivetrain_can_position.fbs"],
83 target_compatible_with = ["@platforms//os:linux"],
Maxwell Henderson10ed5c32024-01-09 12:40:54 -080084 deps = ["//frc971/control_loops:can_talonfx_ts_fbs"],
Niko Sohmers76f47562023-12-20 20:59:06 -080085)
86
Alex Perrycb7da4b2019-08-28 19:35:56 -070087genrule(
88 name = "drivetrain_goal_float_fbs_generated",
89 srcs = ["drivetrain_goal.fbs"],
90 outs = ["drivetrain_goal_float.fbs"],
91 cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
Alex Perrycb7da4b2019-08-28 19:35:56 -070092)
93
94genrule(
95 name = "drivetrain_position_float_fbs_generated",
96 srcs = ["drivetrain_position.fbs"],
97 outs = ["drivetrain_position_float.fbs"],
98 cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
Alex Perrycb7da4b2019-08-28 19:35:56 -070099)
100
101genrule(
102 name = "drivetrain_output_float_fbs_generated",
103 srcs = ["drivetrain_output.fbs"],
104 outs = ["drivetrain_output_float.fbs"],
105 cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700106)
107
108genrule(
109 name = "drivetrain_status_float_fbs_generated",
110 srcs = ["drivetrain_status.fbs"],
111 outs = ["drivetrain_status_float.fbs"],
112 cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700113)
114
James Kuszmaulf01da392023-12-14 11:22:14 -0800115static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700116 name = "drivetrain_goal_float_fbs",
117 srcs = ["drivetrain_goal_float.fbs"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800118 deps = [
119 ":spline_goal_fbs",
120 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800121 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700122)
123
James Kuszmaulf01da392023-12-14 11:22:14 -0800124static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700125 name = "drivetrain_output_float_fbs",
126 srcs = ["drivetrain_output_float.fbs"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700127)
128
James Kuszmaulf01da392023-12-14 11:22:14 -0800129static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700130 name = "drivetrain_position_float_fbs",
131 srcs = ["drivetrain_position_float.fbs"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700132)
133
James Kuszmaulf01da392023-12-14 11:22:14 -0800134static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700135 name = "drivetrain_status_float_fbs",
136 srcs = ["drivetrain_status_float.fbs"],
Niko Sohmers43f71982024-01-03 19:43:59 -0800137 deps = [
138 "//frc971/control_loops:control_loops_fbs",
139 "//frc971/control_loops:encoder_fault_status_fbs",
140 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700141)
142
143aos_config(
James Kuszmaul74d8f972020-02-11 17:13:17 -0800144 name = "simulation_channels",
145 src = "drivetrain_simulation_channels.json",
146 flatbuffers = [
147 ":drivetrain_status_fbs",
Niko Sohmers43f71982024-01-03 19:43:59 -0800148 "//frc971/control_loops:encoder_fault_status_fbs",
James Kuszmaul74d8f972020-02-11 17:13:17 -0800149 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800150 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul74d8f972020-02-11 17:13:17 -0800151 visibility = ["//visibility:public"],
152)
153
154aos_config(
155 name = "simulation_config",
156 src = "drivetrain_simulation_config.json",
Philipp Schraderdada1072020-11-24 11:34:46 -0800157 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul74d8f972020-02-11 17:13:17 -0800158 visibility = ["//visibility:public"],
159 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800160 ":aos_config",
James Kuszmaul74d8f972020-02-11 17:13:17 -0800161 ":simulation_channels",
162 ],
163)
164
165aos_config(
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800166 name = "aos_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700167 src = "drivetrain_config.json",
168 flatbuffers = [
169 ":drivetrain_goal_fbs",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800170 ":trajectory_fbs",
171 ":spline_goal_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700172 ":drivetrain_output_fbs",
173 ":drivetrain_status_fbs",
174 ":drivetrain_position_fbs",
Niko Sohmers43f71982024-01-03 19:43:59 -0800175 ":drivetrain_can_position_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700176 ":localizer_fbs",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800177 "//frc971/queues:gyro_fbs",
178 "//frc971/queues:gyro_uid_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700179 "//frc971/wpilib:imu_fbs",
Austin Schuhac17fba2020-03-28 15:55:33 -0700180 "//frc971/wpilib:imu_batch_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700181 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800182 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700183 visibility = ["//visibility:public"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700184 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800185 "//frc971/input:aos_config",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700186 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000187)
188
189cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700190 name = "drivetrain_config",
191 hdrs = [
192 "drivetrain_config.h",
193 ],
194 deps = [
195 "//frc971:shifter_hall_effect",
196 "//frc971/control_loops:state_feedback_loop",
James Kuszmaul68025332024-01-20 17:06:02 -0800197 "//frc971/control_loops:state_feedback_loop_converters",
198 ":drivetrain_config_fbs",
Philipp Schraderdada1072020-11-24 11:34:46 -0800199 ] + select({
James Kuszmaul68025332024-01-20 17:06:02 -0800200 "@platforms//os:linux": [
201 "//frc971/control_loops:hybrid_state_feedback_loop",
202 "//frc971/control_loops:hybrid_state_feedback_loop_converters",
203 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800204 "//conditions:default": [],
205 }),
Comran Morshed5323ecb2015-12-26 20:50:55 +0000206)
207
208cc_library(
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800209 name = "hybrid_ekf",
210 hdrs = ["hybrid_ekf.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800211 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800212 deps = [
213 ":drivetrain_config",
James Kuszmaul3c5b4d32020-02-11 17:22:14 -0800214 "//aos:math",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800215 "//aos/containers:priority_queue",
James Kuszmaulfedc4612019-03-10 11:24:51 -0700216 "//aos/util:math",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800217 "//frc971/control_loops:c2d",
218 "//frc971/control_loops:runge_kutta",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700219 "@org_tuxfamily_eigen//:eigen",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800220 ],
221)
222
223cc_test(
224 name = "hybrid_ekf_test",
225 srcs = ["hybrid_ekf_test.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800226 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800227 deps = [
228 ":drivetrain_test_lib",
229 ":hybrid_ekf",
230 ":trajectory",
231 "//aos/testing:googletest",
232 "//aos/testing:random_seed",
233 "//aos/testing:test_shm",
234 ],
235)
236
James Kuszmaulf01da392023-12-14 11:22:14 -0800237static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700238 name = "localizer_fbs",
239 srcs = ["localizer.fbs"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800240 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulef428a02019-03-02 22:19:41 -0800241)
242
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800243cc_library(
James Kuszmaul3431d622019-02-17 17:07:44 -0800244 name = "localizer",
245 hdrs = ["localizer.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800246 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul3431d622019-02-17 17:07:44 -0800247 deps = [
248 ":drivetrain_config",
James Kuszmaul3c5b4d32020-02-11 17:22:14 -0800249 ":drivetrain_status_fbs",
James Kuszmaul3431d622019-02-17 17:07:44 -0800250 ":hybrid_ekf",
James Kuszmaul5398fae2020-02-17 16:44:03 -0800251 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul5bc6fc92019-03-01 21:50:06 -0800252 "//frc971/control_loops:pose",
James Kuszmaul3431d622019-02-17 17:07:44 -0800253 ],
254)
255
256cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700257 name = "gear",
258 hdrs = [
259 "gear.h",
260 ],
Austin Schuh093535c2016-03-05 23:21:00 -0800261)
262
263cc_library(
Alex Perry731b4602019-02-02 22:13:01 -0800264 name = "splinedrivetrain",
265 srcs = [
266 "splinedrivetrain.cc",
267 ],
268 hdrs = [
269 "splinedrivetrain.h",
270 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800271 target_compatible_with = ["@platforms//os:linux"],
Alex Perry731b4602019-02-02 22:13:01 -0800272 deps = [
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800273 ":distance_spline",
Alex Perry731b4602019-02-02 22:13:01 -0800274 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700275 ":drivetrain_goal_fbs",
276 ":drivetrain_output_fbs",
277 ":drivetrain_status_fbs",
Alex Perry731b4602019-02-02 22:13:01 -0800278 ":spline",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800279 ":spline_goal_fbs",
Alex Perry731b4602019-02-02 22:13:01 -0800280 ":trajectory",
Austin Schuh3d9ccd72020-08-01 15:42:40 -0700281 "//aos:condition",
Alex Perry1ec34522019-02-17 22:44:10 -0800282 "//aos:init",
James Kuszmaulc73bb222019-04-07 12:15:35 -0700283 "//aos/util:math",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700284 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800285 ],
Alex Perry731b4602019-02-02 22:13:01 -0800286)
287
288cc_library(
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800289 name = "line_follow_drivetrain",
290 srcs = [
291 "line_follow_drivetrain.cc",
292 ],
293 hdrs = [
294 "line_follow_drivetrain.h",
295 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800296 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800297 deps = [
298 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700299 ":drivetrain_goal_fbs",
300 ":drivetrain_output_fbs",
301 ":drivetrain_status_fbs",
James Kuszmaul5bc6fc92019-03-01 21:50:06 -0800302 ":localizer",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800303 ":spline_goal_fbs",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800304 "//aos:math",
305 "//aos/util:math",
306 "//frc971/control_loops:c2d",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700307 "//frc971/control_loops:control_loops_fbs",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800308 "//frc971/control_loops:dlqr",
309 "//frc971/control_loops:pose",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700310 "//frc971/control_loops:profiled_subsystem_fbs",
311 "//y2019/control_loops/superstructure:superstructure_goal_fbs",
312 "@org_tuxfamily_eigen//:eigen",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800313 ],
314)
315
316cc_test(
317 name = "line_follow_drivetrain_test",
318 srcs = ["line_follow_drivetrain_test.cc"],
319 linkstatic = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800320 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800321 deps = [
322 ":drivetrain_config",
323 ":drivetrain_test_lib",
324 ":line_follow_drivetrain",
325 ":trajectory",
326 "//aos/testing:googletest",
327 "//aos/testing:test_shm",
328 "//third_party/matplotlib-cpp",
329 "@com_github_gflags_gflags//:gflags",
330 ],
331)
332
333cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700334 name = "ssdrivetrain",
335 srcs = [
336 "ssdrivetrain.cc",
337 ],
338 hdrs = [
339 "ssdrivetrain.h",
340 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800341 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700342 deps = [
343 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700344 ":drivetrain_goal_fbs",
345 ":drivetrain_output_fbs",
Austin Schuh95771d92021-01-23 14:42:25 -0800346 ":drivetrain_states",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700347 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700348 ":gear",
James Kuszmaul3431d622019-02-17 17:07:44 -0800349 ":localizer",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800350 ":spline_goal_fbs",
John Park33858a32018-09-28 23:05:48 -0700351 "//aos:math",
John Park33858a32018-09-28 23:05:48 -0700352 "//aos/util:log_interval",
353 "//aos/util:trapezoid_profile",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700354 "//frc971:shifter_hall_effect",
355 "//frc971/control_loops:coerce_goal",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700356 "//frc971/control_loops:control_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700357 "//frc971/control_loops:control_loops_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700358 "//frc971/control_loops:polytope",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700359 "//frc971/control_loops:state_feedback_loop",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700360 "//frc971/input:robot_state_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700361 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000362)
363
364cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700365 name = "polydrivetrain",
366 srcs = [
367 "polydrivetrain.cc",
368 ],
369 hdrs = [
370 "polydrivetrain.h",
371 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800372 copts = select({
373 "@platforms//os:none": ["-Wno-type-limits"],
374 "//conditions:default": [],
375 }),
Austin Schuhbcce26a2018-03-26 23:41:24 -0700376 deps = [
377 ":drivetrain_config",
Austin Schuh95771d92021-01-23 14:42:25 -0800378 ":drivetrain_states",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700379 ":gear",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700380 ":spline_goal_fbs",
John Park33858a32018-09-28 23:05:48 -0700381 "//aos:math",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700382 "//frc971/control_loops:coerce_goal",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700383 "//frc971/control_loops:control_loops_fbs",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700384 "//frc971/control_loops:polytope",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700385 "//frc971/control_loops:state_feedback_loop",
Philipp Schraderdada1072020-11-24 11:34:46 -0800386 ] + select({
387 "@platforms//os:linux": [
388 ":drivetrain_goal_fbs",
389 ":drivetrain_output_fbs",
390 ":drivetrain_position_fbs",
391 ":drivetrain_status_fbs",
Philipp Schraderdada1072020-11-24 11:34:46 -0800392 "//aos/util:log_interval",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700393 "//frc971/input:robot_state_fbs",
Philipp Schraderdada1072020-11-24 11:34:46 -0800394 ],
395 "@platforms//os:none": [
396 ":drivetrain_goal_float_fbs",
397 ":drivetrain_output_float_fbs",
398 ":drivetrain_position_float_fbs",
399 ":drivetrain_status_float_fbs",
400 ],
401 }),
Comran Morshed5323ecb2015-12-26 20:50:55 +0000402)
403
Austin Schuh05c5a612016-04-02 15:10:25 -0700404genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700405 name = "genrule_down_estimator",
406 outs = [
407 "down_estimator.h",
408 "down_estimator.cc",
409 ],
410 cmd = "$(location //frc971/control_loops/python:down_estimator) $(OUTS)",
Philipp Schraderdada1072020-11-24 11:34:46 -0800411 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700412 tools = [
413 "//frc971/control_loops/python:down_estimator",
414 ],
415 visibility = ["//visibility:private"],
Austin Schuh05c5a612016-04-02 15:10:25 -0700416)
417
418cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700419 name = "down_estimator",
420 srcs = [
421 "down_estimator.cc",
422 ],
423 hdrs = [
424 "down_estimator.h",
425 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800426 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700427 deps = [
428 "//frc971/control_loops:state_feedback_loop",
429 ],
Austin Schuh05c5a612016-04-02 15:10:25 -0700430)
431
Comran Morshed5323ecb2015-12-26 20:50:55 +0000432cc_library(
Austin Schuh95771d92021-01-23 14:42:25 -0800433 name = "drivetrain_states",
434 hdrs = ["drivetrain_states.h"],
435)
436
437cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700438 name = "drivetrain_lib",
439 srcs = [
440 "drivetrain.cc",
441 ],
442 hdrs = [
443 "drivetrain.h",
444 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800445 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700446 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700447 ":drivetrain_goal_fbs",
448 ":drivetrain_output_fbs",
449 ":drivetrain_position_fbs",
Austin Schuh95771d92021-01-23 14:42:25 -0800450 ":drivetrain_states",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700451 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700452 ":gear",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800453 ":improved_down_estimator",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800454 ":line_follow_drivetrain",
James Kuszmaul3431d622019-02-17 17:07:44 -0800455 ":localizer",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700456 ":localizer_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700457 ":polydrivetrain",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800458 ":spline_goal_fbs",
Alex Perry731b4602019-02-02 22:13:01 -0800459 ":splinedrivetrain",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800460 ":ssdrivetrain",
John Park33858a32018-09-28 23:05:48 -0700461 "//aos/util:log_interval",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700462 "//frc971/control_loops:control_loop",
Austin Schuh3a378462019-01-04 21:48:04 -0800463 "//frc971/control_loops:runge_kutta",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800464 "//frc971/queues:gyro_fbs",
Austin Schuhac17fba2020-03-28 15:55:33 -0700465 "//frc971/wpilib:imu_batch_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700466 "//frc971/wpilib:imu_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800467 "//frc971/zeroing:imu_zeroer",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700468 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000469)
470
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800471cc_library(
472 name = "drivetrain_test_lib",
473 testonly = True,
474 srcs = ["drivetrain_test_lib.cc"],
475 hdrs = ["drivetrain_test_lib.h"],
James Kuszmaul74d8f972020-02-11 17:13:17 -0800476 defines =
477 cpu_select({
478 "amd64": [
479 "SUPPORT_PLOT=1",
480 ],
481 "arm": [],
482 }),
Philipp Schraderdada1072020-11-24 11:34:46 -0800483 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800484 deps = [
485 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700486 ":drivetrain_goal_fbs",
487 ":drivetrain_output_fbs",
488 ":drivetrain_position_fbs",
489 ":drivetrain_status_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800490 ":trajectory",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700491 "//aos/events:event_loop",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800492 "//aos/testing:googletest",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700493 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800494 "//frc971/control_loops:state_feedback_loop",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800495 "//frc971/queues:gyro_fbs",
Austin Schuhac17fba2020-03-28 15:55:33 -0700496 "//frc971/wpilib:imu_batch_fbs",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700497 "//frc971/wpilib:imu_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800498 "//y2016:constants",
499 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
James Kuszmaul74d8f972020-02-11 17:13:17 -0800500 ] + cpu_select({
501 "amd64": [
502 "//third_party/matplotlib-cpp",
503 ],
504 "arm": [],
505 }),
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800506)
507
Comran Morshed5323ecb2015-12-26 20:50:55 +0000508cc_test(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700509 name = "drivetrain_lib_test",
510 srcs = [
511 "drivetrain_lib_test.cc",
512 ],
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700513 data = [":simulation_config"],
Alex Perry04300d62019-02-17 14:37:04 -0800514 defines =
515 cpu_select({
516 "amd64": [
517 "SUPPORT_PLOT=1",
518 ],
519 "arm": [],
520 }),
521 linkstatic = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800522 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700523 deps = [
524 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700525 ":drivetrain_goal_fbs",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700526 ":drivetrain_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700527 ":drivetrain_output_fbs",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700528 ":drivetrain_position_fbs",
529 ":drivetrain_status_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800530 ":drivetrain_test_lib",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700531 ":localizer_fbs",
532 ":trajectory_generator",
Austin Schuhb06f03b2021-02-17 22:00:37 -0800533 "//aos/events/logging:log_writer",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700534 "//aos/testing:googletest",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700535 "//frc971/control_loops:control_loop_test",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800536 "//frc971/queues:gyro_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800537 "//frc971/wpilib:imu_fbs",
Alex Perry04300d62019-02-17 14:37:04 -0800538 ] + cpu_select({
539 "amd64": [
540 "//third_party/matplotlib-cpp",
541 ],
542 "arm": [],
543 }),
Comran Morshed5323ecb2015-12-26 20:50:55 +0000544)
Brian Silverman6260c092018-01-14 15:21:36 -0800545
546genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700547 name = "genrule_haptic_wheel",
548 outs = [
549 "haptic_wheel.h",
550 "haptic_wheel.cc",
551 "integral_haptic_wheel.h",
552 "integral_haptic_wheel.cc",
553 "haptic_trigger.h",
554 "haptic_trigger.cc",
555 "integral_haptic_trigger.h",
556 "integral_haptic_trigger.cc",
557 ],
558 cmd = "$(location //frc971/control_loops/python:haptic_wheel) $(OUTS)",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700559 tools = [
560 "//frc971/control_loops/python:haptic_wheel",
561 ],
562 visibility = ["//visibility:private"],
Brian Silverman6260c092018-01-14 15:21:36 -0800563)
564
565cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700566 name = "haptic_wheel",
567 srcs = [
568 "haptic_trigger.cc",
569 "haptic_wheel.cc",
570 "integral_haptic_trigger.cc",
571 "integral_haptic_wheel.cc",
572 ],
573 hdrs = [
574 "haptic_trigger.h",
575 "haptic_wheel.h",
576 "integral_haptic_trigger.h",
577 "integral_haptic_wheel.h",
578 ],
579 deps = [
580 "//frc971/control_loops:state_feedback_loop",
581 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800582)
Austin Schuhc2b08772018-12-19 18:05:06 +1100583
584cc_library(
585 name = "spline",
586 srcs = ["spline.cc"],
587 hdrs = ["spline.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800588 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhc2b08772018-12-19 18:05:06 +1100589 deps = [
Austin Schuhf49b4e32019-01-13 17:26:58 -0800590 "//frc971/control_loops:binomial",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700591 "@org_tuxfamily_eigen//:eigen",
Austin Schuhc2b08772018-12-19 18:05:06 +1100592 ],
593)
594
Alex Perrya60da442019-01-21 19:00:27 -0500595cc_binary(
596 name = "spline.so",
597 srcs = ["libspline.cc"],
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800598 linkshared = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800599 target_compatible_with = ["@platforms//os:linux"],
Alex Perrya60da442019-01-21 19:00:27 -0500600 deps = [
601 ":distance_spline",
602 ":spline",
Alex Perry0603b542019-01-25 20:29:51 -0800603 ":trajectory",
Austin Schuhfc0caa82023-08-25 14:25:03 -0700604 "//aos/logging",
Alex Perry0603b542019-01-25 20:29:51 -0800605 "//aos/network:team_number",
James Kuszmaul8aa37cb2020-03-01 10:27:58 -0800606 "//y2020/control_loops/drivetrain:drivetrain_base",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700607 "@org_tuxfamily_eigen//:eigen",
Alex Perrya60da442019-01-21 19:00:27 -0500608 ],
Alex Perrya60da442019-01-21 19:00:27 -0500609)
610
Austin Schuhc2b08772018-12-19 18:05:06 +1100611cc_test(
612 name = "spline_test",
613 srcs = [
614 "spline_test.cc",
615 ],
James Kuszmaule32fa932021-05-11 21:38:16 -0700616 linkstatic = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800617 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhc2b08772018-12-19 18:05:06 +1100618 deps = [
619 ":spline",
620 "//aos/testing:googletest",
James Kuszmaule32fa932021-05-11 21:38:16 -0700621 "//frc971/analysis:in_process_plotter",
Austin Schuhc2b08772018-12-19 18:05:06 +1100622 "@com_github_gflags_gflags//:gflags",
623 ],
624)
Austin Schuh941b46d2018-12-19 18:06:05 +1100625
626cc_library(
627 name = "distance_spline",
628 srcs = ["distance_spline.cc"],
629 hdrs = ["distance_spline.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800630 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh941b46d2018-12-19 18:06:05 +1100631 deps = [
632 ":spline",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800633 ":trajectory_fbs",
Austin Schuhf7c65202022-11-04 21:28:20 -0700634 "//aos/containers:sized_array",
Austin Schuha6e7b212019-01-20 13:53:01 -0800635 "//aos/logging",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800636 "//frc971/control_loops:control_loops_fbs",
Austin Schuh941b46d2018-12-19 18:06:05 +1100637 "//frc971/control_loops:fixed_quadrature",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800638 "@com_github_google_glog//:glog",
Austin Schuhf7c65202022-11-04 21:28:20 -0700639 "@com_google_absl//absl/types:span",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700640 "@org_tuxfamily_eigen//:eigen",
Austin Schuh941b46d2018-12-19 18:06:05 +1100641 ],
642)
643
644cc_test(
645 name = "distance_spline_test",
646 srcs = [
647 "distance_spline_test.cc",
648 ],
Austin Schuh9b0b6432019-01-13 21:15:17 -0800649 defines =
650 cpu_select({
651 "amd64": [
652 "SUPPORT_PLOT=1",
653 ],
654 "arm": [],
655 }),
656 linkstatic = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800657 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh941b46d2018-12-19 18:06:05 +1100658 deps = [
659 ":distance_spline",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800660 "//aos:flatbuffers",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700661 "//aos/testing:googletest",
Austin Schuha6e7b212019-01-20 13:53:01 -0800662 "//aos/testing:test_shm",
Austin Schuh941b46d2018-12-19 18:06:05 +1100663 "@com_github_gflags_gflags//:gflags",
Austin Schuh9b0b6432019-01-13 21:15:17 -0800664 ] + cpu_select({
665 "amd64": [
666 "//third_party/matplotlib-cpp",
667 ],
668 "arm": [],
669 }),
Austin Schuh941b46d2018-12-19 18:06:05 +1100670)
Austin Schuhec7f06d2019-01-04 07:47:15 +1100671
672cc_library(
673 name = "trajectory",
674 srcs = ["trajectory.cc"],
675 hdrs = ["trajectory.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800676 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhec7f06d2019-01-04 07:47:15 +1100677 deps = [
678 ":distance_spline",
679 ":drivetrain_config",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800680 ":spline_goal_fbs",
681 ":trajectory_fbs",
James Kuszmaul5e8ce312021-03-27 14:59:17 -0700682 "//aos/util:math",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100683 "//frc971/control_loops:c2d",
684 "//frc971/control_loops:dlqr",
685 "//frc971/control_loops:hybrid_state_feedback_loop",
686 "//frc971/control_loops:runge_kutta",
687 "//frc971/control_loops:state_feedback_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700688 "@org_tuxfamily_eigen//:eigen",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100689 ],
690)
691
James Kuszmaul75a18c52021-03-10 22:02:07 -0800692cc_library(
693 name = "trajectory_generator",
694 srcs = ["trajectory_generator.cc"],
695 hdrs = ["trajectory_generator.h"],
696 target_compatible_with = ["@platforms//os:linux"],
697 deps = [
698 ":distance_spline",
699 ":drivetrain_config",
700 ":spline_goal_fbs",
701 ":trajectory",
702 ":trajectory_fbs",
703 ],
704)
705
Austin Schuhec7f06d2019-01-04 07:47:15 +1100706cc_binary(
707 name = "trajectory_plot",
708 srcs = [
709 "trajectory_plot.cc",
710 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800711 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhec7f06d2019-01-04 07:47:15 +1100712 deps = [
713 ":distance_spline",
714 ":trajectory",
Austin Schuhfc0caa82023-08-25 14:25:03 -0700715 "//aos/logging",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100716 "//aos/network:team_number",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100717 "//third_party/matplotlib-cpp",
Austin Schuh11043182019-03-23 22:29:12 -0700718 "//y2019/control_loops/drivetrain:drivetrain_base",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100719 "@com_github_gflags_gflags//:gflags",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700720 "@org_tuxfamily_eigen//:eigen",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100721 ],
722)
723
724cc_test(
725 name = "trajectory_test",
726 srcs = [
727 "trajectory_test.cc",
728 ],
Austin Schuh719a33e2019-01-07 15:13:34 -0800729 defines =
730 cpu_select({
731 "amd64": [
732 "SUPPORT_PLOT=1",
733 ],
734 "arm": [],
735 }),
736 linkstatic = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800737 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhec7f06d2019-01-04 07:47:15 +1100738 deps = [
James Kuszmaulea314d92019-02-18 19:45:06 -0800739 ":drivetrain_test_lib",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700740 ":trajectory",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100741 "//aos/testing:googletest",
742 "//aos/testing:test_shm",
743 "//y2016:constants",
744 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
James Kuszmaulea314d92019-02-18 19:45:06 -0800745 "//y2019/control_loops/drivetrain:drivetrain_base",
Austin Schuh719a33e2019-01-07 15:13:34 -0800746 ] + cpu_select({
747 "amd64": [
748 "//third_party/matplotlib-cpp",
749 ],
750 "arm": [],
751 }),
Austin Schuhec7f06d2019-01-04 07:47:15 +1100752)
Austin Schuhca080812017-05-10 19:31:55 -0700753
754cc_library(
755 name = "improved_down_estimator",
756 srcs = [
757 "improved_down_estimator.cc",
758 ],
759 hdrs = [
760 "improved_down_estimator.h",
761 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800762 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhca080812017-05-10 19:31:55 -0700763 deps = [
James Kuszmaul7f55f072020-03-01 10:21:26 -0800764 ":drivetrain_config",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800765 ":drivetrain_status_fbs",
766 "//aos/events:event_loop",
767 "//frc971/control_loops:control_loops_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700768 "//frc971/control_loops:quaternion_utils",
Austin Schuhca080812017-05-10 19:31:55 -0700769 "//frc971/control_loops:runge_kutta",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800770 "@//aos/time",
Austin Schuhca080812017-05-10 19:31:55 -0700771 "@com_github_google_glog//:glog",
772 "@org_tuxfamily_eigen//:eigen",
773 ],
774)
775
776cc_test(
777 name = "improved_down_estimator_test",
778 srcs = [
779 "improved_down_estimator_test.cc",
780 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800781 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhca080812017-05-10 19:31:55 -0700782 deps = [
James Kuszmaul7f55f072020-03-01 10:21:26 -0800783 ":drivetrain_test_lib",
Austin Schuhca080812017-05-10 19:31:55 -0700784 "//aos/testing:googletest",
785 "//aos/testing:random_seed",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700786 "//frc971/control_loops:quaternion_utils",
Austin Schuhca080812017-05-10 19:31:55 -0700787 "//frc971/control_loops/drivetrain:improved_down_estimator",
788 "@org_tuxfamily_eigen//:eigen",
789 ],
790)
James Kuszmaulf4ede202020-02-14 08:47:40 -0800791
792cc_library(
793 name = "camera",
794 srcs = ["camera.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800795 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf4ede202020-02-14 08:47:40 -0800796 visibility = ["//visibility:public"],
797 deps = [
798 "//aos/containers:sized_array",
799 "//frc971/control_loops:pose",
800 ],
801)
802
Niko Sohmers43f71982024-01-03 19:43:59 -0800803cc_library(
804 name = "drivetrain_encoder_fault_detector",
805 srcs = ["drivetrain_encoder_fault_detector.cc"],
806 hdrs = ["drivetrain_encoder_fault_detector.h"],
807 target_compatible_with = ["@platforms//os:linux"],
808 deps = [
809 "//aos/events:event_loop",
810 "//frc971/control_loops:encoder_fault_detector",
811 "//frc971/control_loops:encoder_fault_status_fbs",
812 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
813 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
814 "//frc971/control_loops/drivetrain:drivetrain_status_fbs",
815 ],
816)
817
818cc_test(
819 name = "drivetrain_encoder_fault_detector_test",
820 srcs = ["drivetrain_encoder_fault_detector_test.cc"],
821 data = [":simulation_config"],
822 target_compatible_with = ["@platforms//os:linux"],
823 deps = [
824 ":drivetrain_encoder_fault_detector",
825 "//aos:json_to_flatbuffer",
826 "//aos/events:simulated_event_loop",
827 "//aos/testing:googletest",
828 ],
829)
830
James Kuszmaulf4ede202020-02-14 08:47:40 -0800831cc_test(
832 name = "camera_test",
833 srcs = ["camera_test.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800834 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf4ede202020-02-14 08:47:40 -0800835 deps = [
836 ":camera",
837 "//aos/testing:googletest",
838 ],
839)
James Kuszmaulc4ae11c2020-12-26 16:26:58 -0800840
Philipp Schrader3de4dfc2023-02-15 20:18:25 -0800841ts_project(
James Kuszmaulac2b6b42021-03-07 22:38:06 -0800842 name = "down_estimator_plotter",
843 srcs = ["down_estimator_plotter.ts"],
844 target_compatible_with = ["@platforms//os:linux"],
845 deps = [
846 "//aos/network/www:aos_plotter",
847 "//aos/network/www:colors",
848 "//aos/network/www:proxy",
849 "//frc971/wpilib:imu_plot_utils",
850 ],
851)
852
Philipp Schrader3de4dfc2023-02-15 20:18:25 -0800853ts_project(
James Kuszmaul73fc1352021-04-09 22:31:25 -0700854 name = "spline_plotter",
855 srcs = ["spline_plotter.ts"],
856 target_compatible_with = ["@platforms//os:linux"],
857 deps = [
858 "//aos/network/www:aos_plotter",
859 "//aos/network/www:colors",
860 "//aos/network/www:proxy",
861 ],
862)
863
Philipp Schrader3de4dfc2023-02-15 20:18:25 -0800864ts_project(
James Kuszmaulc4ae11c2020-12-26 16:26:58 -0800865 name = "drivetrain_plotter",
866 srcs = ["drivetrain_plotter.ts"],
867 target_compatible_with = ["@platforms//os:linux"],
868 deps = [
869 "//aos/network/www:aos_plotter",
James Kuszmaul933a9742021-03-07 19:59:06 -0800870 "//aos/network/www:colors",
James Kuszmaulc4ae11c2020-12-26 16:26:58 -0800871 "//aos/network/www:proxy",
872 "//frc971/wpilib:imu_plot_utils",
873 ],
874)
milind upadhyay9bd381d2021-01-23 13:44:13 -0800875
Philipp Schrader3de4dfc2023-02-15 20:18:25 -0800876ts_project(
milind upadhyay9bd381d2021-01-23 13:44:13 -0800877 name = "robot_state_plotter",
878 srcs = ["robot_state_plotter.ts"],
879 target_compatible_with = ["@platforms//os:linux"],
880 deps = [
881 "//aos/network/www:aos_plotter",
James Kuszmaul933a9742021-03-07 19:59:06 -0800882 "//aos/network/www:colors",
milind upadhyay9bd381d2021-01-23 13:44:13 -0800883 "//aos/network/www:proxy",
884 ],
885)
James Kuszmaul68025332024-01-20 17:06:02 -0800886
887static_flatbuffer(
888 name = "drivetrain_config_fbs",
889 srcs = ["drivetrain_config.fbs"],
890 visibility = ["//visibility:public"],
891 deps = ["//frc971/control_loops:state_feedback_loop_fbs"],
892)
James Kuszmaul62c3bd82024-01-17 20:03:05 -0800893
894cc_binary(
895 name = "drivetrain_config_merge",
896 srcs = ["drivetrain_config_merge.cc"],
897 visibility = ["//visibility:public"],
898 deps = [
899 ":drivetrain_config_fbs",
900 "//aos:flatbuffer_merge",
901 "//aos:init",
902 "//aos:json_to_flatbuffer",
903 ],
904)
905
906cc_test(
907 name = "drivetrain_config_test",
908 srcs = ["drivetrain_config_test.cc"],
909 data = [":drivetrain_test_config.json"],
910 deps = [
911 ":drivetrain_config_fbs",
912 ":drivetrain_test_lib",
913 "//aos/testing:googletest",
914 "//aos/testing:path",
915 ],
916)
917
918jinja2_template(
919 name = "drivetrain_test_config.json",
920 src = "drivetrain_test_config.jinja2.json",
921 includes = [
922 "//y2016/control_loops/drivetrain:drivetrain_config",
923 ],
924 parameters = {},
925 visibility = ["//visibility:public"],
926)