blob: 9d439b6457e0965b505d70d279756c2881857ad1 [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(
James Kuszmaulf6aa0382024-03-01 19:46:05 -080033 name = "rio_localizer_inputs_fbs",
34 srcs = ["rio_localizer_inputs.fbs"],
35)
36
37static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -070038 name = "drivetrain_output_fbs",
39 srcs = ["drivetrain_output.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_position_fbs",
44 srcs = ["drivetrain_position.fbs"],
Alex Perrycb7da4b2019-08-28 19:35:56 -070045)
46
James Kuszmaulf01da392023-12-14 11:22:14 -080047static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -070048 name = "drivetrain_status_fbs",
49 srcs = ["drivetrain_status.fbs"],
Niko Sohmers43f71982024-01-03 19:43:59 -080050 deps = [
51 "//frc971/control_loops:control_loops_fbs",
52 "//frc971/control_loops:encoder_fault_status_fbs",
53 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -070054)
55
James Kuszmaulf01da392023-12-14 11:22:14 -080056static_flatbuffer(
James Kuszmaul75a18c52021-03-10 22:02:07 -080057 name = "trajectory_fbs",
58 srcs = ["trajectory.fbs"],
James Kuszmaulf01da392023-12-14 11:22:14 -080059 deps = ["//frc971/control_loops:control_loops_fbs"],
James Kuszmaul75a18c52021-03-10 22:02:07 -080060)
61
Austin Schuh41fad8c2021-10-23 21:25:12 -070062cc_static_flatbuffer(
63 name = "trajectory_schema",
64 function = "frc971::control_loops::drivetrain::fb::TrajectorySchema",
65 target = ":trajectory_fbs_reflection_out",
66 visibility = ["//visibility:public"],
67)
68
Alex Perry2124ae82020-03-07 14:19:06 -080069flatbuffer_ts_library(
70 name = "drivetrain_status_ts_fbs",
71 srcs = ["drivetrain_status.fbs"],
Philipp Schraderdada1072020-11-24 11:34:46 -080072 target_compatible_with = ["@platforms//os:linux"],
Niko Sohmers43f71982024-01-03 19:43:59 -080073 deps = [
74 "//frc971/control_loops:control_loops_ts_fbs",
75 "//frc971/control_loops:encoder_fault_status_ts_fbs",
76 ],
Alex Perry2124ae82020-03-07 14:19:06 -080077)
78
Niko Sohmers76f47562023-12-20 20:59:06 -080079flatbuffer_ts_library(
80 name = "drivetrain_position_ts_fbs",
81 srcs = ["drivetrain_position.fbs"],
82 target_compatible_with = ["@platforms//os:linux"],
83)
84
85flatbuffer_ts_library(
86 name = "drivetrain_can_position_ts_fbs",
87 srcs = ["drivetrain_can_position.fbs"],
88 target_compatible_with = ["@platforms//os:linux"],
Maxwell Henderson10ed5c32024-01-09 12:40:54 -080089 deps = ["//frc971/control_loops:can_talonfx_ts_fbs"],
Niko Sohmers76f47562023-12-20 20:59:06 -080090)
91
Alex Perrycb7da4b2019-08-28 19:35:56 -070092genrule(
93 name = "drivetrain_goal_float_fbs_generated",
94 srcs = ["drivetrain_goal.fbs"],
95 outs = ["drivetrain_goal_float.fbs"],
96 cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
Alex Perrycb7da4b2019-08-28 19:35:56 -070097)
98
99genrule(
100 name = "drivetrain_position_float_fbs_generated",
101 srcs = ["drivetrain_position.fbs"],
102 outs = ["drivetrain_position_float.fbs"],
103 cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700104)
105
106genrule(
107 name = "drivetrain_output_float_fbs_generated",
108 srcs = ["drivetrain_output.fbs"],
109 outs = ["drivetrain_output_float.fbs"],
110 cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700111)
112
113genrule(
114 name = "drivetrain_status_float_fbs_generated",
115 srcs = ["drivetrain_status.fbs"],
116 outs = ["drivetrain_status_float.fbs"],
117 cmd = "cat $(SRCS) | sed 's/double/float/g' > $(OUTS)",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700118)
119
James Kuszmaulf01da392023-12-14 11:22:14 -0800120static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700121 name = "drivetrain_goal_float_fbs",
122 srcs = ["drivetrain_goal_float.fbs"],
James Kuszmaulf01da392023-12-14 11:22:14 -0800123 deps = [
124 ":spline_goal_fbs",
125 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800126 ],
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_output_float_fbs",
131 srcs = ["drivetrain_output_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_position_float_fbs",
136 srcs = ["drivetrain_position_float.fbs"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700137)
138
James Kuszmaulf01da392023-12-14 11:22:14 -0800139static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700140 name = "drivetrain_status_float_fbs",
141 srcs = ["drivetrain_status_float.fbs"],
Niko Sohmers43f71982024-01-03 19:43:59 -0800142 deps = [
143 "//frc971/control_loops:control_loops_fbs",
144 "//frc971/control_loops:encoder_fault_status_fbs",
145 ],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700146)
147
148aos_config(
James Kuszmaul74d8f972020-02-11 17:13:17 -0800149 name = "simulation_channels",
150 src = "drivetrain_simulation_channels.json",
151 flatbuffers = [
152 ":drivetrain_status_fbs",
Niko Sohmers43f71982024-01-03 19:43:59 -0800153 "//frc971/control_loops:encoder_fault_status_fbs",
James Kuszmaul74d8f972020-02-11 17:13:17 -0800154 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800155 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul74d8f972020-02-11 17:13:17 -0800156 visibility = ["//visibility:public"],
157)
158
159aos_config(
160 name = "simulation_config",
161 src = "drivetrain_simulation_config.json",
Philipp Schraderdada1072020-11-24 11:34:46 -0800162 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul74d8f972020-02-11 17:13:17 -0800163 visibility = ["//visibility:public"],
164 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800165 ":aos_config",
James Kuszmaul74d8f972020-02-11 17:13:17 -0800166 ":simulation_channels",
167 ],
168)
169
170aos_config(
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800171 name = "aos_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700172 src = "drivetrain_config.json",
173 flatbuffers = [
174 ":drivetrain_goal_fbs",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800175 ":trajectory_fbs",
176 ":spline_goal_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700177 ":drivetrain_output_fbs",
178 ":drivetrain_status_fbs",
179 ":drivetrain_position_fbs",
Niko Sohmers43f71982024-01-03 19:43:59 -0800180 ":drivetrain_can_position_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700181 ":localizer_fbs",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800182 "//frc971/queues:gyro_fbs",
183 "//frc971/queues:gyro_uid_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700184 "//frc971/wpilib:imu_fbs",
Austin Schuhac17fba2020-03-28 15:55:33 -0700185 "//frc971/wpilib:imu_batch_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700186 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800187 target_compatible_with = ["@platforms//os:linux"],
Alex Perrycb7da4b2019-08-28 19:35:56 -0700188 visibility = ["//visibility:public"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700189 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800190 "//frc971/input:aos_config",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700191 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000192)
193
194cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700195 name = "drivetrain_config",
196 hdrs = [
197 "drivetrain_config.h",
198 ],
199 deps = [
200 "//frc971:shifter_hall_effect",
201 "//frc971/control_loops:state_feedback_loop",
James Kuszmaul68025332024-01-20 17:06:02 -0800202 "//frc971/control_loops:state_feedback_loop_converters",
203 ":drivetrain_config_fbs",
Philipp Schraderdada1072020-11-24 11:34:46 -0800204 ] + select({
James Kuszmaul68025332024-01-20 17:06:02 -0800205 "@platforms//os:linux": [
206 "//frc971/control_loops:hybrid_state_feedback_loop",
207 "//frc971/control_loops:hybrid_state_feedback_loop_converters",
208 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800209 "//conditions:default": [],
210 }),
Comran Morshed5323ecb2015-12-26 20:50:55 +0000211)
212
213cc_library(
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800214 name = "hybrid_ekf",
215 hdrs = ["hybrid_ekf.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800216 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800217 deps = [
218 ":drivetrain_config",
James Kuszmaul3c5b4d32020-02-11 17:22:14 -0800219 "//aos:math",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800220 "//aos/containers:priority_queue",
James Kuszmaulfedc4612019-03-10 11:24:51 -0700221 "//aos/util:math",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800222 "//frc971/control_loops:c2d",
223 "//frc971/control_loops:runge_kutta",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700224 "@org_tuxfamily_eigen//:eigen",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800225 ],
226)
227
228cc_test(
229 name = "hybrid_ekf_test",
230 srcs = ["hybrid_ekf_test.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800231 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800232 deps = [
233 ":drivetrain_test_lib",
234 ":hybrid_ekf",
235 ":trajectory",
236 "//aos/testing:googletest",
237 "//aos/testing:random_seed",
238 "//aos/testing:test_shm",
239 ],
240)
241
James Kuszmaulf01da392023-12-14 11:22:14 -0800242static_flatbuffer(
Alex Perrycb7da4b2019-08-28 19:35:56 -0700243 name = "localizer_fbs",
244 srcs = ["localizer.fbs"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800245 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulef428a02019-03-02 22:19:41 -0800246)
247
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800248cc_library(
James Kuszmaul3431d622019-02-17 17:07:44 -0800249 name = "localizer",
250 hdrs = ["localizer.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800251 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul3431d622019-02-17 17:07:44 -0800252 deps = [
253 ":drivetrain_config",
James Kuszmaul3c5b4d32020-02-11 17:22:14 -0800254 ":drivetrain_status_fbs",
James Kuszmaul3431d622019-02-17 17:07:44 -0800255 ":hybrid_ekf",
James Kuszmaul5398fae2020-02-17 16:44:03 -0800256 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul5bc6fc92019-03-01 21:50:06 -0800257 "//frc971/control_loops:pose",
James Kuszmaul3431d622019-02-17 17:07:44 -0800258 ],
259)
260
261cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700262 name = "gear",
263 hdrs = [
264 "gear.h",
265 ],
Austin Schuh093535c2016-03-05 23:21:00 -0800266)
267
268cc_library(
Alex Perry731b4602019-02-02 22:13:01 -0800269 name = "splinedrivetrain",
270 srcs = [
271 "splinedrivetrain.cc",
272 ],
273 hdrs = [
274 "splinedrivetrain.h",
275 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800276 target_compatible_with = ["@platforms//os:linux"],
Alex Perry731b4602019-02-02 22:13:01 -0800277 deps = [
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800278 ":distance_spline",
Alex Perry731b4602019-02-02 22:13:01 -0800279 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700280 ":drivetrain_goal_fbs",
281 ":drivetrain_output_fbs",
282 ":drivetrain_status_fbs",
Alex Perry731b4602019-02-02 22:13:01 -0800283 ":spline",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800284 ":spline_goal_fbs",
Alex Perry731b4602019-02-02 22:13:01 -0800285 ":trajectory",
Austin Schuh3d9ccd72020-08-01 15:42:40 -0700286 "//aos:condition",
Alex Perry1ec34522019-02-17 22:44:10 -0800287 "//aos:init",
James Kuszmaulc73bb222019-04-07 12:15:35 -0700288 "//aos/util:math",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700289 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800290 ],
Alex Perry731b4602019-02-02 22:13:01 -0800291)
292
293cc_library(
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800294 name = "line_follow_drivetrain",
295 srcs = [
296 "line_follow_drivetrain.cc",
297 ],
298 hdrs = [
299 "line_follow_drivetrain.h",
300 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800301 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800302 deps = [
303 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700304 ":drivetrain_goal_fbs",
305 ":drivetrain_output_fbs",
306 ":drivetrain_status_fbs",
James Kuszmaul5bc6fc92019-03-01 21:50:06 -0800307 ":localizer",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800308 ":spline_goal_fbs",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800309 "//aos:math",
310 "//aos/util:math",
311 "//frc971/control_loops:c2d",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700312 "//frc971/control_loops:control_loops_fbs",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800313 "//frc971/control_loops:dlqr",
314 "//frc971/control_loops:pose",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700315 "//frc971/control_loops:profiled_subsystem_fbs",
316 "//y2019/control_loops/superstructure:superstructure_goal_fbs",
317 "@org_tuxfamily_eigen//:eigen",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800318 ],
319)
320
321cc_test(
322 name = "line_follow_drivetrain_test",
323 srcs = ["line_follow_drivetrain_test.cc"],
324 linkstatic = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800325 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800326 deps = [
327 ":drivetrain_config",
328 ":drivetrain_test_lib",
329 ":line_follow_drivetrain",
330 ":trajectory",
331 "//aos/testing:googletest",
332 "//aos/testing:test_shm",
333 "//third_party/matplotlib-cpp",
334 "@com_github_gflags_gflags//:gflags",
335 ],
336)
337
338cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700339 name = "ssdrivetrain",
340 srcs = [
341 "ssdrivetrain.cc",
342 ],
343 hdrs = [
344 "ssdrivetrain.h",
345 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800346 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700347 deps = [
348 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700349 ":drivetrain_goal_fbs",
350 ":drivetrain_output_fbs",
Austin Schuh95771d92021-01-23 14:42:25 -0800351 ":drivetrain_states",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700352 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700353 ":gear",
James Kuszmaul3431d622019-02-17 17:07:44 -0800354 ":localizer",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800355 ":spline_goal_fbs",
John Park33858a32018-09-28 23:05:48 -0700356 "//aos:math",
John Park33858a32018-09-28 23:05:48 -0700357 "//aos/util:log_interval",
358 "//aos/util:trapezoid_profile",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700359 "//frc971:shifter_hall_effect",
360 "//frc971/control_loops:coerce_goal",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700361 "//frc971/control_loops:control_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700362 "//frc971/control_loops:control_loops_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700363 "//frc971/control_loops:polytope",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700364 "//frc971/control_loops:state_feedback_loop",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700365 "//frc971/input:robot_state_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700366 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000367)
368
369cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700370 name = "polydrivetrain",
371 srcs = [
372 "polydrivetrain.cc",
373 ],
374 hdrs = [
375 "polydrivetrain.h",
376 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800377 copts = select({
378 "@platforms//os:none": ["-Wno-type-limits"],
379 "//conditions:default": [],
380 }),
Austin Schuhbcce26a2018-03-26 23:41:24 -0700381 deps = [
382 ":drivetrain_config",
Austin Schuh95771d92021-01-23 14:42:25 -0800383 ":drivetrain_states",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700384 ":gear",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700385 ":spline_goal_fbs",
John Park33858a32018-09-28 23:05:48 -0700386 "//aos:math",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700387 "//frc971/control_loops:coerce_goal",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700388 "//frc971/control_loops:control_loops_fbs",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700389 "//frc971/control_loops:polytope",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700390 "//frc971/control_loops:state_feedback_loop",
Philipp Schraderdada1072020-11-24 11:34:46 -0800391 ] + select({
392 "@platforms//os:linux": [
393 ":drivetrain_goal_fbs",
394 ":drivetrain_output_fbs",
395 ":drivetrain_position_fbs",
396 ":drivetrain_status_fbs",
Philipp Schraderdada1072020-11-24 11:34:46 -0800397 "//aos/util:log_interval",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700398 "//frc971/input:robot_state_fbs",
Philipp Schraderdada1072020-11-24 11:34:46 -0800399 ],
400 "@platforms//os:none": [
401 ":drivetrain_goal_float_fbs",
402 ":drivetrain_output_float_fbs",
403 ":drivetrain_position_float_fbs",
404 ":drivetrain_status_float_fbs",
405 ],
406 }),
Comran Morshed5323ecb2015-12-26 20:50:55 +0000407)
408
Austin Schuh05c5a612016-04-02 15:10:25 -0700409genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700410 name = "genrule_down_estimator",
411 outs = [
412 "down_estimator.h",
413 "down_estimator.cc",
414 ],
415 cmd = "$(location //frc971/control_loops/python:down_estimator) $(OUTS)",
Philipp Schraderdada1072020-11-24 11:34:46 -0800416 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700417 tools = [
418 "//frc971/control_loops/python:down_estimator",
419 ],
420 visibility = ["//visibility:private"],
Austin Schuh05c5a612016-04-02 15:10:25 -0700421)
422
423cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700424 name = "down_estimator",
425 srcs = [
426 "down_estimator.cc",
427 ],
428 hdrs = [
429 "down_estimator.h",
430 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800431 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700432 deps = [
433 "//frc971/control_loops:state_feedback_loop",
434 ],
Austin Schuh05c5a612016-04-02 15:10:25 -0700435)
436
Comran Morshed5323ecb2015-12-26 20:50:55 +0000437cc_library(
Austin Schuh95771d92021-01-23 14:42:25 -0800438 name = "drivetrain_states",
439 hdrs = ["drivetrain_states.h"],
440)
441
442cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700443 name = "drivetrain_lib",
444 srcs = [
445 "drivetrain.cc",
446 ],
447 hdrs = [
448 "drivetrain.h",
449 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800450 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700451 deps = [
Alex Perrycb7da4b2019-08-28 19:35:56 -0700452 ":drivetrain_goal_fbs",
453 ":drivetrain_output_fbs",
454 ":drivetrain_position_fbs",
Austin Schuh95771d92021-01-23 14:42:25 -0800455 ":drivetrain_states",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700456 ":drivetrain_status_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700457 ":gear",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800458 ":improved_down_estimator",
James Kuszmaule39cbcf2019-02-27 20:48:34 -0800459 ":line_follow_drivetrain",
James Kuszmaul3431d622019-02-17 17:07:44 -0800460 ":localizer",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700461 ":localizer_fbs",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700462 ":polydrivetrain",
James Kuszmaulf6aa0382024-03-01 19:46:05 -0800463 ":rio_localizer_inputs_fbs",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800464 ":spline_goal_fbs",
Alex Perry731b4602019-02-02 22:13:01 -0800465 ":splinedrivetrain",
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800466 ":ssdrivetrain",
John Park33858a32018-09-28 23:05:48 -0700467 "//aos/util:log_interval",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700468 "//frc971/control_loops:control_loop",
Austin Schuh3a378462019-01-04 21:48:04 -0800469 "//frc971/control_loops:runge_kutta",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800470 "//frc971/queues:gyro_fbs",
Austin Schuhac17fba2020-03-28 15:55:33 -0700471 "//frc971/wpilib:imu_batch_fbs",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700472 "//frc971/wpilib:imu_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800473 "//frc971/zeroing:imu_zeroer",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700474 ],
Comran Morshed5323ecb2015-12-26 20:50:55 +0000475)
476
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800477cc_library(
478 name = "drivetrain_test_lib",
479 testonly = True,
480 srcs = ["drivetrain_test_lib.cc"],
481 hdrs = ["drivetrain_test_lib.h"],
James Kuszmaul74d8f972020-02-11 17:13:17 -0800482 defines =
483 cpu_select({
484 "amd64": [
485 "SUPPORT_PLOT=1",
486 ],
487 "arm": [],
488 }),
Philipp Schraderdada1072020-11-24 11:34:46 -0800489 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800490 deps = [
491 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700492 ":drivetrain_goal_fbs",
493 ":drivetrain_output_fbs",
494 ":drivetrain_position_fbs",
495 ":drivetrain_status_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800496 ":trajectory",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700497 "//aos/events:event_loop",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800498 "//aos/testing:googletest",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700499 "//frc971/control_loops:control_loops_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800500 "//frc971/control_loops:state_feedback_loop",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800501 "//frc971/queues:gyro_fbs",
Austin Schuhac17fba2020-03-28 15:55:33 -0700502 "//frc971/wpilib:imu_batch_fbs",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700503 "//frc971/wpilib:imu_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800504 "//y2016:constants",
505 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
James Kuszmaul74d8f972020-02-11 17:13:17 -0800506 ] + cpu_select({
507 "amd64": [
508 "//third_party/matplotlib-cpp",
509 ],
510 "arm": [],
511 }),
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800512)
513
Comran Morshed5323ecb2015-12-26 20:50:55 +0000514cc_test(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700515 name = "drivetrain_lib_test",
516 srcs = [
517 "drivetrain_lib_test.cc",
518 ],
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700519 data = [":simulation_config"],
Alex Perry04300d62019-02-17 14:37:04 -0800520 defines =
521 cpu_select({
522 "amd64": [
523 "SUPPORT_PLOT=1",
524 ],
525 "arm": [],
526 }),
527 linkstatic = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800528 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhbcce26a2018-03-26 23:41:24 -0700529 deps = [
530 ":drivetrain_config",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700531 ":drivetrain_goal_fbs",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700532 ":drivetrain_lib",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700533 ":drivetrain_output_fbs",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700534 ":drivetrain_position_fbs",
535 ":drivetrain_status_fbs",
James Kuszmaul109ed8d2019-02-17 21:41:04 -0800536 ":drivetrain_test_lib",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700537 ":localizer_fbs",
538 ":trajectory_generator",
Austin Schuhb06f03b2021-02-17 22:00:37 -0800539 "//aos/events/logging:log_writer",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700540 "//aos/testing:googletest",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700541 "//frc971/control_loops:control_loop_test",
Tyler Chatow24b5db12020-01-06 21:16:56 -0800542 "//frc971/queues:gyro_fbs",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800543 "//frc971/wpilib:imu_fbs",
Alex Perry04300d62019-02-17 14:37:04 -0800544 ] + cpu_select({
545 "amd64": [
546 "//third_party/matplotlib-cpp",
547 ],
548 "arm": [],
549 }),
Comran Morshed5323ecb2015-12-26 20:50:55 +0000550)
Brian Silverman6260c092018-01-14 15:21:36 -0800551
552genrule(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700553 name = "genrule_haptic_wheel",
554 outs = [
555 "haptic_wheel.h",
556 "haptic_wheel.cc",
557 "integral_haptic_wheel.h",
558 "integral_haptic_wheel.cc",
559 "haptic_trigger.h",
560 "haptic_trigger.cc",
561 "integral_haptic_trigger.h",
562 "integral_haptic_trigger.cc",
563 ],
564 cmd = "$(location //frc971/control_loops/python:haptic_wheel) $(OUTS)",
Austin Schuhbcce26a2018-03-26 23:41:24 -0700565 tools = [
566 "//frc971/control_loops/python:haptic_wheel",
567 ],
568 visibility = ["//visibility:private"],
Brian Silverman6260c092018-01-14 15:21:36 -0800569)
570
571cc_library(
Austin Schuhbcce26a2018-03-26 23:41:24 -0700572 name = "haptic_wheel",
573 srcs = [
574 "haptic_trigger.cc",
575 "haptic_wheel.cc",
576 "integral_haptic_trigger.cc",
577 "integral_haptic_wheel.cc",
578 ],
579 hdrs = [
580 "haptic_trigger.h",
581 "haptic_wheel.h",
582 "integral_haptic_trigger.h",
583 "integral_haptic_wheel.h",
584 ],
585 deps = [
586 "//frc971/control_loops:state_feedback_loop",
587 ],
Brian Silverman6260c092018-01-14 15:21:36 -0800588)
Austin Schuhc2b08772018-12-19 18:05:06 +1100589
590cc_library(
591 name = "spline",
592 srcs = ["spline.cc"],
593 hdrs = ["spline.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800594 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhc2b08772018-12-19 18:05:06 +1100595 deps = [
Austin Schuhf49b4e32019-01-13 17:26:58 -0800596 "//frc971/control_loops:binomial",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700597 "@org_tuxfamily_eigen//:eigen",
Austin Schuhc2b08772018-12-19 18:05:06 +1100598 ],
599)
600
Alex Perrya60da442019-01-21 19:00:27 -0500601cc_binary(
602 name = "spline.so",
603 srcs = ["libspline.cc"],
James Kuszmaul2ed7b3c2019-02-09 18:26:19 -0800604 linkshared = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800605 target_compatible_with = ["@platforms//os:linux"],
Alex Perrya60da442019-01-21 19:00:27 -0500606 deps = [
607 ":distance_spline",
608 ":spline",
Alex Perry0603b542019-01-25 20:29:51 -0800609 ":trajectory",
Austin Schuhfc0caa82023-08-25 14:25:03 -0700610 "//aos/logging",
Alex Perry0603b542019-01-25 20:29:51 -0800611 "//aos/network:team_number",
James Kuszmaul8aa37cb2020-03-01 10:27:58 -0800612 "//y2020/control_loops/drivetrain:drivetrain_base",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700613 "@org_tuxfamily_eigen//:eigen",
Alex Perrya60da442019-01-21 19:00:27 -0500614 ],
Alex Perrya60da442019-01-21 19:00:27 -0500615)
616
Austin Schuhc2b08772018-12-19 18:05:06 +1100617cc_test(
618 name = "spline_test",
619 srcs = [
620 "spline_test.cc",
621 ],
James Kuszmaule32fa932021-05-11 21:38:16 -0700622 linkstatic = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800623 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhc2b08772018-12-19 18:05:06 +1100624 deps = [
625 ":spline",
Stephan Pleines85b295c2024-02-04 17:50:26 -0800626 "//aos/analysis:in_process_plotter",
Austin Schuhc2b08772018-12-19 18:05:06 +1100627 "//aos/testing:googletest",
Austin Schuhc2b08772018-12-19 18:05:06 +1100628 "@com_github_gflags_gflags//:gflags",
629 ],
630)
Austin Schuh941b46d2018-12-19 18:06:05 +1100631
632cc_library(
633 name = "distance_spline",
634 srcs = ["distance_spline.cc"],
635 hdrs = ["distance_spline.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800636 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh941b46d2018-12-19 18:06:05 +1100637 deps = [
638 ":spline",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800639 ":trajectory_fbs",
Austin Schuhf7c65202022-11-04 21:28:20 -0700640 "//aos/containers:sized_array",
Austin Schuha6e7b212019-01-20 13:53:01 -0800641 "//aos/logging",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800642 "//frc971/control_loops:control_loops_fbs",
Austin Schuh941b46d2018-12-19 18:06:05 +1100643 "//frc971/control_loops:fixed_quadrature",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800644 "@com_github_google_glog//:glog",
Austin Schuhf7c65202022-11-04 21:28:20 -0700645 "@com_google_absl//absl/types:span",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700646 "@org_tuxfamily_eigen//:eigen",
Austin Schuh941b46d2018-12-19 18:06:05 +1100647 ],
648)
649
650cc_test(
651 name = "distance_spline_test",
652 srcs = [
653 "distance_spline_test.cc",
654 ],
Austin Schuh9b0b6432019-01-13 21:15:17 -0800655 defines =
656 cpu_select({
657 "amd64": [
658 "SUPPORT_PLOT=1",
659 ],
660 "arm": [],
661 }),
662 linkstatic = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800663 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh941b46d2018-12-19 18:06:05 +1100664 deps = [
665 ":distance_spline",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800666 "//aos:flatbuffers",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700667 "//aos/testing:googletest",
Austin Schuha6e7b212019-01-20 13:53:01 -0800668 "//aos/testing:test_shm",
Austin Schuh941b46d2018-12-19 18:06:05 +1100669 "@com_github_gflags_gflags//:gflags",
Austin Schuh9b0b6432019-01-13 21:15:17 -0800670 ] + cpu_select({
671 "amd64": [
672 "//third_party/matplotlib-cpp",
673 ],
674 "arm": [],
675 }),
Austin Schuh941b46d2018-12-19 18:06:05 +1100676)
Austin Schuhec7f06d2019-01-04 07:47:15 +1100677
678cc_library(
679 name = "trajectory",
680 srcs = ["trajectory.cc"],
681 hdrs = ["trajectory.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800682 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhec7f06d2019-01-04 07:47:15 +1100683 deps = [
684 ":distance_spline",
685 ":drivetrain_config",
James Kuszmaul75a18c52021-03-10 22:02:07 -0800686 ":spline_goal_fbs",
687 ":trajectory_fbs",
James Kuszmaul5e8ce312021-03-27 14:59:17 -0700688 "//aos/util:math",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100689 "//frc971/control_loops:c2d",
690 "//frc971/control_loops:dlqr",
691 "//frc971/control_loops:hybrid_state_feedback_loop",
692 "//frc971/control_loops:runge_kutta",
693 "//frc971/control_loops:state_feedback_loop",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700694 "@org_tuxfamily_eigen//:eigen",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100695 ],
696)
697
James Kuszmaul75a18c52021-03-10 22:02:07 -0800698cc_library(
699 name = "trajectory_generator",
700 srcs = ["trajectory_generator.cc"],
701 hdrs = ["trajectory_generator.h"],
702 target_compatible_with = ["@platforms//os:linux"],
703 deps = [
704 ":distance_spline",
705 ":drivetrain_config",
706 ":spline_goal_fbs",
707 ":trajectory",
708 ":trajectory_fbs",
709 ],
710)
711
Austin Schuhec7f06d2019-01-04 07:47:15 +1100712cc_binary(
713 name = "trajectory_plot",
714 srcs = [
715 "trajectory_plot.cc",
716 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800717 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhec7f06d2019-01-04 07:47:15 +1100718 deps = [
719 ":distance_spline",
720 ":trajectory",
Austin Schuhfc0caa82023-08-25 14:25:03 -0700721 "//aos/logging",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100722 "//aos/network:team_number",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100723 "//third_party/matplotlib-cpp",
Austin Schuh11043182019-03-23 22:29:12 -0700724 "//y2019/control_loops/drivetrain:drivetrain_base",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100725 "@com_github_gflags_gflags//:gflags",
Alex Perrycb7da4b2019-08-28 19:35:56 -0700726 "@org_tuxfamily_eigen//:eigen",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100727 ],
728)
729
730cc_test(
731 name = "trajectory_test",
732 srcs = [
733 "trajectory_test.cc",
734 ],
Austin Schuh719a33e2019-01-07 15:13:34 -0800735 defines =
736 cpu_select({
737 "amd64": [
738 "SUPPORT_PLOT=1",
739 ],
740 "arm": [],
741 }),
742 linkstatic = True,
Philipp Schraderdada1072020-11-24 11:34:46 -0800743 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhec7f06d2019-01-04 07:47:15 +1100744 deps = [
James Kuszmaulea314d92019-02-18 19:45:06 -0800745 ":drivetrain_test_lib",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700746 ":trajectory",
Austin Schuhec7f06d2019-01-04 07:47:15 +1100747 "//aos/testing:googletest",
748 "//aos/testing:test_shm",
749 "//y2016:constants",
750 "//y2016/control_loops/drivetrain:polydrivetrain_plants",
James Kuszmaulea314d92019-02-18 19:45:06 -0800751 "//y2019/control_loops/drivetrain:drivetrain_base",
Austin Schuh719a33e2019-01-07 15:13:34 -0800752 ] + cpu_select({
753 "amd64": [
754 "//third_party/matplotlib-cpp",
755 ],
756 "arm": [],
757 }),
Austin Schuhec7f06d2019-01-04 07:47:15 +1100758)
Austin Schuhca080812017-05-10 19:31:55 -0700759
760cc_library(
761 name = "improved_down_estimator",
762 srcs = [
763 "improved_down_estimator.cc",
764 ],
765 hdrs = [
766 "improved_down_estimator.h",
767 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800768 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhca080812017-05-10 19:31:55 -0700769 deps = [
James Kuszmaul7f55f072020-03-01 10:21:26 -0800770 ":drivetrain_config",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800771 ":drivetrain_status_fbs",
772 "//aos/events:event_loop",
James Kuszmaul81d5f2d2024-04-05 21:57:14 -0700773 "//aos/time",
774 "//aos/util:math",
James Kuszmaul3e1bb272020-01-17 18:38:19 -0800775 "//frc971/control_loops:control_loops_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700776 "//frc971/control_loops:quaternion_utils",
Austin Schuhca080812017-05-10 19:31:55 -0700777 "//frc971/control_loops:runge_kutta",
778 "@com_github_google_glog//:glog",
779 "@org_tuxfamily_eigen//:eigen",
780 ],
781)
782
783cc_test(
784 name = "improved_down_estimator_test",
785 srcs = [
786 "improved_down_estimator_test.cc",
787 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800788 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhca080812017-05-10 19:31:55 -0700789 deps = [
James Kuszmaul7f55f072020-03-01 10:21:26 -0800790 ":drivetrain_test_lib",
Austin Schuhca080812017-05-10 19:31:55 -0700791 "//aos/testing:googletest",
792 "//aos/testing:random_seed",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700793 "//frc971/control_loops:quaternion_utils",
Austin Schuhca080812017-05-10 19:31:55 -0700794 "//frc971/control_loops/drivetrain:improved_down_estimator",
795 "@org_tuxfamily_eigen//:eigen",
796 ],
797)
James Kuszmaulf4ede202020-02-14 08:47:40 -0800798
799cc_library(
800 name = "camera",
801 srcs = ["camera.h"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800802 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf4ede202020-02-14 08:47:40 -0800803 visibility = ["//visibility:public"],
804 deps = [
805 "//aos/containers:sized_array",
806 "//frc971/control_loops:pose",
807 ],
808)
809
Niko Sohmers43f71982024-01-03 19:43:59 -0800810cc_library(
811 name = "drivetrain_encoder_fault_detector",
812 srcs = ["drivetrain_encoder_fault_detector.cc"],
813 hdrs = ["drivetrain_encoder_fault_detector.h"],
814 target_compatible_with = ["@platforms//os:linux"],
815 deps = [
816 "//aos/events:event_loop",
817 "//frc971/control_loops:encoder_fault_detector",
818 "//frc971/control_loops:encoder_fault_status_fbs",
819 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
820 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
821 "//frc971/control_loops/drivetrain:drivetrain_status_fbs",
822 ],
823)
824
825cc_test(
826 name = "drivetrain_encoder_fault_detector_test",
827 srcs = ["drivetrain_encoder_fault_detector_test.cc"],
828 data = [":simulation_config"],
829 target_compatible_with = ["@platforms//os:linux"],
830 deps = [
831 ":drivetrain_encoder_fault_detector",
832 "//aos:json_to_flatbuffer",
833 "//aos/events:simulated_event_loop",
834 "//aos/testing:googletest",
835 ],
836)
837
James Kuszmaulf4ede202020-02-14 08:47:40 -0800838cc_test(
839 name = "camera_test",
840 srcs = ["camera_test.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800841 target_compatible_with = ["@platforms//os:linux"],
James Kuszmaulf4ede202020-02-14 08:47:40 -0800842 deps = [
843 ":camera",
844 "//aos/testing:googletest",
845 ],
846)
James Kuszmaulc4ae11c2020-12-26 16:26:58 -0800847
Philipp Schrader3de4dfc2023-02-15 20:18:25 -0800848ts_project(
James Kuszmaulac2b6b42021-03-07 22:38:06 -0800849 name = "down_estimator_plotter",
850 srcs = ["down_estimator_plotter.ts"],
851 target_compatible_with = ["@platforms//os:linux"],
852 deps = [
853 "//aos/network/www:aos_plotter",
854 "//aos/network/www:colors",
855 "//aos/network/www:proxy",
856 "//frc971/wpilib:imu_plot_utils",
857 ],
858)
859
Philipp Schrader3de4dfc2023-02-15 20:18:25 -0800860ts_project(
James Kuszmaul73fc1352021-04-09 22:31:25 -0700861 name = "spline_plotter",
862 srcs = ["spline_plotter.ts"],
863 target_compatible_with = ["@platforms//os:linux"],
864 deps = [
865 "//aos/network/www:aos_plotter",
866 "//aos/network/www:colors",
867 "//aos/network/www:proxy",
868 ],
869)
870
Philipp Schrader3de4dfc2023-02-15 20:18:25 -0800871ts_project(
James Kuszmaulc4ae11c2020-12-26 16:26:58 -0800872 name = "drivetrain_plotter",
873 srcs = ["drivetrain_plotter.ts"],
874 target_compatible_with = ["@platforms//os:linux"],
875 deps = [
876 "//aos/network/www:aos_plotter",
James Kuszmaul933a9742021-03-07 19:59:06 -0800877 "//aos/network/www:colors",
James Kuszmaulc4ae11c2020-12-26 16:26:58 -0800878 "//aos/network/www:proxy",
879 "//frc971/wpilib:imu_plot_utils",
880 ],
881)
milind upadhyay9bd381d2021-01-23 13:44:13 -0800882
Philipp Schrader3de4dfc2023-02-15 20:18:25 -0800883ts_project(
milind upadhyay9bd381d2021-01-23 13:44:13 -0800884 name = "robot_state_plotter",
885 srcs = ["robot_state_plotter.ts"],
886 target_compatible_with = ["@platforms//os:linux"],
887 deps = [
888 "//aos/network/www:aos_plotter",
James Kuszmaul933a9742021-03-07 19:59:06 -0800889 "//aos/network/www:colors",
milind upadhyay9bd381d2021-01-23 13:44:13 -0800890 "//aos/network/www:proxy",
891 ],
892)
James Kuszmaul68025332024-01-20 17:06:02 -0800893
894static_flatbuffer(
895 name = "drivetrain_config_fbs",
896 srcs = ["drivetrain_config.fbs"],
897 visibility = ["//visibility:public"],
898 deps = ["//frc971/control_loops:state_feedback_loop_fbs"],
899)
James Kuszmaul62c3bd82024-01-17 20:03:05 -0800900
901cc_binary(
902 name = "drivetrain_config_merge",
903 srcs = ["drivetrain_config_merge.cc"],
904 visibility = ["//visibility:public"],
905 deps = [
906 ":drivetrain_config_fbs",
907 "//aos:flatbuffer_merge",
908 "//aos:init",
909 "//aos:json_to_flatbuffer",
910 ],
911)
912
913cc_test(
914 name = "drivetrain_config_test",
915 srcs = ["drivetrain_config_test.cc"],
916 data = [":drivetrain_test_config.json"],
917 deps = [
918 ":drivetrain_config_fbs",
919 ":drivetrain_test_lib",
920 "//aos/testing:googletest",
921 "//aos/testing:path",
922 ],
923)
924
925jinja2_template(
926 name = "drivetrain_test_config.json",
927 src = "drivetrain_test_config.jinja2.json",
928 includes = [
929 "//y2016/control_loops/drivetrain:drivetrain_config",
930 ],
931 parameters = {},
932 visibility = ["//visibility:public"],
933)