blob: 8108a395626cf06240835c67221e40d8bb1e4807 [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",
40 "//aos/network:message_bridge_client",
41 "//aos/network:message_bridge_server",
42 "//y2023/control_loops/drivetrain:drivetrain",
43 "//y2023/control_loops/drivetrain:trajectory_generator",
44 "//y2023/control_loops/superstructure:superstructure",
45 ],
46 target_compatible_with = ["@platforms//os:linux"],
47)
48
49robot_downloader(
Austin Schuh9f164e92022-12-29 16:15:28 -080050 name = "pi_download",
51 binaries = [
James Kuszmaul7e958812023-02-11 15:34:31 -080052 "//frc971/vision:intrinsics_calibration",
Xander Yee1ad2f7b2023-02-21 14:46:56 -080053 "//aos/starter:irq_affinity",
James Kuszmaul77d536c2023-02-11 17:30:59 -080054 "//aos/util:foxglove_websocket",
Austin Schuh9f164e92022-12-29 16:15:28 -080055 "//y2023/vision:viewer",
milind-ud4051fe2023-02-25 18:00:05 -080056 "//y2023/vision:localization_verifier",
Maxwell Hendersonfebee252023-01-28 16:53:52 -080057 "//y2023/vision:aprilrobotics",
James Kuszmaule01ae1e2023-02-25 20:54:06 -080058 "//aos/events:aos_timing_report_streamer",
James Kuszmaul04a343c2023-02-20 16:38:22 -080059 "//y2023/localizer:localizer_main",
James Kuszmauld67f6d22023-02-05 17:37:25 -080060 "//y2023/constants:constants_sender",
James Kuszmaul77d536c2023-02-11 17:30:59 -080061 "//y2023/vision:foxglove_image_converter",
Maxwell Hendersonad312342023-01-10 12:07:47 -080062 "//aos/network:web_proxy_main",
Austin Schuh9f164e92022-12-29 16:15:28 -080063 "//aos/events/logging:log_cat",
Austin Schuhb07dd5b2023-02-05 22:29:11 -080064 "//y2023/rockpi:imu_main",
milind-u8e98cb92023-02-05 16:07:10 -080065 "//frc971/image_streamer:image_streamer",
Austin Schuh9f164e92022-12-29 16:15:28 -080066 ],
67 data = [
68 ":aos_config",
James Kuszmaul08a4d852023-02-22 16:57:54 -080069 "//frc971/rockpi:rockpi_config.json",
James Kuszmauld67f6d22023-02-05 17:37:25 -080070 "//y2023/constants:constants.json",
milind-u8e98cb92023-02-05 16:07:10 -080071 "//y2023/vision:image_streamer_start",
James Kuszmauld67f6d22023-02-05 17:37:25 -080072 "//y2023/www:www_files",
Austin Schuh9f164e92022-12-29 16:15:28 -080073 ],
74 dirs = [
Maxwell Hendersonad312342023-01-10 12:07:47 -080075 "//y2023/www:www_files",
milind-u8e98cb92023-02-05 16:07:10 -080076 "//frc971/image_streamer/www:www_files",
Austin Schuh9f164e92022-12-29 16:15:28 -080077 ],
78 start_binaries = [
Austin Schuh9f164e92022-12-29 16:15:28 -080079 "//aos/network:message_bridge_client",
80 "//aos/network:message_bridge_server",
81 "//aos/network:web_proxy_main",
Austin Schuh3e1d3b62023-01-08 13:52:31 -080082 "//aos/starter:irq_affinity",
Austin Schuh9f164e92022-12-29 16:15:28 -080083 "//y2023/vision:camera_reader",
Maxwell Hendersonad312342023-01-10 12:07:47 -080084 "//aos/events/logging:logger_main",
Filip Kujawa3004f202023-02-12 16:41:40 -080085 "//y2023/vision:game_pieces_detector",
Austin Schuh9f164e92022-12-29 16:15:28 -080086 ],
87 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
88 target_type = "pi",
89)
90
91aos_config(
92 name = "aos_config",
93 src = "y2023.json",
94 flatbuffers = [
95 "//aos/network:message_bridge_client_fbs",
96 "//aos/network:message_bridge_server_fbs",
97 "//aos/network:timestamp_fbs",
98 "//frc971/input:robot_state_fbs",
99 "//frc971/vision:vision_fbs",
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800100 "//frc971/vision:target_map_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800101 ],
102 target_compatible_with = ["@platforms//os:linux"],
103 visibility = ["//visibility:public"],
104 deps = [
105 ":config_imu",
106 ":config_logger",
107 ":config_pi1",
108 ":config_pi2",
109 ":config_pi3",
110 ":config_pi4",
111 ":config_roborio",
112 ],
113)
114
115[
116 aos_config(
117 name = "config_" + pi,
118 src = "y2023_" + pi + ".json",
119 flatbuffers = [
120 "//aos/network:message_bridge_client_fbs",
121 "//aos/network:message_bridge_server_fbs",
122 "//aos/network:timestamp_fbs",
123 "//aos/network:remote_message_fbs",
James Kuszmauld67f6d22023-02-05 17:37:25 -0800124 "//y2023/constants:constants_fbs",
James Kuszmaule3df1ed2023-02-20 16:21:17 -0800125 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
milind-u2f101fc2023-01-21 12:28:49 -0800126 "//frc971/vision:calibration_fbs",
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800127 "//frc971/vision:target_map_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800128 "//frc971/vision:vision_fbs",
James Kuszmaul04a343c2023-02-20 16:38:22 -0800129 "//y2023/localizer:visualization_fbs",
Filip Kujawa3004f202023-02-12 16:41:40 -0800130 "//y2023/vision:game_pieces_fbs",
James Kuszmaulf3ec4db2023-02-12 14:18:41 -0800131 "@com_github_foxglove_schemas//:schemas",
Austin Schuh9f164e92022-12-29 16:15:28 -0800132 ],
133 target_compatible_with = ["@platforms//os:linux"],
134 visibility = ["//visibility:public"],
135 deps = [
136 "//aos/events:aos_config",
137 "//frc971/control_loops/drivetrain:aos_config",
138 "//frc971/input:aos_config",
139 ],
140 )
141 for pi in [
142 "pi1",
143 "pi2",
144 "pi3",
145 "pi4",
146 ]
147]
148
149aos_config(
150 name = "config_imu",
151 src = "y2023_imu.json",
152 flatbuffers = [
153 "//aos/network:message_bridge_client_fbs",
154 "//aos/network:message_bridge_server_fbs",
James Kuszmauld67f6d22023-02-05 17:37:25 -0800155 "//y2023/constants:constants_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800156 "//aos/network:timestamp_fbs",
157 "//aos/network:remote_message_fbs",
James Kuszmaul04a343c2023-02-20 16:38:22 -0800158 "//y2023/localizer:status_fbs",
James Kuszmaule3df1ed2023-02-20 16:21:17 -0800159 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
James Kuszmaul04a343c2023-02-20 16:38:22 -0800160 "//y2023/localizer:visualization_fbs",
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800161 "//frc971/vision:target_map_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800162 ],
163 target_compatible_with = ["@platforms//os:linux"],
164 visibility = ["//visibility:public"],
165 deps = [
166 "//aos/events:aos_config",
167 "//frc971/control_loops/drivetrain:aos_config",
168 ],
169)
170
171aos_config(
172 name = "config_logger",
173 src = "y2023_logger.json",
174 flatbuffers = [
175 "//aos/network:message_bridge_client_fbs",
176 "//aos/network:message_bridge_server_fbs",
177 "//aos/network:timestamp_fbs",
178 "//aos/network:remote_message_fbs",
milind-u2f101fc2023-01-21 12:28:49 -0800179 "//frc971/vision:calibration_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800180 "//frc971/vision:vision_fbs",
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800181 "//frc971/vision:target_map_fbs",
James Kuszmauld67f6d22023-02-05 17:37:25 -0800182 "//y2023/constants:constants_fbs",
Filip Kujawa3004f202023-02-12 16:41:40 -0800183 "//y2023/vision:game_pieces_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800184 ],
185 target_compatible_with = ["@platforms//os:linux"],
186 visibility = ["//visibility:public"],
187 deps = [
188 "//aos/events:aos_config",
189 "//frc971/control_loops/drivetrain:aos_config",
190 "//frc971/input:aos_config",
191 ],
192)
193
194aos_config(
195 name = "config_roborio",
196 src = "y2023_roborio.json",
197 flatbuffers = [
Austin Schuhbb4c9ac2023-02-28 22:04:20 -0800198 ":can_configuration_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800199 "//aos/network:remote_message_fbs",
200 "//aos/network:message_bridge_client_fbs",
201 "//aos/network:message_bridge_server_fbs",
James Kuszmauld67f6d22023-02-05 17:37:25 -0800202 "//y2023/constants:constants_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800203 "//aos/network:timestamp_fbs",
204 "//y2019/control_loops/drivetrain:target_selector_fbs",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800205 "//y2023/control_loops/superstructure:superstructure_goal_fbs",
James Kuszmauldb730d72023-02-25 16:01:27 -0800206 "//y2023/control_loops/drivetrain:target_selector_hint_fbs",
Ravago Jones2060ee62023-02-03 18:12:24 -0800207 "//y2023/control_loops/drivetrain:drivetrain_can_position_fbs",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800208 "//y2023/control_loops/superstructure:superstructure_output_fbs",
209 "//y2023/control_loops/superstructure:superstructure_position_fbs",
210 "//y2023/control_loops/superstructure:superstructure_status_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800211 ],
212 target_compatible_with = ["@platforms//os:linux"],
213 deps = [
214 "//aos/events:aos_config",
215 "//frc971/autonomous:aos_config",
216 "//frc971/control_loops/drivetrain:aos_config",
217 "//frc971/input:aos_config",
218 "//frc971/wpilib:aos_config",
219 ],
220)
221
222[
223 jinja2_template(
224 name = "y2023_pi" + str(num) + ".json",
225 src = "y2023_pi_template.json",
226 parameters = {"NUM": str(num)},
227 target_compatible_with = ["@platforms//os:linux"],
228 )
229 for num in range(1, 6)
230]
Maxwell Hendersonad312342023-01-10 12:07:47 -0800231
232cc_library(
233 name = "constants",
234 srcs = [
235 "constants.cc",
236 ],
237 hdrs = [
238 "constants.h",
239 ],
240 visibility = ["//visibility:public"],
241 deps = [
242 "//aos/mutex",
243 "//aos/network:team_number",
244 "//frc971:constants",
245 "//frc971/control_loops:pose",
246 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
247 "//frc971/shooter_interpolation:interpolation",
248 "//y2023/control_loops/drivetrain:polydrivetrain_plants",
milind-u37385182023-02-20 15:07:28 -0800249 "//y2023/control_loops/superstructure/arm:arm_constants",
milind-u051c7002023-02-20 16:28:18 -0800250 "//y2023/control_loops/superstructure/roll:roll_plants",
251 "//y2023/control_loops/superstructure/wrist:wrist_plants",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800252 "@com_github_google_glog//:glog",
253 "@com_google_absl//absl/base",
254 ],
255)
256
257cc_binary(
258 name = "wpilib_interface",
259 srcs = [
260 "wpilib_interface.cc",
261 ],
262 target_compatible_with = ["//tools/platforms/hardware:roborio"],
263 deps = [
Austin Schuhbb4c9ac2023-02-28 22:04:20 -0800264 ":can_configuration_fbs",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800265 ":constants",
266 "//aos:init",
267 "//aos:math",
Ravago Jones2060ee62023-02-03 18:12:24 -0800268 "//aos/containers:sized_array",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800269 "//aos/events:shm_event_loop",
270 "//aos/logging",
271 "//aos/stl_mutex",
272 "//aos/time",
273 "//aos/util:log_interval",
274 "//aos/util:phased_loop",
275 "//aos/util:wrapping_counter",
276 "//frc971/autonomous:auto_mode_fbs",
277 "//frc971/control_loops:control_loop",
278 "//frc971/control_loops:control_loops_fbs",
279 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
280 "//frc971/input:robot_state_fbs",
281 "//frc971/queues:gyro_fbs",
282 "//frc971/wpilib:ADIS16448",
283 "//frc971/wpilib:buffered_pcm",
284 "//frc971/wpilib:drivetrain_writer",
285 "//frc971/wpilib:encoder_and_potentiometer",
286 "//frc971/wpilib:interrupt_edge_counting",
287 "//frc971/wpilib:joystick_sender",
288 "//frc971/wpilib:logging_fbs",
289 "//frc971/wpilib:loop_output_handler",
290 "//frc971/wpilib:pdp_fetcher",
291 "//frc971/wpilib:sensor_reader",
292 "//frc971/wpilib:wpilib_interface",
293 "//frc971/wpilib:wpilib_robot_base",
294 "//third_party:phoenix",
Ravago Jones2060ee62023-02-03 18:12:24 -0800295 "//third_party:phoenixpro",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800296 "//third_party:wpilib",
Ravago Jones2060ee62023-02-03 18:12:24 -0800297 "//y2023/control_loops/drivetrain:drivetrain_can_position_fbs",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800298 "//y2023/control_loops/superstructure:superstructure_output_fbs",
299 "//y2023/control_loops/superstructure:superstructure_position_fbs",
300 ],
301)
302
303cc_binary(
304 name = "joystick_reader",
305 srcs = [
306 ":joystick_reader.cc",
307 ],
308 deps = [
309 ":constants",
310 "//aos:init",
311 "//aos/actions:action_lib",
312 "//aos/logging",
313 "//frc971/autonomous:auto_fbs",
314 "//frc971/autonomous:base_autonomous_actor",
315 "//frc971/control_loops:profiled_subsystem_fbs",
316 "//frc971/input:action_joystick_input",
317 "//frc971/input:drivetrain_input",
318 "//frc971/input:joystick_input",
319 "//y2023/control_loops/drivetrain:drivetrain_base",
James Kuszmaul4e171432023-02-26 13:39:37 -0800320 "//y2023/control_loops/drivetrain:target_selector_hint_fbs",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800321 "//y2023/control_loops/superstructure:superstructure_goal_fbs",
322 "//y2023/control_loops/superstructure:superstructure_status_fbs",
milind-udefab712023-02-20 22:22:02 -0800323 "//y2023/control_loops/superstructure/arm:generated_graph",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800324 ],
325)
326
327py_library(
328 name = "python_init",
329 srcs = ["__init__.py"],
330 target_compatible_with = ["@platforms//os:linux"],
331 visibility = ["//visibility:public"],
332)
333
334sh_binary(
335 name = "log_web_proxy",
336 srcs = ["log_web_proxy.sh"],
337 data = [
338 ":aos_config",
339 "//aos/network:log_web_proxy_main",
340 "//y2023/www:field_main_bundle.min.js",
341 "//y2023/www:files",
342 ],
343 target_compatible_with = ["@platforms//os:linux"],
344)
Austin Schuhe6b2b882023-02-04 11:42:40 -0800345
346cc_binary(
347 name = "ssd_profiler",
348 srcs = [
349 "ssd_profiler.cc",
350 ],
351 deps = [
352 "//aos:init",
353 "//aos/time",
354 "@com_github_google_glog//:glog",
355 ],
356)
Austin Schuhbb4c9ac2023-02-28 22:04:20 -0800357
358flatbuffer_cc_library(
359 name = "can_configuration_fbs",
360 srcs = [
361 ":can_configuration.fbs",
362 ],
363 gen_reflections = 1,
364 visibility = ["//visibility:public"],
365)