blob: ecbb3011bc1974c004cc0f19631384292b63d065 [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",
22 "@ctre_phoenix6_tools_athena//:shared_libraries",
23 "@ctre_phoenix_cci_athena//:shared_libraries",
24 ],
25 dirs = [
26 "//y2024/www:www_files",
27 "//y2024/autonomous:splines",
28 ],
29 start_binaries = [
30 "//aos/events/logging:logger_main",
31 "//aos/network:web_proxy_main",
32 "//aos/starter:irq_affinity",
33 "//y2024/autonomous:binaries",
34 ":joystick_reader",
35 ":wpilib_interface",
36 "//frc971/can_logger",
37 "//aos/network:message_bridge_client",
38 "//aos/network:message_bridge_server",
39 "//y2024/control_loops/drivetrain:drivetrain",
40 "//y2024/control_loops/drivetrain:trajectory_generator",
41 "//y2024/control_loops/superstructure:superstructure",
42 ],
43 target_compatible_with = ["@platforms//os:linux"],
44)
45
46robot_downloader(
47 name = "orin_download",
48 binaries = [
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080049 ":joystick_republish",
50 "//aos/events:aos_timing_report_streamer",
51 "//aos/events/logging:log_cat",
52 "//aos/network:web_proxy_main",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080053 "//aos/starter:irq_affinity",
54 "//aos/util:foxglove_websocket",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080055 "//frc971/image_streamer:image_streamer",
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080056 "//y2023/vision:viewer",
57 "//y2024/constants:constants_sender",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080058 ],
59 data = [
60 ":aos_config",
61 "//y2024/constants:constants.json",
62 "//y2024/vision:image_streamer_start",
63 "//y2024/www:www_files",
64 ],
65 dirs = [
66 "//y2024/www:www_files",
67 "//frc971/image_streamer/www:www_files",
68 ],
69 start_binaries = [
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080070 "//aos/events/logging:logger_main",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080071 "//aos/network:message_bridge_client",
72 "//aos/network:message_bridge_server",
73 "//aos/network:web_proxy_main",
74 "//aos/starter:irq_affinity",
Maxwell Henderson440e3f12024-01-17 19:44:13 -080075 "//frc971/orin:argus_camera",
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080076 "//frc971/orin:gpu_apriltag",
77 "//y2024/orin:can_logger",
78 "//y2024/vision:image_logger",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080079 ],
80 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
Maxwell Hendersone5d758f2024-01-20 13:30:42 -080081 target_type = "pi",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080082)
83
84aos_config(
85 name = "aos_config",
86 src = "y2024.json",
87 flatbuffers = [
88 "//aos/network:message_bridge_client_fbs",
89 "//aos/network:message_bridge_server_fbs",
90 "//aos/network:timestamp_fbs",
91 "//frc971/input:robot_state_fbs",
92 "//frc971/vision:vision_fbs",
93 "//frc971/vision:target_map_fbs",
94 ],
95 target_compatible_with = ["@platforms//os:linux"],
96 visibility = ["//visibility:public"],
97 deps = [
98 ":config_imu",
Maxwell Henderson440e3f12024-01-17 19:44:13 -080099 ":config_orin1",
100 ":config_orin2",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800101 ":config_roborio",
102 ],
103)
104
105aos_config(
106 name = "config_imu",
107 src = "y2024_imu.json",
108 flatbuffers = [
109 "//aos/network:message_bridge_client_fbs",
110 "//aos/network:message_bridge_server_fbs",
111 "//y2024/constants:constants_fbs",
Maxwell Henderson0604e6f2024-01-15 15:24:44 -0800112 "//frc971/can_logger:can_logging_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800113 "//aos/network:timestamp_fbs",
114 "//aos/network:remote_message_fbs",
115 ],
116 target_compatible_with = ["@platforms//os:linux"],
117 visibility = ["//visibility:public"],
118 deps = [
119 "//aos/events:aos_config",
120 "//frc971/control_loops/drivetrain:aos_config",
121 ],
122)
123
124aos_config(
125 name = "config_roborio",
126 src = "y2024_roborio.json",
127 flatbuffers = [
128 "//frc971:can_configuration_fbs",
129 "//aos/network:remote_message_fbs",
130 "//aos/network:message_bridge_client_fbs",
131 "//aos/network:message_bridge_server_fbs",
132 #y2019 stuff shouldn't be here (e.g. target selector)
133 "//y2024/constants:constants_fbs",
134 "//aos/network:timestamp_fbs",
135 "//y2024/control_loops/superstructure:superstructure_goal_fbs",
136 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
137 "//y2024/control_loops/superstructure:superstructure_output_fbs",
138 "//y2024/control_loops/superstructure:superstructure_position_fbs",
139 "//y2024/control_loops/superstructure:superstructure_status_fbs",
140 "//frc971/can_logger:can_logging_fbs",
141 ],
142 target_compatible_with = ["@platforms//os:linux"],
143 deps = [
144 "//aos/events:aos_config",
145 "//frc971/autonomous:aos_config",
146 "//frc971/control_loops/drivetrain:aos_config",
147 "//frc971/input:aos_config",
148 ],
149)
150
Maxwell Henderson440e3f12024-01-17 19:44:13 -0800151[
152 aos_config(
153 name = "config_" + orin,
154 src = "y2024_" + orin + ".json",
155 flatbuffers = [
156 "//aos/network:message_bridge_client_fbs",
157 "//aos/network:message_bridge_server_fbs",
158 "//aos/network:timestamp_fbs",
159 "//aos/network:remote_message_fbs",
160 "//y2024/constants:constants_fbs",
161 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
162 "//frc971/vision:calibration_fbs",
163 "//frc971/vision:target_map_fbs",
164 "//frc971/vision:vision_fbs",
165 "@com_github_foxglove_schemas//:schemas",
166 ],
167 target_compatible_with = ["@platforms//os:linux"],
168 visibility = ["//visibility:public"],
169 deps = [
170 "//aos/events:aos_config",
171 "//frc971/control_loops/drivetrain:aos_config",
172 "//frc971/input:aos_config",
173 ],
174 )
175 for orin in [
176 "orin1",
177 "orin2",
178 ]
179]
180
181[
182 jinja2_template(
183 name = "y2024_orin" + str(num) + ".json",
184 src = "y2024_orin_template.json",
185 parameters = {"NUM": str(num)},
186 target_compatible_with = ["@platforms//os:linux"],
187 )
188 for num in range(1, 3)
189]
190
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800191cc_library(
192 name = "constants",
193 srcs = [
194 "constants.cc",
195 ],
196 hdrs = [
197 "constants.h",
198 ],
199 visibility = ["//visibility:public"],
200 deps = [
201 "//aos/mutex",
202 "//aos/network:team_number",
203 "//frc971:constants",
204 "//frc971/control_loops:pose",
205 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
206 "//frc971/shooter_interpolation:interpolation",
207 "//frc971/zeroing:absolute_encoder",
208 "//frc971/zeroing:pot_and_absolute_encoder",
209 "//y2024/control_loops/drivetrain:polydrivetrain_plants",
210 "@com_github_google_glog//:glog",
211 "@com_google_absl//absl/base",
212 ],
213)
214
215cc_binary(
216 name = "wpilib_interface",
217 srcs = [
218 "wpilib_interface.cc",
219 ],
220 target_compatible_with = ["//tools/platforms/hardware:roborio"],
221 deps = [
222 ":constants",
223 "//aos:init",
224 "//aos:math",
225 "//aos/containers:sized_array",
226 "//aos/events:shm_event_loop",
227 "//aos/logging",
228 "//aos/stl_mutex",
229 "//aos/time",
230 "//aos/util:log_interval",
231 "//aos/util:phased_loop",
232 "//aos/util:wrapping_counter",
233 "//frc971:can_configuration_fbs",
234 "//frc971/autonomous:auto_mode_fbs",
235 "//frc971/control_loops:control_loop",
236 "//frc971/control_loops:control_loops_fbs",
237 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
238 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
239 "//frc971/input:robot_state_fbs",
240 "//frc971/queues:gyro_fbs",
241 "//frc971/wpilib:ADIS16448",
242 "//frc971/wpilib:buffered_pcm",
Maxwell Hendersonf75800f2024-01-12 19:52:05 -0800243 "//frc971/wpilib:can_drivetrain_writer",
244 "//frc971/wpilib:can_sensor_reader",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800245 "//frc971/wpilib:dma",
246 "//frc971/wpilib:drivetrain_writer",
247 "//frc971/wpilib:encoder_and_potentiometer",
248 "//frc971/wpilib:joystick_sender",
249 "//frc971/wpilib:logging_fbs",
250 "//frc971/wpilib:pdp_fetcher",
251 "//frc971/wpilib:sensor_reader",
Maxwell Hendersonf75800f2024-01-12 19:52:05 -0800252 "//frc971/wpilib:talonfx",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800253 "//frc971/wpilib:wpilib_robot_base",
254 "//third_party:phoenix",
255 "//third_party:phoenix6",
256 "//third_party:wpilib",
257 "//y2024/control_loops/superstructure:superstructure_output_fbs",
258 "//y2024/control_loops/superstructure:superstructure_position_fbs",
259 ],
260)
261
262cc_binary(
263 name = "joystick_reader",
264 srcs = [
265 ":joystick_reader.cc",
266 ],
267 deps = [
268 ":constants",
269 "//aos:init",
270 "//aos/actions:action_lib",
271 "//aos/logging",
272 "//frc971/autonomous:auto_fbs",
273 "//frc971/autonomous:base_autonomous_actor",
274 "//frc971/control_loops:profiled_subsystem_fbs",
275 "//frc971/input:action_joystick_input",
276 "//frc971/input:drivetrain_input",
277 "//frc971/input:joystick_input",
278 "//frc971/input:redundant_joystick_data",
279 "//y2024/control_loops/drivetrain:drivetrain_base",
280 "//y2024/control_loops/superstructure:superstructure_goal_fbs",
281 "//y2024/control_loops/superstructure:superstructure_status_fbs",
282 ],
283)
284
285cc_binary(
286 name = "joystick_republish",
287 srcs = [
288 "joystick_republish.cc",
289 ],
290 target_compatible_with = ["@platforms//os:linux"],
291 visibility = ["//visibility:public"],
292 deps = [
293 "//aos:configuration",
294 "//aos:flatbuffer_merge",
295 "//aos:init",
296 "//aos/events:shm_event_loop",
297 "//frc971/input:joystick_state_fbs",
298 "@com_github_google_glog//:glog",
299 ],
300)
301
302py_library(
303 name = "python_init",
304 srcs = ["__init__.py"],
305 target_compatible_with = ["@platforms//os:linux"],
306 visibility = ["//visibility:public"],
307)
308
309sh_binary(
310 name = "log_web_proxy",
311 srcs = ["log_web_proxy.sh"],
312 data = [
313 ":aos_config",
314 "//aos/network:log_web_proxy_main",
315 "//y2024/www:files",
316 ],
317 target_compatible_with = ["@platforms//os:linux"],
318)