blob: 9bbed4f882840323fcc5df09f62d5020f6915fe6 [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")
James Kuszmaulfa398af2023-05-16 20:27:39 -07004load("//aos/util:config_validator_macro.bzl", "config_validator_test")
milind-uc6e437a2023-03-01 23:40:40 -08005
James Kuszmaulfa398af2023-05-16 20:27:39 -07006config_validator_test(
milind-uc6e437a2023-03-01 23:40:40 -08007 name = "config_validator_test",
8 config = "//y2023:aos_config",
9)
Austin Schuh9f164e92022-12-29 16:15:28 -080010
11robot_downloader(
Ravago Jones2060ee62023-02-03 18:12:24 -080012 binaries = [
13 "//aos/network:web_proxy_main",
14 "//aos/events/logging:log_cat",
James Kuszmaule22680a2023-02-26 17:33:43 -080015 "//y2023/constants:constants_sender",
Austin Schuhd138e372023-02-23 21:43:53 -080016 "//aos/events:aos_timing_report_streamer",
Ravago Jones2060ee62023-02-03 18:12:24 -080017 ],
18 data = [
19 ":aos_config",
Xander Yee1ad2f7b2023-02-21 14:46:56 -080020 "//aos/starter:roborio_irq_config.json",
James Kuszmaule22680a2023-02-26 17:33:43 -080021 "//y2023/constants:constants.json",
Maxwell Hendersonb392b742023-03-05 07:53:51 -080022 "//y2023/control_loops/superstructure/arm:arm_trajectories_generated.bfbs",
Maxwell Hendersonfcc0d122023-08-05 17:03:34 -070023 "@ctre_phoenix6_api_cpp_athena//:shared_libraries",
24 "@ctre_phoenix6_tools_athena//:shared_libraries",
Ravago Jones2060ee62023-02-03 18:12:24 -080025 "@ctre_phoenix_api_cpp_athena//:shared_libraries",
26 "@ctre_phoenix_cci_athena//:shared_libraries",
Ravago Jones2060ee62023-02-03 18:12:24 -080027 ],
28 dirs = [
29 "//y2023/www:www_files",
James Kuszmaul713c5ce2023-03-04 18:23:24 -080030 "//y2023/autonomous:splines",
Ravago Jones2060ee62023-02-03 18:12:24 -080031 ],
32 start_binaries = [
33 "//aos/events/logging:logger_main",
34 "//aos/network:web_proxy_main",
Xander Yee1ad2f7b2023-02-21 14:46:56 -080035 "//aos/starter:irq_affinity",
James Kuszmaul713c5ce2023-03-04 18:23:24 -080036 "//y2023/autonomous:binaries",
Ravago Jones2060ee62023-02-03 18:12:24 -080037 ":joystick_reader",
38 ":wpilib_interface",
Ravago Jones11472372023-03-04 15:57:56 -080039 "//frc971/can_logger",
Ravago Jones2060ee62023-02-03 18:12:24 -080040 "//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",
James Kuszmaul910fbe42023-04-09 16:18:40 -070057 "//y2023/vision:camera_monitor",
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",
Filip Kujawaec433e12023-04-09 19:58:59 -070073 "//y2023/vision:game_pieces_detector_starter",
milind-u8e98cb92023-02-05 16:07:10 -080074 "//y2023/vision:image_streamer_start",
James Kuszmauld67f6d22023-02-05 17:37:25 -080075 "//y2023/www:www_files",
Filip Kujawa8c76e5d2023-04-08 16:20:27 -070076 "@game_pieces_edgetpu_model//file",
77 "@libedgetpu//:arm/libedgetpu.so.1",
78 "@libtensorflowlite//:arm/libtensorflowlite.so",
Austin Schuh9f164e92022-12-29 16:15:28 -080079 ],
80 dirs = [
Maxwell Hendersonad312342023-01-10 12:07:47 -080081 "//y2023/www:www_files",
milind-u8e98cb92023-02-05 16:07:10 -080082 "//frc971/image_streamer/www:www_files",
Austin Schuh9f164e92022-12-29 16:15:28 -080083 ],
84 start_binaries = [
Austin Schuh9f164e92022-12-29 16:15:28 -080085 "//aos/network:message_bridge_client",
86 "//aos/network:message_bridge_server",
87 "//aos/network:web_proxy_main",
Austin Schuh3e1d3b62023-01-08 13:52:31 -080088 "//aos/starter:irq_affinity",
Austin Schuh9f164e92022-12-29 16:15:28 -080089 "//y2023/vision:camera_reader",
milind-ua96c5182023-03-10 23:31:11 -080090 "//y2023/vision:image_logger",
Maxwell Hendersonad312342023-01-10 12:07:47 -080091 "//aos/events/logging:logger_main",
Filip Kujawa3004f202023-02-12 16:41:40 -080092 "//y2023/vision:game_pieces_detector",
Austin Schuh9f164e92022-12-29 16:15:28 -080093 ],
94 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
95 target_type = "pi",
96)
97
98aos_config(
99 name = "aos_config",
100 src = "y2023.json",
101 flatbuffers = [
102 "//aos/network:message_bridge_client_fbs",
103 "//aos/network:message_bridge_server_fbs",
104 "//aos/network:timestamp_fbs",
105 "//frc971/input:robot_state_fbs",
106 "//frc971/vision:vision_fbs",
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800107 "//frc971/vision:target_map_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800108 ],
109 target_compatible_with = ["@platforms//os:linux"],
110 visibility = ["//visibility:public"],
111 deps = [
112 ":config_imu",
113 ":config_logger",
114 ":config_pi1",
115 ":config_pi2",
116 ":config_pi3",
117 ":config_pi4",
118 ":config_roborio",
119 ],
120)
121
122[
123 aos_config(
124 name = "config_" + pi,
125 src = "y2023_" + pi + ".json",
126 flatbuffers = [
127 "//aos/network:message_bridge_client_fbs",
128 "//aos/network:message_bridge_server_fbs",
129 "//aos/network:timestamp_fbs",
130 "//aos/network:remote_message_fbs",
James Kuszmauld67f6d22023-02-05 17:37:25 -0800131 "//y2023/constants:constants_fbs",
James Kuszmaule3df1ed2023-02-20 16:21:17 -0800132 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
milind-u2f101fc2023-01-21 12:28:49 -0800133 "//frc971/vision:calibration_fbs",
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800134 "//frc971/vision:target_map_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800135 "//frc971/vision:vision_fbs",
James Kuszmaul04a343c2023-02-20 16:38:22 -0800136 "//y2023/localizer:visualization_fbs",
Filip Kujawa3004f202023-02-12 16:41:40 -0800137 "//y2023/vision:game_pieces_fbs",
James Kuszmaulf3ec4db2023-02-12 14:18:41 -0800138 "@com_github_foxglove_schemas//:schemas",
Austin Schuh9f164e92022-12-29 16:15:28 -0800139 ],
140 target_compatible_with = ["@platforms//os:linux"],
141 visibility = ["//visibility:public"],
142 deps = [
143 "//aos/events:aos_config",
144 "//frc971/control_loops/drivetrain:aos_config",
145 "//frc971/input:aos_config",
146 ],
147 )
148 for pi in [
149 "pi1",
150 "pi2",
151 "pi3",
152 "pi4",
153 ]
154]
155
156aos_config(
157 name = "config_imu",
158 src = "y2023_imu.json",
159 flatbuffers = [
160 "//aos/network:message_bridge_client_fbs",
161 "//aos/network:message_bridge_server_fbs",
James Kuszmauld67f6d22023-02-05 17:37:25 -0800162 "//y2023/constants:constants_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800163 "//aos/network:timestamp_fbs",
164 "//aos/network:remote_message_fbs",
James Kuszmaul04a343c2023-02-20 16:38:22 -0800165 "//y2023/localizer:status_fbs",
James Kuszmaule3df1ed2023-02-20 16:21:17 -0800166 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
James Kuszmaul04a343c2023-02-20 16:38:22 -0800167 "//y2023/localizer:visualization_fbs",
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800168 "//frc971/vision:target_map_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800169 ],
170 target_compatible_with = ["@platforms//os:linux"],
171 visibility = ["//visibility:public"],
172 deps = [
173 "//aos/events:aos_config",
174 "//frc971/control_loops/drivetrain:aos_config",
175 ],
176)
177
178aos_config(
179 name = "config_logger",
180 src = "y2023_logger.json",
181 flatbuffers = [
182 "//aos/network:message_bridge_client_fbs",
183 "//aos/network:message_bridge_server_fbs",
184 "//aos/network:timestamp_fbs",
185 "//aos/network:remote_message_fbs",
milind-u2f101fc2023-01-21 12:28:49 -0800186 "//frc971/vision:calibration_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800187 "//frc971/vision:vision_fbs",
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800188 "//frc971/vision:target_map_fbs",
James Kuszmauld67f6d22023-02-05 17:37:25 -0800189 "//y2023/constants:constants_fbs",
Filip Kujawa3004f202023-02-12 16:41:40 -0800190 "//y2023/vision:game_pieces_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800191 ],
192 target_compatible_with = ["@platforms//os:linux"],
193 visibility = ["//visibility:public"],
194 deps = [
195 "//aos/events:aos_config",
196 "//frc971/control_loops/drivetrain:aos_config",
197 "//frc971/input:aos_config",
198 ],
199)
200
201aos_config(
202 name = "config_roborio",
203 src = "y2023_roborio.json",
204 flatbuffers = [
Maxwell Hendersonf8c96892023-06-28 19:55:59 -0700205 "//frc971:can_configuration_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800206 "//aos/network:remote_message_fbs",
207 "//aos/network:message_bridge_client_fbs",
208 "//aos/network:message_bridge_server_fbs",
James Kuszmauld67f6d22023-02-05 17:37:25 -0800209 "//y2023/constants:constants_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800210 "//aos/network:timestamp_fbs",
211 "//y2019/control_loops/drivetrain:target_selector_fbs",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800212 "//y2023/control_loops/superstructure:superstructure_goal_fbs",
James Kuszmauldb730d72023-02-25 16:01:27 -0800213 "//y2023/control_loops/drivetrain:target_selector_hint_fbs",
James Kuszmaul202e4382023-03-05 14:56:55 -0800214 "//y2023/control_loops/drivetrain:target_selector_status_fbs",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700215 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800216 "//y2023/control_loops/superstructure:superstructure_output_fbs",
217 "//y2023/control_loops/superstructure:superstructure_position_fbs",
218 "//y2023/control_loops/superstructure:superstructure_status_fbs",
Ravago Jones11472372023-03-04 15:57:56 -0800219 "//frc971/can_logger:can_logging_fbs",
Austin Schuh9f164e92022-12-29 16:15:28 -0800220 ],
221 target_compatible_with = ["@platforms//os:linux"],
222 deps = [
223 "//aos/events:aos_config",
224 "//frc971/autonomous:aos_config",
225 "//frc971/control_loops/drivetrain:aos_config",
226 "//frc971/input:aos_config",
227 "//frc971/wpilib:aos_config",
228 ],
229)
230
231[
232 jinja2_template(
233 name = "y2023_pi" + str(num) + ".json",
234 src = "y2023_pi_template.json",
235 parameters = {"NUM": str(num)},
236 target_compatible_with = ["@platforms//os:linux"],
237 )
238 for num in range(1, 6)
239]
Maxwell Hendersonad312342023-01-10 12:07:47 -0800240
241cc_library(
242 name = "constants",
243 srcs = [
244 "constants.cc",
245 ],
246 hdrs = [
247 "constants.h",
248 ],
249 visibility = ["//visibility:public"],
250 deps = [
251 "//aos/mutex",
252 "//aos/network:team_number",
253 "//frc971:constants",
254 "//frc971/control_loops:pose",
255 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
256 "//frc971/shooter_interpolation:interpolation",
James Kuszmaulec635d22023-08-12 18:39:24 -0700257 "//frc971/zeroing:absolute_encoder",
258 "//frc971/zeroing:pot_and_absolute_encoder",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800259 "//y2023/control_loops/drivetrain:polydrivetrain_plants",
milind-u37385182023-02-20 15:07:28 -0800260 "//y2023/control_loops/superstructure/arm:arm_constants",
milind-u051c7002023-02-20 16:28:18 -0800261 "//y2023/control_loops/superstructure/roll:roll_plants",
262 "//y2023/control_loops/superstructure/wrist:wrist_plants",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800263 "@com_github_google_glog//:glog",
264 "@com_google_absl//absl/base",
265 ],
266)
267
268cc_binary(
269 name = "wpilib_interface",
270 srcs = [
271 "wpilib_interface.cc",
272 ],
273 target_compatible_with = ["//tools/platforms/hardware:roborio"],
274 deps = [
275 ":constants",
276 "//aos:init",
277 "//aos:math",
Ravago Jones2060ee62023-02-03 18:12:24 -0800278 "//aos/containers:sized_array",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800279 "//aos/events:shm_event_loop",
280 "//aos/logging",
281 "//aos/stl_mutex",
282 "//aos/time",
283 "//aos/util:log_interval",
284 "//aos/util:phased_loop",
285 "//aos/util:wrapping_counter",
Maxwell Hendersonf8c96892023-06-28 19:55:59 -0700286 "//frc971:can_configuration_fbs",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800287 "//frc971/autonomous:auto_mode_fbs",
James Kuszmaul630ab1d2024-01-09 16:38:57 -0800288 "//frc971/constants:constants_sender_lib",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800289 "//frc971/control_loops:control_loop",
290 "//frc971/control_loops:control_loops_fbs",
Maxwell Hendersoncef6f042023-05-26 14:38:09 -0700291 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800292 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
293 "//frc971/input:robot_state_fbs",
294 "//frc971/queues:gyro_fbs",
295 "//frc971/wpilib:ADIS16448",
296 "//frc971/wpilib:buffered_pcm",
297 "//frc971/wpilib:drivetrain_writer",
298 "//frc971/wpilib:encoder_and_potentiometer",
299 "//frc971/wpilib:interrupt_edge_counting",
300 "//frc971/wpilib:joystick_sender",
301 "//frc971/wpilib:logging_fbs",
302 "//frc971/wpilib:loop_output_handler",
303 "//frc971/wpilib:pdp_fetcher",
304 "//frc971/wpilib:sensor_reader",
305 "//frc971/wpilib:wpilib_interface",
306 "//frc971/wpilib:wpilib_robot_base",
307 "//third_party:phoenix",
Maxwell Hendersonfcc0d122023-08-05 17:03:34 -0700308 "//third_party:phoenix6",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800309 "//third_party:wpilib",
James Kuszmaul630ab1d2024-01-09 16:38:57 -0800310 "//y2023/constants:constants_fbs",
Maxwell Henderson2a2faa62023-03-11 15:05:46 -0800311 "//y2023/control_loops/superstructure:led_indicator_lib",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800312 "//y2023/control_loops/superstructure:superstructure_output_fbs",
313 "//y2023/control_loops/superstructure:superstructure_position_fbs",
314 ],
315)
316
317cc_binary(
318 name = "joystick_reader",
319 srcs = [
320 ":joystick_reader.cc",
321 ],
322 deps = [
323 ":constants",
324 "//aos:init",
325 "//aos/actions:action_lib",
326 "//aos/logging",
327 "//frc971/autonomous:auto_fbs",
328 "//frc971/autonomous:base_autonomous_actor",
329 "//frc971/control_loops:profiled_subsystem_fbs",
330 "//frc971/input:action_joystick_input",
331 "//frc971/input:drivetrain_input",
332 "//frc971/input:joystick_input",
Ravago Jones8c65c432023-03-25 17:35:39 -0700333 "//frc971/input:redundant_joystick_data",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800334 "//y2023/control_loops/drivetrain:drivetrain_base",
James Kuszmaul4e171432023-02-26 13:39:37 -0800335 "//y2023/control_loops/drivetrain:target_selector_hint_fbs",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800336 "//y2023/control_loops/superstructure:superstructure_goal_fbs",
337 "//y2023/control_loops/superstructure:superstructure_status_fbs",
milind-udefab712023-02-20 22:22:02 -0800338 "//y2023/control_loops/superstructure/arm:generated_graph",
Maxwell Hendersonad312342023-01-10 12:07:47 -0800339 ],
340)
341
Yash Chainani4b91ff12023-03-14 19:56:07 -0700342cc_binary(
343 name = "joystick_republish",
344 srcs = [
345 "joystick_republish.cc",
346 ],
347 target_compatible_with = ["@platforms//os:linux"],
348 visibility = ["//visibility:public"],
349 deps = [
350 "//aos:configuration",
351 "//aos:flatbuffer_merge",
352 "//aos:init",
353 "//aos/events:shm_event_loop",
354 "//frc971/input:joystick_state_fbs",
355 "@com_github_google_glog//:glog",
356 ],
357)
358
Maxwell Hendersonad312342023-01-10 12:07:47 -0800359py_library(
360 name = "python_init",
361 srcs = ["__init__.py"],
362 target_compatible_with = ["@platforms//os:linux"],
363 visibility = ["//visibility:public"],
364)
365
366sh_binary(
367 name = "log_web_proxy",
368 srcs = ["log_web_proxy.sh"],
369 data = [
370 ":aos_config",
371 "//aos/network:log_web_proxy_main",
372 "//y2023/www:field_main_bundle.min.js",
373 "//y2023/www:files",
374 ],
375 target_compatible_with = ["@platforms//os:linux"],
376)