blob: d056bf0fec486366e38fa8b70b44079900508e28 [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",
Jim Ostrowski855b7442024-01-20 18:03:09 -080058 "//y2024/vision:foxglove_image_converter",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080059 ],
60 data = [
61 ":aos_config",
Jim Ostrowski855b7442024-01-20 18:03:09 -080062 "//frc971/rockpi:rockpi_config.json",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080063 "//y2024/constants:constants.json",
64 "//y2024/vision:image_streamer_start",
65 "//y2024/www:www_files",
66 ],
67 dirs = [
68 "//y2024/www:www_files",
69 "//frc971/image_streamer/www:www_files",
70 ],
71 start_binaries = [
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080072 "//aos/events/logging:logger_main",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080073 "//aos/network:message_bridge_client",
74 "//aos/network:message_bridge_server",
75 "//aos/network:web_proxy_main",
76 "//aos/starter:irq_affinity",
Maxwell Henderson440e3f12024-01-17 19:44:13 -080077 "//frc971/orin:argus_camera",
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080078 "//frc971/orin:gpu_apriltag",
79 "//y2024/orin:can_logger",
80 "//y2024/vision:image_logger",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080081 ],
82 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
Maxwell Hendersone5d758f2024-01-20 13:30:42 -080083 target_type = "pi",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080084)
85
86aos_config(
87 name = "aos_config",
88 src = "y2024.json",
89 flatbuffers = [
90 "//aos/network:message_bridge_client_fbs",
91 "//aos/network:message_bridge_server_fbs",
92 "//aos/network:timestamp_fbs",
93 "//frc971/input:robot_state_fbs",
94 "//frc971/vision:vision_fbs",
95 "//frc971/vision:target_map_fbs",
96 ],
97 target_compatible_with = ["@platforms//os:linux"],
98 visibility = ["//visibility:public"],
99 deps = [
100 ":config_imu",
Maxwell Henderson440e3f12024-01-17 19:44:13 -0800101 ":config_orin1",
102 ":config_orin2",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800103 ":config_roborio",
104 ],
105)
106
107aos_config(
108 name = "config_imu",
109 src = "y2024_imu.json",
110 flatbuffers = [
111 "//aos/network:message_bridge_client_fbs",
112 "//aos/network:message_bridge_server_fbs",
113 "//y2024/constants:constants_fbs",
Maxwell Henderson0604e6f2024-01-15 15:24:44 -0800114 "//frc971/can_logger:can_logging_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800115 "//aos/network:timestamp_fbs",
116 "//aos/network:remote_message_fbs",
117 ],
118 target_compatible_with = ["@platforms//os:linux"],
119 visibility = ["//visibility:public"],
120 deps = [
121 "//aos/events:aos_config",
122 "//frc971/control_loops/drivetrain:aos_config",
123 ],
124)
125
126aos_config(
127 name = "config_roborio",
128 src = "y2024_roborio.json",
129 flatbuffers = [
130 "//frc971:can_configuration_fbs",
131 "//aos/network:remote_message_fbs",
132 "//aos/network:message_bridge_client_fbs",
133 "//aos/network:message_bridge_server_fbs",
134 #y2019 stuff shouldn't be here (e.g. target selector)
135 "//y2024/constants:constants_fbs",
136 "//aos/network:timestamp_fbs",
137 "//y2024/control_loops/superstructure:superstructure_goal_fbs",
138 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
139 "//y2024/control_loops/superstructure:superstructure_output_fbs",
140 "//y2024/control_loops/superstructure:superstructure_position_fbs",
141 "//y2024/control_loops/superstructure:superstructure_status_fbs",
142 "//frc971/can_logger:can_logging_fbs",
143 ],
144 target_compatible_with = ["@platforms//os:linux"],
145 deps = [
146 "//aos/events:aos_config",
147 "//frc971/autonomous:aos_config",
148 "//frc971/control_loops/drivetrain:aos_config",
149 "//frc971/input:aos_config",
150 ],
151)
152
Maxwell Henderson440e3f12024-01-17 19:44:13 -0800153[
154 aos_config(
155 name = "config_" + orin,
156 src = "y2024_" + orin + ".json",
157 flatbuffers = [
158 "//aos/network:message_bridge_client_fbs",
159 "//aos/network:message_bridge_server_fbs",
160 "//aos/network:timestamp_fbs",
161 "//aos/network:remote_message_fbs",
162 "//y2024/constants:constants_fbs",
163 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
164 "//frc971/vision:calibration_fbs",
165 "//frc971/vision:target_map_fbs",
166 "//frc971/vision:vision_fbs",
167 "@com_github_foxglove_schemas//:schemas",
168 ],
169 target_compatible_with = ["@platforms//os:linux"],
170 visibility = ["//visibility:public"],
171 deps = [
172 "//aos/events:aos_config",
173 "//frc971/control_loops/drivetrain:aos_config",
174 "//frc971/input:aos_config",
175 ],
176 )
177 for orin in [
178 "orin1",
179 "orin2",
180 ]
181]
182
183[
184 jinja2_template(
185 name = "y2024_orin" + str(num) + ".json",
186 src = "y2024_orin_template.json",
187 parameters = {"NUM": str(num)},
188 target_compatible_with = ["@platforms//os:linux"],
189 )
190 for num in range(1, 3)
191]
192
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800193cc_library(
194 name = "constants",
195 srcs = [
196 "constants.cc",
197 ],
198 hdrs = [
199 "constants.h",
200 ],
201 visibility = ["//visibility:public"],
202 deps = [
203 "//aos/mutex",
204 "//aos/network:team_number",
205 "//frc971:constants",
206 "//frc971/control_loops:pose",
207 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
208 "//frc971/shooter_interpolation:interpolation",
209 "//frc971/zeroing:absolute_encoder",
210 "//frc971/zeroing:pot_and_absolute_encoder",
211 "//y2024/control_loops/drivetrain:polydrivetrain_plants",
212 "@com_github_google_glog//:glog",
213 "@com_google_absl//absl/base",
214 ],
215)
216
217cc_binary(
218 name = "wpilib_interface",
219 srcs = [
220 "wpilib_interface.cc",
221 ],
222 target_compatible_with = ["//tools/platforms/hardware:roborio"],
223 deps = [
224 ":constants",
225 "//aos:init",
226 "//aos:math",
227 "//aos/containers:sized_array",
228 "//aos/events:shm_event_loop",
229 "//aos/logging",
230 "//aos/stl_mutex",
231 "//aos/time",
232 "//aos/util:log_interval",
233 "//aos/util:phased_loop",
234 "//aos/util:wrapping_counter",
235 "//frc971:can_configuration_fbs",
236 "//frc971/autonomous:auto_mode_fbs",
237 "//frc971/control_loops:control_loop",
238 "//frc971/control_loops:control_loops_fbs",
239 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
240 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
241 "//frc971/input:robot_state_fbs",
242 "//frc971/queues:gyro_fbs",
243 "//frc971/wpilib:ADIS16448",
244 "//frc971/wpilib:buffered_pcm",
Maxwell Hendersonf75800f2024-01-12 19:52:05 -0800245 "//frc971/wpilib:can_drivetrain_writer",
246 "//frc971/wpilib:can_sensor_reader",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800247 "//frc971/wpilib:dma",
248 "//frc971/wpilib:drivetrain_writer",
249 "//frc971/wpilib:encoder_and_potentiometer",
250 "//frc971/wpilib:joystick_sender",
251 "//frc971/wpilib:logging_fbs",
252 "//frc971/wpilib:pdp_fetcher",
253 "//frc971/wpilib:sensor_reader",
Maxwell Hendersonf75800f2024-01-12 19:52:05 -0800254 "//frc971/wpilib:talonfx",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800255 "//frc971/wpilib:wpilib_robot_base",
256 "//third_party:phoenix",
257 "//third_party:phoenix6",
258 "//third_party:wpilib",
259 "//y2024/control_loops/superstructure:superstructure_output_fbs",
260 "//y2024/control_loops/superstructure:superstructure_position_fbs",
261 ],
262)
263
264cc_binary(
265 name = "joystick_reader",
266 srcs = [
267 ":joystick_reader.cc",
268 ],
269 deps = [
270 ":constants",
271 "//aos:init",
272 "//aos/actions:action_lib",
273 "//aos/logging",
274 "//frc971/autonomous:auto_fbs",
275 "//frc971/autonomous:base_autonomous_actor",
276 "//frc971/control_loops:profiled_subsystem_fbs",
277 "//frc971/input:action_joystick_input",
278 "//frc971/input:drivetrain_input",
279 "//frc971/input:joystick_input",
280 "//frc971/input:redundant_joystick_data",
281 "//y2024/control_loops/drivetrain:drivetrain_base",
282 "//y2024/control_loops/superstructure:superstructure_goal_fbs",
283 "//y2024/control_loops/superstructure:superstructure_status_fbs",
284 ],
285)
286
287cc_binary(
288 name = "joystick_republish",
289 srcs = [
290 "joystick_republish.cc",
291 ],
292 target_compatible_with = ["@platforms//os:linux"],
293 visibility = ["//visibility:public"],
294 deps = [
295 "//aos:configuration",
296 "//aos:flatbuffer_merge",
297 "//aos:init",
298 "//aos/events:shm_event_loop",
299 "//frc971/input:joystick_state_fbs",
300 "@com_github_google_glog//:glog",
301 ],
302)
303
304py_library(
305 name = "python_init",
306 srcs = ["__init__.py"],
307 target_compatible_with = ["@platforms//os:linux"],
308 visibility = ["//visibility:public"],
309)
310
311sh_binary(
312 name = "log_web_proxy",
313 srcs = ["log_web_proxy.sh"],
314 data = [
315 ":aos_config",
316 "//aos/network:log_web_proxy_main",
317 "//y2024/www:files",
318 ],
319 target_compatible_with = ["@platforms//os:linux"],
320)