blob: 08713b778638aca8e1b3196f978d615055310219 [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",
Maxwell Hendersonb392b742023-03-05 07:53:51 -080023 "//y2023/control_loops/superstructure/arm:arm_trajectories_generated.bfbs",
Ravago Jones2060ee62023-02-03 18:12:24 -080024 "@ctre_phoenix_api_cpp_athena//:shared_libraries",
25 "@ctre_phoenix_cci_athena//:shared_libraries",
26 "@ctre_phoenixpro_api_cpp_athena//:shared_libraries",
27 "@ctre_phoenixpro_tools_athena//:shared_libraries",
28 ],
29 dirs = [
30 "//y2023/www:www_files",
James Kuszmaul713c5ce2023-03-04 18:23:24 -080031 "//y2023/autonomous:splines",
Ravago Jones2060ee62023-02-03 18:12:24 -080032 ],
33 start_binaries = [
34 "//aos/events/logging:logger_main",
35 "//aos/network:web_proxy_main",
Xander Yee1ad2f7b2023-02-21 14:46:56 -080036 "//aos/starter:irq_affinity",
James Kuszmaul713c5ce2023-03-04 18:23:24 -080037 "//y2023/autonomous:binaries",
Ravago Jones2060ee62023-02-03 18:12:24 -080038 ":joystick_reader",
39 ":wpilib_interface",
Ravago Jones11472372023-03-04 15:57:56 -080040 "//frc971/can_logger",
Ravago Jones2060ee62023-02-03 18:12:24 -080041 "//aos/network:message_bridge_client",
42 "//aos/network:message_bridge_server",
43 "//y2023/control_loops/drivetrain:drivetrain",
44 "//y2023/control_loops/drivetrain:trajectory_generator",
45 "//y2023/control_loops/superstructure:superstructure",
46 ],
47 target_compatible_with = ["@platforms//os:linux"],
48)
49
50robot_downloader(
Austin Schuh9f164e92022-12-29 16:15:28 -080051 name = "pi_download",
52 binaries = [
James Kuszmaul7e958812023-02-11 15:34:31 -080053 "//frc971/vision:intrinsics_calibration",
Xander Yee1ad2f7b2023-02-21 14:46:56 -080054 "//aos/starter:irq_affinity",
James Kuszmaul77d536c2023-02-11 17:30:59 -080055 "//aos/util:foxglove_websocket",
Austin Schuh9f164e92022-12-29 16:15:28 -080056 "//y2023/vision:viewer",
milind-ud4051fe2023-02-25 18:00:05 -080057 "//y2023/vision:localization_verifier",
Maxwell Hendersonfebee252023-01-28 16:53:52 -080058 "//y2023/vision:aprilrobotics",
James Kuszmaule01ae1e2023-02-25 20:54:06 -080059 "//aos/events:aos_timing_report_streamer",
James Kuszmaul04a343c2023-02-20 16:38:22 -080060 "//y2023/localizer:localizer_main",
James Kuszmauld67f6d22023-02-05 17:37:25 -080061 "//y2023/constants:constants_sender",
James Kuszmaul77d536c2023-02-11 17:30:59 -080062 "//y2023/vision:foxglove_image_converter",
Maxwell Hendersonad312342023-01-10 12:07:47 -080063 "//aos/network:web_proxy_main",
Yash Chainani4b91ff12023-03-14 19:56:07 -070064 ":joystick_republish",
Austin Schuh9f164e92022-12-29 16:15:28 -080065 "//aos/events/logging:log_cat",
Austin Schuhb07dd5b2023-02-05 22:29:11 -080066 "//y2023/rockpi:imu_main",
milind-u8e98cb92023-02-05 16:07:10 -080067 "//frc971/image_streamer:image_streamer",
Austin Schuh9f164e92022-12-29 16:15:28 -080068 ],
69 data = [
70 ":aos_config",
James Kuszmaul08a4d852023-02-22 16:57:54 -080071 "//frc971/rockpi:rockpi_config.json",
James Kuszmauld67f6d22023-02-05 17:37:25 -080072 "//y2023/constants:constants.json",
milind-u8e98cb92023-02-05 16:07:10 -080073 "//y2023/vision:image_streamer_start",
James Kuszmauld67f6d22023-02-05 17:37:25 -080074 "//y2023/www:www_files",
Austin Schuh9f164e92022-12-29 16:15:28 -080075 ],
76 dirs = [
Maxwell Hendersonad312342023-01-10 12:07:47 -080077 "//y2023/www:www_files",
milind-u8e98cb92023-02-05 16:07:10 -080078 "//frc971/image_streamer/www:www_files",
Austin Schuh9f164e92022-12-29 16:15:28 -080079 ],
80 start_binaries = [
Austin Schuh9f164e92022-12-29 16:15:28 -080081 "//aos/network:message_bridge_client",
82 "//aos/network:message_bridge_server",
83 "//aos/network:web_proxy_main",
Austin Schuh3e1d3b62023-01-08 13:52:31 -080084 "//aos/starter:irq_affinity",
Austin Schuh9f164e92022-12-29 16:15:28 -080085 "//y2023/vision:camera_reader",
milind-ua96c5182023-03-10 23:31:11 -080086 "//y2023/vision:image_logger",
Maxwell Hendersonad312342023-01-10 12:07:47 -080087 "//aos/events/logging:logger_main",
Filip Kujawa3004f202023-02-12 16:41:40 -080088 "//y2023/vision:game_pieces_detector",
Austin Schuh9f164e92022-12-29 16:15:28 -080089 ],
90 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
91 target_type = "pi",
92)
93
94aos_config(
95 name = "aos_config",
96 src = "y2023.json",
97 flatbuffers = [
98 "//aos/network:message_bridge_client_fbs",
99 "//aos/network:message_bridge_server_fbs",
100 "//aos/network:timestamp_fbs",
101 "//frc971/input:robot_state_fbs",
102 "//frc971/vision:vision_fbs",
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800103 "//frc971/vision:target_map_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800104 ],
105 target_compatible_with = ["@platforms//os:linux"],
106 visibility = ["//visibility:public"],
107 deps = [
108 ":config_imu",
109 ":config_logger",
110 ":config_pi1",
111 ":config_pi2",
112 ":config_pi3",
113 ":config_pi4",
114 ":config_roborio",
115 ],
116)
117
118[
119 aos_config(
120 name = "config_" + pi,
121 src = "y2023_" + pi + ".json",
122 flatbuffers = [
123 "//aos/network:message_bridge_client_fbs",
124 "//aos/network:message_bridge_server_fbs",
125 "//aos/network:timestamp_fbs",
126 "//aos/network:remote_message_fbs",
James Kuszmauld67f6d22023-02-05 17:37:25 -0800127 "//y2023/constants:constants_fbs",
James Kuszmaule3df1ed2023-02-20 16:21:17 -0800128 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
milind-u2f101fc2023-01-21 12:28:49 -0800129 "//frc971/vision:calibration_fbs",
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800130 "//frc971/vision:target_map_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800131 "//frc971/vision:vision_fbs",
James Kuszmaul04a343c2023-02-20 16:38:22 -0800132 "//y2023/localizer:visualization_fbs",
Filip Kujawa3004f202023-02-12 16:41:40 -0800133 "//y2023/vision:game_pieces_fbs",
James Kuszmaulf3ec4db2023-02-12 14:18:41 -0800134 "@com_github_foxglove_schemas//:schemas",
Austin Schuh9f164e92022-12-29 16:15:28 -0800135 ],
136 target_compatible_with = ["@platforms//os:linux"],
137 visibility = ["//visibility:public"],
138 deps = [
139 "//aos/events:aos_config",
140 "//frc971/control_loops/drivetrain:aos_config",
141 "//frc971/input:aos_config",
142 ],
143 )
144 for pi in [
145 "pi1",
146 "pi2",
147 "pi3",
148 "pi4",
149 ]
150]
151
152aos_config(
153 name = "config_imu",
154 src = "y2023_imu.json",
155 flatbuffers = [
156 "//aos/network:message_bridge_client_fbs",
157 "//aos/network:message_bridge_server_fbs",
James Kuszmauld67f6d22023-02-05 17:37:25 -0800158 "//y2023/constants:constants_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800159 "//aos/network:timestamp_fbs",
160 "//aos/network:remote_message_fbs",
James Kuszmaul04a343c2023-02-20 16:38:22 -0800161 "//y2023/localizer:status_fbs",
James Kuszmaule3df1ed2023-02-20 16:21:17 -0800162 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
James Kuszmaul04a343c2023-02-20 16:38:22 -0800163 "//y2023/localizer:visualization_fbs",
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800164 "//frc971/vision:target_map_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800165 ],
166 target_compatible_with = ["@platforms//os:linux"],
167 visibility = ["//visibility:public"],
168 deps = [
169 "//aos/events:aos_config",
170 "//frc971/control_loops/drivetrain:aos_config",
171 ],
172)
173
174aos_config(
175 name = "config_logger",
176 src = "y2023_logger.json",
177 flatbuffers = [
178 "//aos/network:message_bridge_client_fbs",
179 "//aos/network:message_bridge_server_fbs",
180 "//aos/network:timestamp_fbs",
181 "//aos/network:remote_message_fbs",
milind-u2f101fc2023-01-21 12:28:49 -0800182 "//frc971/vision:calibration_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800183 "//frc971/vision:vision_fbs",
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800184 "//frc971/vision:target_map_fbs",
James Kuszmauld67f6d22023-02-05 17:37:25 -0800185 "//y2023/constants:constants_fbs",
Filip Kujawa3004f202023-02-12 16:41:40 -0800186 "//y2023/vision:game_pieces_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800187 ],
188 target_compatible_with = ["@platforms//os:linux"],
189 visibility = ["//visibility:public"],
190 deps = [
191 "//aos/events:aos_config",
192 "//frc971/control_loops/drivetrain:aos_config",
193 "//frc971/input:aos_config",
194 ],
195)
196
197aos_config(
198 name = "config_roborio",
199 src = "y2023_roborio.json",
200 flatbuffers = [
Austin Schuhbb4c9ac2023-02-28 22:04:20 -0800201 ":can_configuration_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800202 "//aos/network:remote_message_fbs",
203 "//aos/network:message_bridge_client_fbs",
204 "//aos/network:message_bridge_server_fbs",
James Kuszmauld67f6d22023-02-05 17:37:25 -0800205 "//y2023/constants:constants_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800206 "//aos/network:timestamp_fbs",
207 "//y2019/control_loops/drivetrain:target_selector_fbs",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800208 "//y2023/control_loops/superstructure:superstructure_goal_fbs",
James Kuszmauldb730d72023-02-25 16:01:27 -0800209 "//y2023/control_loops/drivetrain:target_selector_hint_fbs",
James Kuszmaul202e4382023-03-05 14:56:55 -0800210 "//y2023/control_loops/drivetrain:target_selector_status_fbs",
Ravago Jones2060ee62023-02-03 18:12:24 -0800211 "//y2023/control_loops/drivetrain:drivetrain_can_position_fbs",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800212 "//y2023/control_loops/superstructure:superstructure_output_fbs",
213 "//y2023/control_loops/superstructure:superstructure_position_fbs",
214 "//y2023/control_loops/superstructure:superstructure_status_fbs",
Ravago Jones11472372023-03-04 15:57:56 -0800215 "//frc971/can_logger:can_logging_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800216 ],
217 target_compatible_with = ["@platforms//os:linux"],
218 deps = [
219 "//aos/events:aos_config",
220 "//frc971/autonomous:aos_config",
221 "//frc971/control_loops/drivetrain:aos_config",
222 "//frc971/input:aos_config",
223 "//frc971/wpilib:aos_config",
224 ],
225)
226
227[
228 jinja2_template(
229 name = "y2023_pi" + str(num) + ".json",
230 src = "y2023_pi_template.json",
231 parameters = {"NUM": str(num)},
232 target_compatible_with = ["@platforms//os:linux"],
233 )
234 for num in range(1, 6)
235]
Maxwell Hendersonad312342023-01-10 12:07:47 -0800236
237cc_library(
238 name = "constants",
239 srcs = [
240 "constants.cc",
241 ],
242 hdrs = [
243 "constants.h",
244 ],
245 visibility = ["//visibility:public"],
246 deps = [
247 "//aos/mutex",
248 "//aos/network:team_number",
249 "//frc971:constants",
250 "//frc971/control_loops:pose",
251 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
252 "//frc971/shooter_interpolation:interpolation",
253 "//y2023/control_loops/drivetrain:polydrivetrain_plants",
milind-u37385182023-02-20 15:07:28 -0800254 "//y2023/control_loops/superstructure/arm:arm_constants",
milind-u051c7002023-02-20 16:28:18 -0800255 "//y2023/control_loops/superstructure/roll:roll_plants",
256 "//y2023/control_loops/superstructure/wrist:wrist_plants",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800257 "@com_github_google_glog//:glog",
258 "@com_google_absl//absl/base",
259 ],
260)
261
262cc_binary(
263 name = "wpilib_interface",
264 srcs = [
265 "wpilib_interface.cc",
266 ],
267 target_compatible_with = ["//tools/platforms/hardware:roborio"],
268 deps = [
Austin Schuhbb4c9ac2023-02-28 22:04:20 -0800269 ":can_configuration_fbs",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800270 ":constants",
271 "//aos:init",
272 "//aos:math",
Ravago Jones2060ee62023-02-03 18:12:24 -0800273 "//aos/containers:sized_array",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800274 "//aos/events:shm_event_loop",
275 "//aos/logging",
276 "//aos/stl_mutex",
277 "//aos/time",
278 "//aos/util:log_interval",
279 "//aos/util:phased_loop",
280 "//aos/util:wrapping_counter",
281 "//frc971/autonomous:auto_mode_fbs",
282 "//frc971/control_loops:control_loop",
283 "//frc971/control_loops:control_loops_fbs",
284 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
285 "//frc971/input:robot_state_fbs",
286 "//frc971/queues:gyro_fbs",
287 "//frc971/wpilib:ADIS16448",
288 "//frc971/wpilib:buffered_pcm",
289 "//frc971/wpilib:drivetrain_writer",
290 "//frc971/wpilib:encoder_and_potentiometer",
291 "//frc971/wpilib:interrupt_edge_counting",
292 "//frc971/wpilib:joystick_sender",
293 "//frc971/wpilib:logging_fbs",
294 "//frc971/wpilib:loop_output_handler",
295 "//frc971/wpilib:pdp_fetcher",
296 "//frc971/wpilib:sensor_reader",
297 "//frc971/wpilib:wpilib_interface",
298 "//frc971/wpilib:wpilib_robot_base",
299 "//third_party:phoenix",
Ravago Jones2060ee62023-02-03 18:12:24 -0800300 "//third_party:phoenixpro",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800301 "//third_party:wpilib",
Ravago Jones2060ee62023-02-03 18:12:24 -0800302 "//y2023/control_loops/drivetrain:drivetrain_can_position_fbs",
Maxwell Henderson2a2faa62023-03-11 15:05:46 -0800303 "//y2023/control_loops/superstructure:led_indicator_lib",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800304 "//y2023/control_loops/superstructure:superstructure_output_fbs",
305 "//y2023/control_loops/superstructure:superstructure_position_fbs",
306 ],
307)
308
309cc_binary(
310 name = "joystick_reader",
311 srcs = [
312 ":joystick_reader.cc",
313 ],
314 deps = [
315 ":constants",
316 "//aos:init",
317 "//aos/actions:action_lib",
318 "//aos/logging",
319 "//frc971/autonomous:auto_fbs",
320 "//frc971/autonomous:base_autonomous_actor",
321 "//frc971/control_loops:profiled_subsystem_fbs",
322 "//frc971/input:action_joystick_input",
323 "//frc971/input:drivetrain_input",
324 "//frc971/input:joystick_input",
325 "//y2023/control_loops/drivetrain:drivetrain_base",
James Kuszmaul4e171432023-02-26 13:39:37 -0800326 "//y2023/control_loops/drivetrain:target_selector_hint_fbs",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800327 "//y2023/control_loops/superstructure:superstructure_goal_fbs",
328 "//y2023/control_loops/superstructure:superstructure_status_fbs",
milind-udefab712023-02-20 22:22:02 -0800329 "//y2023/control_loops/superstructure/arm:generated_graph",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800330 ],
331)
332
Yash Chainani4b91ff12023-03-14 19:56:07 -0700333cc_binary(
334 name = "joystick_republish",
335 srcs = [
336 "joystick_republish.cc",
337 ],
338 target_compatible_with = ["@platforms//os:linux"],
339 visibility = ["//visibility:public"],
340 deps = [
341 "//aos:configuration",
342 "//aos:flatbuffer_merge",
343 "//aos:init",
344 "//aos/events:shm_event_loop",
345 "//frc971/input:joystick_state_fbs",
346 "@com_github_google_glog//:glog",
347 ],
348)
349
Maxwell Hendersonad312342023-01-10 12:07:47 -0800350py_library(
351 name = "python_init",
352 srcs = ["__init__.py"],
353 target_compatible_with = ["@platforms//os:linux"],
354 visibility = ["//visibility:public"],
355)
356
357sh_binary(
358 name = "log_web_proxy",
359 srcs = ["log_web_proxy.sh"],
360 data = [
361 ":aos_config",
362 "//aos/network:log_web_proxy_main",
363 "//y2023/www:field_main_bundle.min.js",
364 "//y2023/www:files",
365 ],
366 target_compatible_with = ["@platforms//os:linux"],
367)
Austin Schuhe6b2b882023-02-04 11:42:40 -0800368
369cc_binary(
370 name = "ssd_profiler",
371 srcs = [
372 "ssd_profiler.cc",
373 ],
374 deps = [
375 "//aos:init",
376 "//aos/time",
377 "@com_github_google_glog//:glog",
378 ],
379)
Austin Schuhbb4c9ac2023-02-28 22:04:20 -0800380
381flatbuffer_cc_library(
382 name = "can_configuration_fbs",
383 srcs = [
384 ":can_configuration.fbs",
385 ],
386 gen_reflections = 1,
387 visibility = ["//visibility:public"],
388)