blob: f055fe4f306e1a7feb33dbb7b5efb6438869466c [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")
Austin Schuh9f164e92022-12-29 16:15:28 -08005
6robot_downloader(
Ravago Jones2060ee62023-02-03 18:12:24 -08007 binaries = [
8 "//aos/network:web_proxy_main",
9 "//aos/events/logging:log_cat",
James Kuszmaule22680a2023-02-26 17:33:43 -080010 "//y2023/constants:constants_sender",
Austin Schuhd138e372023-02-23 21:43:53 -080011 "//aos/events:aos_timing_report_streamer",
Ravago Jones2060ee62023-02-03 18:12:24 -080012 ],
13 data = [
14 ":aos_config",
Xander Yee1ad2f7b2023-02-21 14:46:56 -080015 "//aos/starter:roborio_irq_config.json",
James Kuszmaule22680a2023-02-26 17:33:43 -080016 "//y2023/constants:constants.json",
Ravago Jones2060ee62023-02-03 18:12:24 -080017 "@ctre_phoenix_api_cpp_athena//:shared_libraries",
18 "@ctre_phoenix_cci_athena//:shared_libraries",
19 "@ctre_phoenixpro_api_cpp_athena//:shared_libraries",
20 "@ctre_phoenixpro_tools_athena//:shared_libraries",
21 ],
22 dirs = [
23 "//y2023/www:www_files",
24 ],
25 start_binaries = [
26 "//aos/events/logging:logger_main",
27 "//aos/network:web_proxy_main",
Xander Yee1ad2f7b2023-02-21 14:46:56 -080028 "//aos/starter:irq_affinity",
Ravago Jones2060ee62023-02-03 18:12:24 -080029 ":joystick_reader",
30 ":wpilib_interface",
31 "//aos/network:message_bridge_client",
32 "//aos/network:message_bridge_server",
33 "//y2023/control_loops/drivetrain:drivetrain",
34 "//y2023/control_loops/drivetrain:trajectory_generator",
35 "//y2023/control_loops/superstructure:superstructure",
36 ],
37 target_compatible_with = ["@platforms//os:linux"],
38)
39
40robot_downloader(
Austin Schuh9f164e92022-12-29 16:15:28 -080041 name = "pi_download",
42 binaries = [
James Kuszmaul7e958812023-02-11 15:34:31 -080043 "//frc971/vision:intrinsics_calibration",
Xander Yee1ad2f7b2023-02-21 14:46:56 -080044 "//aos/starter:irq_affinity",
James Kuszmaul77d536c2023-02-11 17:30:59 -080045 "//aos/util:foxglove_websocket",
Austin Schuh9f164e92022-12-29 16:15:28 -080046 "//y2023/vision:viewer",
milind-ud4051fe2023-02-25 18:00:05 -080047 "//y2023/vision:localization_verifier",
Maxwell Hendersonfebee252023-01-28 16:53:52 -080048 "//y2023/vision:aprilrobotics",
James Kuszmaule01ae1e2023-02-25 20:54:06 -080049 "//aos/events:aos_timing_report_streamer",
James Kuszmaul04a343c2023-02-20 16:38:22 -080050 "//y2023/localizer:localizer_main",
James Kuszmauld67f6d22023-02-05 17:37:25 -080051 "//y2023/constants:constants_sender",
James Kuszmaul77d536c2023-02-11 17:30:59 -080052 "//y2023/vision:foxglove_image_converter",
Maxwell Hendersonad312342023-01-10 12:07:47 -080053 "//aos/network:web_proxy_main",
Austin Schuh9f164e92022-12-29 16:15:28 -080054 "//aos/events/logging:log_cat",
Austin Schuhb07dd5b2023-02-05 22:29:11 -080055 "//y2023/rockpi:imu_main",
milind-u8e98cb92023-02-05 16:07:10 -080056 "//frc971/image_streamer:image_streamer",
Austin Schuh9f164e92022-12-29 16:15:28 -080057 ],
58 data = [
59 ":aos_config",
James Kuszmaul08a4d852023-02-22 16:57:54 -080060 "//frc971/rockpi:rockpi_config.json",
James Kuszmauld67f6d22023-02-05 17:37:25 -080061 "//y2023/constants:constants.json",
milind-u8e98cb92023-02-05 16:07:10 -080062 "//y2023/vision:image_streamer_start",
James Kuszmauld67f6d22023-02-05 17:37:25 -080063 "//y2023/www:www_files",
Austin Schuh9f164e92022-12-29 16:15:28 -080064 ],
65 dirs = [
Maxwell Hendersonad312342023-01-10 12:07:47 -080066 "//y2023/www:www_files",
milind-u8e98cb92023-02-05 16:07:10 -080067 "//frc971/image_streamer/www:www_files",
Austin Schuh9f164e92022-12-29 16:15:28 -080068 ],
69 start_binaries = [
Austin Schuh9f164e92022-12-29 16:15:28 -080070 "//aos/network:message_bridge_client",
71 "//aos/network:message_bridge_server",
72 "//aos/network:web_proxy_main",
Austin Schuh3e1d3b62023-01-08 13:52:31 -080073 "//aos/starter:irq_affinity",
Austin Schuh9f164e92022-12-29 16:15:28 -080074 "//y2023/vision:camera_reader",
Maxwell Hendersonad312342023-01-10 12:07:47 -080075 "//aos/events/logging:logger_main",
Filip Kujawa3004f202023-02-12 16:41:40 -080076 "//y2023/vision:game_pieces_detector",
Austin Schuh9f164e92022-12-29 16:15:28 -080077 ],
78 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
79 target_type = "pi",
80)
81
82aos_config(
83 name = "aos_config",
84 src = "y2023.json",
85 flatbuffers = [
86 "//aos/network:message_bridge_client_fbs",
87 "//aos/network:message_bridge_server_fbs",
88 "//aos/network:timestamp_fbs",
89 "//frc971/input:robot_state_fbs",
90 "//frc971/vision:vision_fbs",
Maxwell Hendersonfebee252023-01-28 16:53:52 -080091 "//frc971/vision:target_map_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -080092 ],
93 target_compatible_with = ["@platforms//os:linux"],
94 visibility = ["//visibility:public"],
95 deps = [
96 ":config_imu",
97 ":config_logger",
98 ":config_pi1",
99 ":config_pi2",
100 ":config_pi3",
101 ":config_pi4",
102 ":config_roborio",
103 ],
104)
105
106[
107 aos_config(
108 name = "config_" + pi,
109 src = "y2023_" + pi + ".json",
110 flatbuffers = [
111 "//aos/network:message_bridge_client_fbs",
112 "//aos/network:message_bridge_server_fbs",
113 "//aos/network:timestamp_fbs",
114 "//aos/network:remote_message_fbs",
James Kuszmauld67f6d22023-02-05 17:37:25 -0800115 "//y2023/constants:constants_fbs",
James Kuszmaule3df1ed2023-02-20 16:21:17 -0800116 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
milind-u2f101fc2023-01-21 12:28:49 -0800117 "//frc971/vision:calibration_fbs",
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800118 "//frc971/vision:target_map_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800119 "//frc971/vision:vision_fbs",
James Kuszmaul04a343c2023-02-20 16:38:22 -0800120 "//y2023/localizer:visualization_fbs",
Filip Kujawa3004f202023-02-12 16:41:40 -0800121 "//y2023/vision:game_pieces_fbs",
James Kuszmaulf3ec4db2023-02-12 14:18:41 -0800122 "@com_github_foxglove_schemas//:schemas",
Austin Schuh9f164e92022-12-29 16:15:28 -0800123 ],
124 target_compatible_with = ["@platforms//os:linux"],
125 visibility = ["//visibility:public"],
126 deps = [
127 "//aos/events:aos_config",
128 "//frc971/control_loops/drivetrain:aos_config",
129 "//frc971/input:aos_config",
130 ],
131 )
132 for pi in [
133 "pi1",
134 "pi2",
135 "pi3",
136 "pi4",
137 ]
138]
139
140aos_config(
141 name = "config_imu",
142 src = "y2023_imu.json",
143 flatbuffers = [
144 "//aos/network:message_bridge_client_fbs",
145 "//aos/network:message_bridge_server_fbs",
James Kuszmauld67f6d22023-02-05 17:37:25 -0800146 "//y2023/constants:constants_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800147 "//aos/network:timestamp_fbs",
148 "//aos/network:remote_message_fbs",
James Kuszmaul04a343c2023-02-20 16:38:22 -0800149 "//y2023/localizer:status_fbs",
James Kuszmaule3df1ed2023-02-20 16:21:17 -0800150 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
James Kuszmaul04a343c2023-02-20 16:38:22 -0800151 "//y2023/localizer:visualization_fbs",
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800152 "//frc971/vision:target_map_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800153 ],
154 target_compatible_with = ["@platforms//os:linux"],
155 visibility = ["//visibility:public"],
156 deps = [
157 "//aos/events:aos_config",
158 "//frc971/control_loops/drivetrain:aos_config",
159 ],
160)
161
162aos_config(
163 name = "config_logger",
164 src = "y2023_logger.json",
165 flatbuffers = [
166 "//aos/network:message_bridge_client_fbs",
167 "//aos/network:message_bridge_server_fbs",
168 "//aos/network:timestamp_fbs",
169 "//aos/network:remote_message_fbs",
milind-u2f101fc2023-01-21 12:28:49 -0800170 "//frc971/vision:calibration_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800171 "//frc971/vision:vision_fbs",
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800172 "//frc971/vision:target_map_fbs",
James Kuszmauld67f6d22023-02-05 17:37:25 -0800173 "//y2023/constants:constants_fbs",
Filip Kujawa3004f202023-02-12 16:41:40 -0800174 "//y2023/vision:game_pieces_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800175 ],
176 target_compatible_with = ["@platforms//os:linux"],
177 visibility = ["//visibility:public"],
178 deps = [
179 "//aos/events:aos_config",
180 "//frc971/control_loops/drivetrain:aos_config",
181 "//frc971/input:aos_config",
182 ],
183)
184
185aos_config(
186 name = "config_roborio",
187 src = "y2023_roborio.json",
188 flatbuffers = [
Austin Schuhbb4c9ac2023-02-28 22:04:20 -0800189 ":can_configuration_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800190 "//aos/network:remote_message_fbs",
191 "//aos/network:message_bridge_client_fbs",
192 "//aos/network:message_bridge_server_fbs",
James Kuszmauld67f6d22023-02-05 17:37:25 -0800193 "//y2023/constants:constants_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800194 "//aos/network:timestamp_fbs",
195 "//y2019/control_loops/drivetrain:target_selector_fbs",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800196 "//y2023/control_loops/superstructure:superstructure_goal_fbs",
James Kuszmauldb730d72023-02-25 16:01:27 -0800197 "//y2023/control_loops/drivetrain:target_selector_hint_fbs",
Ravago Jones2060ee62023-02-03 18:12:24 -0800198 "//y2023/control_loops/drivetrain:drivetrain_can_position_fbs",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800199 "//y2023/control_loops/superstructure:superstructure_output_fbs",
200 "//y2023/control_loops/superstructure:superstructure_position_fbs",
201 "//y2023/control_loops/superstructure:superstructure_status_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800202 ],
203 target_compatible_with = ["@platforms//os:linux"],
204 deps = [
205 "//aos/events:aos_config",
206 "//frc971/autonomous:aos_config",
207 "//frc971/control_loops/drivetrain:aos_config",
208 "//frc971/input:aos_config",
209 "//frc971/wpilib:aos_config",
210 ],
211)
212
213[
214 jinja2_template(
215 name = "y2023_pi" + str(num) + ".json",
216 src = "y2023_pi_template.json",
217 parameters = {"NUM": str(num)},
218 target_compatible_with = ["@platforms//os:linux"],
219 )
220 for num in range(1, 6)
221]
Maxwell Hendersonad312342023-01-10 12:07:47 -0800222
223cc_library(
224 name = "constants",
225 srcs = [
226 "constants.cc",
227 ],
228 hdrs = [
229 "constants.h",
230 ],
231 visibility = ["//visibility:public"],
232 deps = [
233 "//aos/mutex",
234 "//aos/network:team_number",
235 "//frc971:constants",
236 "//frc971/control_loops:pose",
237 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
238 "//frc971/shooter_interpolation:interpolation",
239 "//y2023/control_loops/drivetrain:polydrivetrain_plants",
milind-u37385182023-02-20 15:07:28 -0800240 "//y2023/control_loops/superstructure/arm:arm_constants",
milind-u051c7002023-02-20 16:28:18 -0800241 "//y2023/control_loops/superstructure/roll:roll_plants",
242 "//y2023/control_loops/superstructure/wrist:wrist_plants",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800243 "@com_github_google_glog//:glog",
244 "@com_google_absl//absl/base",
245 ],
246)
247
248cc_binary(
249 name = "wpilib_interface",
250 srcs = [
251 "wpilib_interface.cc",
252 ],
253 target_compatible_with = ["//tools/platforms/hardware:roborio"],
254 deps = [
Austin Schuhbb4c9ac2023-02-28 22:04:20 -0800255 ":can_configuration_fbs",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800256 ":constants",
257 "//aos:init",
258 "//aos:math",
Ravago Jones2060ee62023-02-03 18:12:24 -0800259 "//aos/containers:sized_array",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800260 "//aos/events:shm_event_loop",
261 "//aos/logging",
262 "//aos/stl_mutex",
263 "//aos/time",
264 "//aos/util:log_interval",
265 "//aos/util:phased_loop",
266 "//aos/util:wrapping_counter",
267 "//frc971/autonomous:auto_mode_fbs",
268 "//frc971/control_loops:control_loop",
269 "//frc971/control_loops:control_loops_fbs",
270 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
271 "//frc971/input:robot_state_fbs",
272 "//frc971/queues:gyro_fbs",
273 "//frc971/wpilib:ADIS16448",
274 "//frc971/wpilib:buffered_pcm",
275 "//frc971/wpilib:drivetrain_writer",
276 "//frc971/wpilib:encoder_and_potentiometer",
277 "//frc971/wpilib:interrupt_edge_counting",
278 "//frc971/wpilib:joystick_sender",
279 "//frc971/wpilib:logging_fbs",
280 "//frc971/wpilib:loop_output_handler",
281 "//frc971/wpilib:pdp_fetcher",
282 "//frc971/wpilib:sensor_reader",
283 "//frc971/wpilib:wpilib_interface",
284 "//frc971/wpilib:wpilib_robot_base",
285 "//third_party:phoenix",
Ravago Jones2060ee62023-02-03 18:12:24 -0800286 "//third_party:phoenixpro",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800287 "//third_party:wpilib",
Ravago Jones2060ee62023-02-03 18:12:24 -0800288 "//y2023/control_loops/drivetrain:drivetrain_can_position_fbs",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800289 "//y2023/control_loops/superstructure:superstructure_output_fbs",
290 "//y2023/control_loops/superstructure:superstructure_position_fbs",
291 ],
292)
293
294cc_binary(
295 name = "joystick_reader",
296 srcs = [
297 ":joystick_reader.cc",
298 ],
299 deps = [
300 ":constants",
301 "//aos:init",
302 "//aos/actions:action_lib",
303 "//aos/logging",
304 "//frc971/autonomous:auto_fbs",
305 "//frc971/autonomous:base_autonomous_actor",
306 "//frc971/control_loops:profiled_subsystem_fbs",
307 "//frc971/input:action_joystick_input",
308 "//frc971/input:drivetrain_input",
309 "//frc971/input:joystick_input",
310 "//y2023/control_loops/drivetrain:drivetrain_base",
311 "//y2023/control_loops/superstructure:superstructure_goal_fbs",
312 "//y2023/control_loops/superstructure:superstructure_status_fbs",
milind-udefab712023-02-20 22:22:02 -0800313 "//y2023/control_loops/superstructure/arm:generated_graph",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800314 ],
315)
316
317py_library(
318 name = "python_init",
319 srcs = ["__init__.py"],
320 target_compatible_with = ["@platforms//os:linux"],
321 visibility = ["//visibility:public"],
322)
323
324sh_binary(
325 name = "log_web_proxy",
326 srcs = ["log_web_proxy.sh"],
327 data = [
328 ":aos_config",
329 "//aos/network:log_web_proxy_main",
330 "//y2023/www:field_main_bundle.min.js",
331 "//y2023/www:files",
332 ],
333 target_compatible_with = ["@platforms//os:linux"],
334)
Austin Schuhe6b2b882023-02-04 11:42:40 -0800335
336cc_binary(
337 name = "ssd_profiler",
338 srcs = [
339 "ssd_profiler.cc",
340 ],
341 deps = [
342 "//aos:init",
343 "//aos/time",
344 "@com_github_google_glog//:glog",
345 ],
346)
Austin Schuhbb4c9ac2023-02-28 22:04:20 -0800347
348flatbuffer_cc_library(
349 name = "can_configuration_fbs",
350 srcs = [
351 ":can_configuration.fbs",
352 ],
353 gen_reflections = 1,
354 visibility = ["//visibility:public"],
355)