blob: fa534627145888729153f2963b7031c61ba104d6 [file] [log] [blame]
Austin Schuh9f164e92022-12-29 16:15:28 -08001load("//frc971:downloader.bzl", "robot_downloader")
2load("//aos:config.bzl", "aos_config")
3load("//tools/build_rules:template.bzl", "jinja2_template")
Austin Schuhbb4c9ac2023-02-28 22:04:20 -08004load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
milind-uc6e437a2023-03-01 23:40:40 -08005load("//aos/util:config_validator_macro.bzl", "config_validator_rule")
6
7config_validator_rule(
8 name = "config_validator_test",
9 config = "//y2023:aos_config",
10)
Austin Schuh9f164e92022-12-29 16:15:28 -080011
12robot_downloader(
Ravago Jones2060ee62023-02-03 18:12:24 -080013 binaries = [
14 "//aos/network:web_proxy_main",
15 "//aos/events/logging:log_cat",
James Kuszmaule22680a2023-02-26 17:33:43 -080016 "//y2023/constants:constants_sender",
Austin Schuhd138e372023-02-23 21:43:53 -080017 "//aos/events:aos_timing_report_streamer",
Ravago Jones2060ee62023-02-03 18:12:24 -080018 ],
19 data = [
20 ":aos_config",
Xander Yee1ad2f7b2023-02-21 14:46:56 -080021 "//aos/starter:roborio_irq_config.json",
James Kuszmaule22680a2023-02-26 17:33:43 -080022 "//y2023/constants:constants.json",
Ravago Jones2060ee62023-02-03 18:12:24 -080023 "@ctre_phoenix_api_cpp_athena//:shared_libraries",
24 "@ctre_phoenix_cci_athena//:shared_libraries",
25 "@ctre_phoenixpro_api_cpp_athena//:shared_libraries",
26 "@ctre_phoenixpro_tools_athena//:shared_libraries",
27 ],
28 dirs = [
29 "//y2023/www:www_files",
30 ],
31 start_binaries = [
32 "//aos/events/logging:logger_main",
33 "//aos/network:web_proxy_main",
Xander Yee1ad2f7b2023-02-21 14:46:56 -080034 "//aos/starter:irq_affinity",
Ravago Jones2060ee62023-02-03 18:12:24 -080035 ":joystick_reader",
36 ":wpilib_interface",
37 "//aos/network:message_bridge_client",
38 "//aos/network:message_bridge_server",
39 "//y2023/control_loops/drivetrain:drivetrain",
40 "//y2023/control_loops/drivetrain:trajectory_generator",
41 "//y2023/control_loops/superstructure:superstructure",
42 ],
43 target_compatible_with = ["@platforms//os:linux"],
44)
45
46robot_downloader(
Austin Schuh9f164e92022-12-29 16:15:28 -080047 name = "pi_download",
48 binaries = [
James Kuszmaul7e958812023-02-11 15:34:31 -080049 "//frc971/vision:intrinsics_calibration",
Xander Yee1ad2f7b2023-02-21 14:46:56 -080050 "//aos/starter:irq_affinity",
James Kuszmaul77d536c2023-02-11 17:30:59 -080051 "//aos/util:foxglove_websocket",
Austin Schuh9f164e92022-12-29 16:15:28 -080052 "//y2023/vision:viewer",
milind-ud4051fe2023-02-25 18:00:05 -080053 "//y2023/vision:localization_verifier",
Maxwell Hendersonfebee252023-01-28 16:53:52 -080054 "//y2023/vision:aprilrobotics",
James Kuszmaule01ae1e2023-02-25 20:54:06 -080055 "//aos/events:aos_timing_report_streamer",
James Kuszmaul04a343c2023-02-20 16:38:22 -080056 "//y2023/localizer:localizer_main",
James Kuszmauld67f6d22023-02-05 17:37:25 -080057 "//y2023/constants:constants_sender",
James Kuszmaul77d536c2023-02-11 17:30:59 -080058 "//y2023/vision:foxglove_image_converter",
Maxwell Hendersonad312342023-01-10 12:07:47 -080059 "//aos/network:web_proxy_main",
Austin Schuh9f164e92022-12-29 16:15:28 -080060 "//aos/events/logging:log_cat",
Austin Schuhb07dd5b2023-02-05 22:29:11 -080061 "//y2023/rockpi:imu_main",
milind-u8e98cb92023-02-05 16:07:10 -080062 "//frc971/image_streamer:image_streamer",
Austin Schuh9f164e92022-12-29 16:15:28 -080063 ],
64 data = [
65 ":aos_config",
James Kuszmaul08a4d852023-02-22 16:57:54 -080066 "//frc971/rockpi:rockpi_config.json",
James Kuszmauld67f6d22023-02-05 17:37:25 -080067 "//y2023/constants:constants.json",
milind-u8e98cb92023-02-05 16:07:10 -080068 "//y2023/vision:image_streamer_start",
James Kuszmauld67f6d22023-02-05 17:37:25 -080069 "//y2023/www:www_files",
Austin Schuh9f164e92022-12-29 16:15:28 -080070 ],
71 dirs = [
Maxwell Hendersonad312342023-01-10 12:07:47 -080072 "//y2023/www:www_files",
milind-u8e98cb92023-02-05 16:07:10 -080073 "//frc971/image_streamer/www:www_files",
Austin Schuh9f164e92022-12-29 16:15:28 -080074 ],
75 start_binaries = [
Austin Schuh9f164e92022-12-29 16:15:28 -080076 "//aos/network:message_bridge_client",
77 "//aos/network:message_bridge_server",
78 "//aos/network:web_proxy_main",
Austin Schuh3e1d3b62023-01-08 13:52:31 -080079 "//aos/starter:irq_affinity",
Austin Schuh9f164e92022-12-29 16:15:28 -080080 "//y2023/vision:camera_reader",
Maxwell Hendersonad312342023-01-10 12:07:47 -080081 "//aos/events/logging:logger_main",
Filip Kujawa3004f202023-02-12 16:41:40 -080082 "//y2023/vision:game_pieces_detector",
Austin Schuh9f164e92022-12-29 16:15:28 -080083 ],
84 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
85 target_type = "pi",
86)
87
88aos_config(
89 name = "aos_config",
90 src = "y2023.json",
91 flatbuffers = [
92 "//aos/network:message_bridge_client_fbs",
93 "//aos/network:message_bridge_server_fbs",
94 "//aos/network:timestamp_fbs",
95 "//frc971/input:robot_state_fbs",
96 "//frc971/vision:vision_fbs",
Maxwell Hendersonfebee252023-01-28 16:53:52 -080097 "//frc971/vision:target_map_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -080098 ],
99 target_compatible_with = ["@platforms//os:linux"],
100 visibility = ["//visibility:public"],
101 deps = [
102 ":config_imu",
103 ":config_logger",
104 ":config_pi1",
105 ":config_pi2",
106 ":config_pi3",
107 ":config_pi4",
108 ":config_roborio",
109 ],
110)
111
112[
113 aos_config(
114 name = "config_" + pi,
115 src = "y2023_" + pi + ".json",
116 flatbuffers = [
117 "//aos/network:message_bridge_client_fbs",
118 "//aos/network:message_bridge_server_fbs",
119 "//aos/network:timestamp_fbs",
120 "//aos/network:remote_message_fbs",
James Kuszmauld67f6d22023-02-05 17:37:25 -0800121 "//y2023/constants:constants_fbs",
James Kuszmaule3df1ed2023-02-20 16:21:17 -0800122 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
milind-u2f101fc2023-01-21 12:28:49 -0800123 "//frc971/vision:calibration_fbs",
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800124 "//frc971/vision:target_map_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800125 "//frc971/vision:vision_fbs",
James Kuszmaul04a343c2023-02-20 16:38:22 -0800126 "//y2023/localizer:visualization_fbs",
Filip Kujawa3004f202023-02-12 16:41:40 -0800127 "//y2023/vision:game_pieces_fbs",
James Kuszmaulf3ec4db2023-02-12 14:18:41 -0800128 "@com_github_foxglove_schemas//:schemas",
Austin Schuh9f164e92022-12-29 16:15:28 -0800129 ],
130 target_compatible_with = ["@platforms//os:linux"],
131 visibility = ["//visibility:public"],
132 deps = [
133 "//aos/events:aos_config",
134 "//frc971/control_loops/drivetrain:aos_config",
135 "//frc971/input:aos_config",
136 ],
137 )
138 for pi in [
139 "pi1",
140 "pi2",
141 "pi3",
142 "pi4",
143 ]
144]
145
146aos_config(
147 name = "config_imu",
148 src = "y2023_imu.json",
149 flatbuffers = [
150 "//aos/network:message_bridge_client_fbs",
151 "//aos/network:message_bridge_server_fbs",
James Kuszmauld67f6d22023-02-05 17:37:25 -0800152 "//y2023/constants:constants_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800153 "//aos/network:timestamp_fbs",
154 "//aos/network:remote_message_fbs",
James Kuszmaul04a343c2023-02-20 16:38:22 -0800155 "//y2023/localizer:status_fbs",
James Kuszmaule3df1ed2023-02-20 16:21:17 -0800156 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
James Kuszmaul04a343c2023-02-20 16:38:22 -0800157 "//y2023/localizer:visualization_fbs",
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800158 "//frc971/vision:target_map_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800159 ],
160 target_compatible_with = ["@platforms//os:linux"],
161 visibility = ["//visibility:public"],
162 deps = [
163 "//aos/events:aos_config",
164 "//frc971/control_loops/drivetrain:aos_config",
165 ],
166)
167
168aos_config(
169 name = "config_logger",
170 src = "y2023_logger.json",
171 flatbuffers = [
172 "//aos/network:message_bridge_client_fbs",
173 "//aos/network:message_bridge_server_fbs",
174 "//aos/network:timestamp_fbs",
175 "//aos/network:remote_message_fbs",
milind-u2f101fc2023-01-21 12:28:49 -0800176 "//frc971/vision:calibration_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800177 "//frc971/vision:vision_fbs",
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800178 "//frc971/vision:target_map_fbs",
James Kuszmauld67f6d22023-02-05 17:37:25 -0800179 "//y2023/constants:constants_fbs",
Filip Kujawa3004f202023-02-12 16:41:40 -0800180 "//y2023/vision:game_pieces_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800181 ],
182 target_compatible_with = ["@platforms//os:linux"],
183 visibility = ["//visibility:public"],
184 deps = [
185 "//aos/events:aos_config",
186 "//frc971/control_loops/drivetrain:aos_config",
187 "//frc971/input:aos_config",
188 ],
189)
190
191aos_config(
192 name = "config_roborio",
193 src = "y2023_roborio.json",
194 flatbuffers = [
Austin Schuhbb4c9ac2023-02-28 22:04:20 -0800195 ":can_configuration_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800196 "//aos/network:remote_message_fbs",
197 "//aos/network:message_bridge_client_fbs",
198 "//aos/network:message_bridge_server_fbs",
James Kuszmauld67f6d22023-02-05 17:37:25 -0800199 "//y2023/constants:constants_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800200 "//aos/network:timestamp_fbs",
201 "//y2019/control_loops/drivetrain:target_selector_fbs",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800202 "//y2023/control_loops/superstructure:superstructure_goal_fbs",
James Kuszmauldb730d72023-02-25 16:01:27 -0800203 "//y2023/control_loops/drivetrain:target_selector_hint_fbs",
Ravago Jones2060ee62023-02-03 18:12:24 -0800204 "//y2023/control_loops/drivetrain:drivetrain_can_position_fbs",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800205 "//y2023/control_loops/superstructure:superstructure_output_fbs",
206 "//y2023/control_loops/superstructure:superstructure_position_fbs",
207 "//y2023/control_loops/superstructure:superstructure_status_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800208 ],
209 target_compatible_with = ["@platforms//os:linux"],
210 deps = [
211 "//aos/events:aos_config",
212 "//frc971/autonomous:aos_config",
213 "//frc971/control_loops/drivetrain:aos_config",
214 "//frc971/input:aos_config",
215 "//frc971/wpilib:aos_config",
216 ],
217)
218
219[
220 jinja2_template(
221 name = "y2023_pi" + str(num) + ".json",
222 src = "y2023_pi_template.json",
223 parameters = {"NUM": str(num)},
224 target_compatible_with = ["@platforms//os:linux"],
225 )
226 for num in range(1, 6)
227]
Maxwell Hendersonad312342023-01-10 12:07:47 -0800228
229cc_library(
230 name = "constants",
231 srcs = [
232 "constants.cc",
233 ],
234 hdrs = [
235 "constants.h",
236 ],
237 visibility = ["//visibility:public"],
238 deps = [
239 "//aos/mutex",
240 "//aos/network:team_number",
241 "//frc971:constants",
242 "//frc971/control_loops:pose",
243 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
244 "//frc971/shooter_interpolation:interpolation",
245 "//y2023/control_loops/drivetrain:polydrivetrain_plants",
milind-u37385182023-02-20 15:07:28 -0800246 "//y2023/control_loops/superstructure/arm:arm_constants",
milind-u051c7002023-02-20 16:28:18 -0800247 "//y2023/control_loops/superstructure/roll:roll_plants",
248 "//y2023/control_loops/superstructure/wrist:wrist_plants",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800249 "@com_github_google_glog//:glog",
250 "@com_google_absl//absl/base",
251 ],
252)
253
254cc_binary(
255 name = "wpilib_interface",
256 srcs = [
257 "wpilib_interface.cc",
258 ],
259 target_compatible_with = ["//tools/platforms/hardware:roborio"],
260 deps = [
Austin Schuhbb4c9ac2023-02-28 22:04:20 -0800261 ":can_configuration_fbs",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800262 ":constants",
263 "//aos:init",
264 "//aos:math",
Ravago Jones2060ee62023-02-03 18:12:24 -0800265 "//aos/containers:sized_array",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800266 "//aos/events:shm_event_loop",
267 "//aos/logging",
268 "//aos/stl_mutex",
269 "//aos/time",
270 "//aos/util:log_interval",
271 "//aos/util:phased_loop",
272 "//aos/util:wrapping_counter",
273 "//frc971/autonomous:auto_mode_fbs",
274 "//frc971/control_loops:control_loop",
275 "//frc971/control_loops:control_loops_fbs",
276 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
277 "//frc971/input:robot_state_fbs",
278 "//frc971/queues:gyro_fbs",
279 "//frc971/wpilib:ADIS16448",
280 "//frc971/wpilib:buffered_pcm",
281 "//frc971/wpilib:drivetrain_writer",
282 "//frc971/wpilib:encoder_and_potentiometer",
283 "//frc971/wpilib:interrupt_edge_counting",
284 "//frc971/wpilib:joystick_sender",
285 "//frc971/wpilib:logging_fbs",
286 "//frc971/wpilib:loop_output_handler",
287 "//frc971/wpilib:pdp_fetcher",
288 "//frc971/wpilib:sensor_reader",
289 "//frc971/wpilib:wpilib_interface",
290 "//frc971/wpilib:wpilib_robot_base",
291 "//third_party:phoenix",
Ravago Jones2060ee62023-02-03 18:12:24 -0800292 "//third_party:phoenixpro",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800293 "//third_party:wpilib",
Ravago Jones2060ee62023-02-03 18:12:24 -0800294 "//y2023/control_loops/drivetrain:drivetrain_can_position_fbs",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800295 "//y2023/control_loops/superstructure:superstructure_output_fbs",
296 "//y2023/control_loops/superstructure:superstructure_position_fbs",
297 ],
298)
299
300cc_binary(
301 name = "joystick_reader",
302 srcs = [
303 ":joystick_reader.cc",
304 ],
305 deps = [
306 ":constants",
307 "//aos:init",
308 "//aos/actions:action_lib",
309 "//aos/logging",
310 "//frc971/autonomous:auto_fbs",
311 "//frc971/autonomous:base_autonomous_actor",
312 "//frc971/control_loops:profiled_subsystem_fbs",
313 "//frc971/input:action_joystick_input",
314 "//frc971/input:drivetrain_input",
315 "//frc971/input:joystick_input",
316 "//y2023/control_loops/drivetrain:drivetrain_base",
James Kuszmaul4e171432023-02-26 13:39:37 -0800317 "//y2023/control_loops/drivetrain:target_selector_hint_fbs",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800318 "//y2023/control_loops/superstructure:superstructure_goal_fbs",
319 "//y2023/control_loops/superstructure:superstructure_status_fbs",
milind-udefab712023-02-20 22:22:02 -0800320 "//y2023/control_loops/superstructure/arm:generated_graph",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800321 ],
322)
323
324py_library(
325 name = "python_init",
326 srcs = ["__init__.py"],
327 target_compatible_with = ["@platforms//os:linux"],
328 visibility = ["//visibility:public"],
329)
330
331sh_binary(
332 name = "log_web_proxy",
333 srcs = ["log_web_proxy.sh"],
334 data = [
335 ":aos_config",
336 "//aos/network:log_web_proxy_main",
337 "//y2023/www:field_main_bundle.min.js",
338 "//y2023/www:files",
339 ],
340 target_compatible_with = ["@platforms//os:linux"],
341)
Austin Schuhe6b2b882023-02-04 11:42:40 -0800342
343cc_binary(
344 name = "ssd_profiler",
345 srcs = [
346 "ssd_profiler.cc",
347 ],
348 deps = [
349 "//aos:init",
350 "//aos/time",
351 "@com_github_google_glog//:glog",
352 ],
353)
Austin Schuhbb4c9ac2023-02-28 22:04:20 -0800354
355flatbuffer_cc_library(
356 name = "can_configuration_fbs",
357 srcs = [
358 ":can_configuration.fbs",
359 ],
360 gen_reflections = 1,
361 visibility = ["//visibility:public"],
362)