blob: bba7b51c5cfe09a6766d2d8c0cf66b1cf0e698b5 [file] [log] [blame]
Niko Sohmers3860f8a2024-01-12 21:05:19 -08001load("//frc971:downloader.bzl", "robot_downloader")
2load("//aos:config.bzl", "aos_config")
Maxwell Henderson440e3f12024-01-17 19:44:13 -08003load("//tools/build_rules:template.bzl", "jinja2_template")
Niko Sohmers3860f8a2024-01-12 21:05:19 -08004load("//aos/util:config_validator_macro.bzl", "config_validator_test")
5
6config_validator_test(
7 name = "config_validator_test",
8 config = "//y2024:aos_config",
9)
10
11robot_downloader(
12 binaries = [
13 "//aos/network:web_proxy_main",
14 "//aos/events/logging:log_cat",
15 "//y2024/constants:constants_sender",
16 "//aos/events:aos_timing_report_streamer",
17 ],
18 data = [
19 ":aos_config",
20 "//aos/starter:roborio_irq_config.json",
21 "//y2024/constants:constants.json",
Maxwell Henderson7be07d52024-02-20 07:59:16 -080022 "@ctre_phoenix6_api_cpp_athena//:shared_libraries",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080023 "@ctre_phoenix6_tools_athena//:shared_libraries",
Maxwell Henderson7be07d52024-02-20 07:59:16 -080024 "@ctre_phoenix_api_cpp_athena//:shared_libraries",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080025 "@ctre_phoenix_cci_athena//:shared_libraries",
26 ],
27 dirs = [
28 "//y2024/www:www_files",
29 "//y2024/autonomous:splines",
30 ],
31 start_binaries = [
32 "//aos/events/logging:logger_main",
33 "//aos/network:web_proxy_main",
34 "//aos/starter:irq_affinity",
35 "//y2024/autonomous:binaries",
36 ":joystick_reader",
37 ":wpilib_interface",
38 "//frc971/can_logger",
39 "//aos/network:message_bridge_client",
40 "//aos/network:message_bridge_server",
41 "//y2024/control_loops/drivetrain:drivetrain",
42 "//y2024/control_loops/drivetrain:trajectory_generator",
43 "//y2024/control_loops/superstructure:superstructure",
44 ],
45 target_compatible_with = ["@platforms//os:linux"],
46)
47
48robot_downloader(
49 name = "orin_download",
50 binaries = [
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080051 ":joystick_republish",
52 "//aos/events:aos_timing_report_streamer",
53 "//aos/events/logging:log_cat",
54 "//aos/network:web_proxy_main",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080055 "//aos/starter:irq_affinity",
56 "//aos/util:foxglove_websocket",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080057 "//frc971/image_streamer:image_streamer",
Jim Ostrowskicb8b4082024-01-21 02:23:46 -080058 "//frc971/vision:intrinsics_calibration",
Jim Ostrowski9bf206a2024-01-26 23:31:58 -080059 "//y2024/vision:viewer",
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080060 "//y2024/constants:constants_sender",
James Kuszmaul313e9ce2024-02-11 17:47:33 -080061 "//y2024/localizer:localizer_main",
James Kuszmaulecafe1f2024-02-27 20:29:53 -080062 "//y2024/localizer:localizer_logger",
Jim Ostrowski855b7442024-01-20 18:03:09 -080063 "//y2024/vision:foxglove_image_converter",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080064 ],
65 data = [
66 ":aos_config",
Jim Ostrowski855b7442024-01-20 18:03:09 -080067 "//frc971/rockpi:rockpi_config.json",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080068 "//y2024/constants:constants.json",
69 "//y2024/vision:image_streamer_start",
70 "//y2024/www:www_files",
71 ],
72 dirs = [
73 "//y2024/www:www_files",
74 "//frc971/image_streamer/www:www_files",
75 ],
76 start_binaries = [
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080077 "//aos/events/logging:logger_main",
Maxwell Henderson4f35c832024-02-11 15:40:30 -080078 "//frc971/imu_fdcan:can_translator",
Maxwell Henderson87b1e6c2024-02-11 23:40:05 -080079 "//frc971/imu_fdcan:dual_imu_blender",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080080 "//aos/network:message_bridge_client",
81 "//aos/network:message_bridge_server",
82 "//aos/network:web_proxy_main",
83 "//aos/starter:irq_affinity",
Maxwell Henderson440e3f12024-01-17 19:44:13 -080084 "//frc971/orin:argus_camera",
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080085 "//y2024/orin:can_logger",
Jim Ostrowskicb8b4082024-01-21 02:23:46 -080086 "//y2024/vision:apriltag_detector",
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080087 "//y2024/vision:image_logger",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080088 ],
89 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
Maxwell Hendersone5d758f2024-01-20 13:30:42 -080090 target_type = "pi",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080091)
92
93aos_config(
94 name = "aos_config",
95 src = "y2024.json",
96 flatbuffers = [
97 "//aos/network:message_bridge_client_fbs",
98 "//aos/network:message_bridge_server_fbs",
99 "//aos/network:timestamp_fbs",
100 "//frc971/input:robot_state_fbs",
101 "//frc971/vision:vision_fbs",
102 "//frc971/vision:target_map_fbs",
103 ],
104 target_compatible_with = ["@platforms//os:linux"],
105 visibility = ["//visibility:public"],
106 deps = [
107 ":config_imu",
Maxwell Henderson440e3f12024-01-17 19:44:13 -0800108 ":config_orin1",
109 ":config_orin2",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800110 ":config_roborio",
111 ],
112)
113
114aos_config(
115 name = "config_imu",
116 src = "y2024_imu.json",
117 flatbuffers = [
118 "//aos/network:message_bridge_client_fbs",
119 "//aos/network:message_bridge_server_fbs",
Maxwell Henderson4f35c832024-02-11 15:40:30 -0800120 "//frc971/imu_fdcan:dual_imu_fbs",
121 "//frc971/imu_fdcan:can_translator_status_fbs",
Maxwell Henderson87b1e6c2024-02-11 23:40:05 -0800122 "//frc971/imu_fdcan:dual_imu_blender_status_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800123 "//y2024/constants:constants_fbs",
Maxwell Henderson563efed2024-02-17 21:11:33 -0800124 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
Maxwell Henderson0604e6f2024-01-15 15:24:44 -0800125 "//frc971/can_logger:can_logging_fbs",
James Kuszmaul313e9ce2024-02-11 17:47:33 -0800126 "//y2024/localizer:status_fbs",
127 "//y2024/localizer:visualization_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800128 "//aos/network:timestamp_fbs",
129 "//aos/network:remote_message_fbs",
130 ],
131 target_compatible_with = ["@platforms//os:linux"],
132 visibility = ["//visibility:public"],
133 deps = [
134 "//aos/events:aos_config",
135 "//frc971/control_loops/drivetrain:aos_config",
136 ],
137)
138
139aos_config(
140 name = "config_roborio",
141 src = "y2024_roborio.json",
142 flatbuffers = [
143 "//frc971:can_configuration_fbs",
144 "//aos/network:remote_message_fbs",
145 "//aos/network:message_bridge_client_fbs",
146 "//aos/network:message_bridge_server_fbs",
Maxwell Henderson563efed2024-02-17 21:11:33 -0800147 "//frc971/wpilib:pdp_values_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800148 #y2019 stuff shouldn't be here (e.g. target selector)
149 "//y2024/constants:constants_fbs",
150 "//aos/network:timestamp_fbs",
151 "//y2024/control_loops/superstructure:superstructure_goal_fbs",
152 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
Niko Sohmers1259b2a2024-01-29 18:00:37 -0800153 "//y2024/control_loops/superstructure:superstructure_can_position_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800154 "//y2024/control_loops/superstructure:superstructure_output_fbs",
155 "//y2024/control_loops/superstructure:superstructure_position_fbs",
James Kuszmaul313e9ce2024-02-11 17:47:33 -0800156 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800157 "//y2024/control_loops/superstructure:superstructure_status_fbs",
158 "//frc971/can_logger:can_logging_fbs",
159 ],
160 target_compatible_with = ["@platforms//os:linux"],
161 deps = [
162 "//aos/events:aos_config",
163 "//frc971/autonomous:aos_config",
164 "//frc971/control_loops/drivetrain:aos_config",
165 "//frc971/input:aos_config",
166 ],
167)
168
Maxwell Henderson440e3f12024-01-17 19:44:13 -0800169[
170 aos_config(
171 name = "config_" + orin,
172 src = "y2024_" + orin + ".json",
173 flatbuffers = [
174 "//aos/network:message_bridge_client_fbs",
175 "//aos/network:message_bridge_server_fbs",
176 "//aos/network:timestamp_fbs",
177 "//aos/network:remote_message_fbs",
178 "//y2024/constants:constants_fbs",
179 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
180 "//frc971/vision:calibration_fbs",
181 "//frc971/vision:target_map_fbs",
182 "//frc971/vision:vision_fbs",
James Kuszmaul313e9ce2024-02-11 17:47:33 -0800183 "//y2024/localizer:visualization_fbs",
Maxwell Henderson440e3f12024-01-17 19:44:13 -0800184 "@com_github_foxglove_schemas//:schemas",
185 ],
186 target_compatible_with = ["@platforms//os:linux"],
187 visibility = ["//visibility:public"],
188 deps = [
189 "//aos/events:aos_config",
190 "//frc971/control_loops/drivetrain:aos_config",
191 "//frc971/input:aos_config",
192 ],
193 )
194 for orin in [
195 "orin1",
196 "orin2",
197 ]
198]
199
200[
201 jinja2_template(
202 name = "y2024_orin" + str(num) + ".json",
203 src = "y2024_orin_template.json",
204 parameters = {"NUM": str(num)},
205 target_compatible_with = ["@platforms//os:linux"],
206 )
207 for num in range(1, 3)
208]
209
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800210cc_library(
211 name = "constants",
212 srcs = [
213 "constants.cc",
214 ],
215 hdrs = [
216 "constants.h",
217 ],
218 visibility = ["//visibility:public"],
219 deps = [
220 "//aos/mutex",
221 "//aos/network:team_number",
222 "//frc971:constants",
223 "//frc971/control_loops:pose",
224 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
225 "//frc971/shooter_interpolation:interpolation",
226 "//frc971/zeroing:absolute_encoder",
227 "//frc971/zeroing:pot_and_absolute_encoder",
Niko Sohmersc4d2c502024-02-19 19:35:35 -0800228 "//y2024/constants:constants_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800229 "//y2024/control_loops/drivetrain:polydrivetrain_plants",
Niko Sohmers27d92c62024-02-19 14:15:07 -0800230 "//y2024/control_loops/superstructure/altitude:altitude_plants",
231 "//y2024/control_loops/superstructure/catapult:catapult_plants",
Filip Kujawa37aa0bc2024-01-31 20:59:49 -0800232 "//y2024/control_loops/superstructure/climber:climber_plants",
Austin Schuh3db875a2024-02-18 20:02:40 -0800233 "//y2024/control_loops/superstructure/extend:extend_plants",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -0800234 "//y2024/control_loops/superstructure/intake_pivot:intake_pivot_plants",
Niko Sohmers27d92c62024-02-19 14:15:07 -0800235 "//y2024/control_loops/superstructure/turret:turret_plants",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800236 "@com_github_google_glog//:glog",
237 "@com_google_absl//absl/base",
238 ],
239)
240
241cc_binary(
242 name = "wpilib_interface",
243 srcs = [
244 "wpilib_interface.cc",
245 ],
246 target_compatible_with = ["//tools/platforms/hardware:roborio"],
247 deps = [
248 ":constants",
249 "//aos:init",
250 "//aos:math",
251 "//aos/containers:sized_array",
252 "//aos/events:shm_event_loop",
253 "//aos/logging",
254 "//aos/stl_mutex",
255 "//aos/time",
256 "//aos/util:log_interval",
257 "//aos/util:phased_loop",
258 "//aos/util:wrapping_counter",
259 "//frc971:can_configuration_fbs",
260 "//frc971/autonomous:auto_mode_fbs",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -0800261 "//frc971/constants:constants_sender_lib",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800262 "//frc971/control_loops:control_loop",
263 "//frc971/control_loops:control_loops_fbs",
264 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
265 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
266 "//frc971/input:robot_state_fbs",
267 "//frc971/queues:gyro_fbs",
268 "//frc971/wpilib:ADIS16448",
269 "//frc971/wpilib:buffered_pcm",
Maxwell Hendersonf75800f2024-01-12 19:52:05 -0800270 "//frc971/wpilib:can_drivetrain_writer",
271 "//frc971/wpilib:can_sensor_reader",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800272 "//frc971/wpilib:dma",
273 "//frc971/wpilib:drivetrain_writer",
274 "//frc971/wpilib:encoder_and_potentiometer",
Niko Sohmers1259b2a2024-01-29 18:00:37 -0800275 "//frc971/wpilib:generic_can_writer",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800276 "//frc971/wpilib:joystick_sender",
277 "//frc971/wpilib:logging_fbs",
278 "//frc971/wpilib:pdp_fetcher",
279 "//frc971/wpilib:sensor_reader",
Maxwell Hendersonf75800f2024-01-12 19:52:05 -0800280 "//frc971/wpilib:talonfx",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800281 "//frc971/wpilib:wpilib_robot_base",
282 "//third_party:phoenix",
283 "//third_party:phoenix6",
284 "//third_party:wpilib",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -0800285 "//y2024/constants:constants_fbs",
Niko Sohmers1259b2a2024-01-29 18:00:37 -0800286 "//y2024/control_loops/superstructure:superstructure_can_position_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800287 "//y2024/control_loops/superstructure:superstructure_output_fbs",
288 "//y2024/control_loops/superstructure:superstructure_position_fbs",
289 ],
290)
291
292cc_binary(
293 name = "joystick_reader",
294 srcs = [
295 ":joystick_reader.cc",
296 ],
297 deps = [
298 ":constants",
299 "//aos:init",
300 "//aos/actions:action_lib",
301 "//aos/logging",
302 "//frc971/autonomous:auto_fbs",
303 "//frc971/autonomous:base_autonomous_actor",
304 "//frc971/control_loops:profiled_subsystem_fbs",
Filip Kujawaa7c8b412024-02-24 18:29:29 -0800305 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800306 "//frc971/input:action_joystick_input",
307 "//frc971/input:drivetrain_input",
308 "//frc971/input:joystick_input",
309 "//frc971/input:redundant_joystick_data",
310 "//y2024/control_loops/drivetrain:drivetrain_base",
311 "//y2024/control_loops/superstructure:superstructure_goal_fbs",
312 "//y2024/control_loops/superstructure:superstructure_status_fbs",
313 ],
314)
315
316cc_binary(
317 name = "joystick_republish",
318 srcs = [
319 "joystick_republish.cc",
320 ],
321 target_compatible_with = ["@platforms//os:linux"],
322 visibility = ["//visibility:public"],
323 deps = [
324 "//aos:configuration",
325 "//aos:flatbuffer_merge",
326 "//aos:init",
327 "//aos/events:shm_event_loop",
328 "//frc971/input:joystick_state_fbs",
329 "@com_github_google_glog//:glog",
330 ],
331)
332
333py_library(
334 name = "python_init",
335 srcs = ["__init__.py"],
336 target_compatible_with = ["@platforms//os:linux"],
337 visibility = ["//visibility:public"],
338)
339
340sh_binary(
341 name = "log_web_proxy",
342 srcs = ["log_web_proxy.sh"],
343 data = [
344 ":aos_config",
345 "//aos/network:log_web_proxy_main",
Niko Sohmers2d108762024-02-02 20:21:14 -0800346 "//y2024/www:field_main_bundle.min.js",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800347 "//y2024/www:files",
348 ],
349 target_compatible_with = ["@platforms//os:linux"],
350)