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