blob: 8c26046ed154f69bfe9ebd7ff4cc618a9fae791b [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 Ostrowskicb8b4082024-01-21 02:23:46 -080056 "//frc971/vision:intrinsics_calibration",
Jim Ostrowski9bf206a2024-01-26 23:31:58 -080057 "//y2024/vision:viewer",
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080058 "//y2024/constants:constants_sender",
Jim Ostrowski855b7442024-01-20 18:03:09 -080059 "//y2024/vision:foxglove_image_converter",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080060 ],
61 data = [
62 ":aos_config",
Jim Ostrowski855b7442024-01-20 18:03:09 -080063 "//frc971/rockpi:rockpi_config.json",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080064 "//y2024/constants:constants.json",
65 "//y2024/vision:image_streamer_start",
66 "//y2024/www:www_files",
67 ],
68 dirs = [
69 "//y2024/www:www_files",
70 "//frc971/image_streamer/www:www_files",
71 ],
72 start_binaries = [
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080073 "//aos/events/logging:logger_main",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080074 "//aos/network:message_bridge_client",
75 "//aos/network:message_bridge_server",
76 "//aos/network:web_proxy_main",
77 "//aos/starter:irq_affinity",
Maxwell Henderson440e3f12024-01-17 19:44:13 -080078 "//frc971/orin:argus_camera",
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080079 "//y2024/orin:can_logger",
Jim Ostrowskicb8b4082024-01-21 02:23:46 -080080 "//y2024/vision:apriltag_detector",
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080081 "//y2024/vision:image_logger",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080082 ],
83 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
Maxwell Hendersone5d758f2024-01-20 13:30:42 -080084 target_type = "pi",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080085)
86
87aos_config(
88 name = "aos_config",
89 src = "y2024.json",
90 flatbuffers = [
91 "//aos/network:message_bridge_client_fbs",
92 "//aos/network:message_bridge_server_fbs",
93 "//aos/network:timestamp_fbs",
94 "//frc971/input:robot_state_fbs",
95 "//frc971/vision:vision_fbs",
96 "//frc971/vision:target_map_fbs",
97 ],
98 target_compatible_with = ["@platforms//os:linux"],
99 visibility = ["//visibility:public"],
100 deps = [
101 ":config_imu",
Maxwell Henderson440e3f12024-01-17 19:44:13 -0800102 ":config_orin1",
103 ":config_orin2",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800104 ":config_roborio",
105 ],
106)
107
108aos_config(
109 name = "config_imu",
110 src = "y2024_imu.json",
111 flatbuffers = [
112 "//aos/network:message_bridge_client_fbs",
113 "//aos/network:message_bridge_server_fbs",
114 "//y2024/constants:constants_fbs",
Maxwell Henderson563efed2024-02-17 21:11:33 -0800115 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
Maxwell Henderson0604e6f2024-01-15 15:24:44 -0800116 "//frc971/can_logger:can_logging_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800117 "//aos/network:timestamp_fbs",
118 "//aos/network:remote_message_fbs",
119 ],
120 target_compatible_with = ["@platforms//os:linux"],
121 visibility = ["//visibility:public"],
122 deps = [
123 "//aos/events:aos_config",
124 "//frc971/control_loops/drivetrain:aos_config",
125 ],
126)
127
128aos_config(
129 name = "config_roborio",
130 src = "y2024_roborio.json",
131 flatbuffers = [
132 "//frc971:can_configuration_fbs",
133 "//aos/network:remote_message_fbs",
134 "//aos/network:message_bridge_client_fbs",
135 "//aos/network:message_bridge_server_fbs",
Maxwell Henderson563efed2024-02-17 21:11:33 -0800136 "//frc971/wpilib:pdp_values_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800137 #y2019 stuff shouldn't be here (e.g. target selector)
138 "//y2024/constants:constants_fbs",
139 "//aos/network:timestamp_fbs",
140 "//y2024/control_loops/superstructure:superstructure_goal_fbs",
141 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
Niko Sohmers1259b2a2024-01-29 18:00:37 -0800142 "//y2024/control_loops/superstructure:superstructure_can_position_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800143 "//y2024/control_loops/superstructure:superstructure_output_fbs",
144 "//y2024/control_loops/superstructure:superstructure_position_fbs",
145 "//y2024/control_loops/superstructure:superstructure_status_fbs",
146 "//frc971/can_logger:can_logging_fbs",
147 ],
148 target_compatible_with = ["@platforms//os:linux"],
149 deps = [
150 "//aos/events:aos_config",
151 "//frc971/autonomous:aos_config",
152 "//frc971/control_loops/drivetrain:aos_config",
153 "//frc971/input:aos_config",
154 ],
155)
156
Maxwell Henderson440e3f12024-01-17 19:44:13 -0800157[
158 aos_config(
159 name = "config_" + orin,
160 src = "y2024_" + orin + ".json",
161 flatbuffers = [
162 "//aos/network:message_bridge_client_fbs",
163 "//aos/network:message_bridge_server_fbs",
164 "//aos/network:timestamp_fbs",
165 "//aos/network:remote_message_fbs",
166 "//y2024/constants:constants_fbs",
167 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
168 "//frc971/vision:calibration_fbs",
169 "//frc971/vision:target_map_fbs",
170 "//frc971/vision:vision_fbs",
171 "@com_github_foxglove_schemas//:schemas",
172 ],
173 target_compatible_with = ["@platforms//os:linux"],
174 visibility = ["//visibility:public"],
175 deps = [
176 "//aos/events:aos_config",
177 "//frc971/control_loops/drivetrain:aos_config",
178 "//frc971/input:aos_config",
179 ],
180 )
181 for orin in [
182 "orin1",
183 "orin2",
184 ]
185]
186
187[
188 jinja2_template(
189 name = "y2024_orin" + str(num) + ".json",
190 src = "y2024_orin_template.json",
191 parameters = {"NUM": str(num)},
192 target_compatible_with = ["@platforms//os:linux"],
193 )
194 for num in range(1, 3)
195]
196
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800197cc_library(
198 name = "constants",
199 srcs = [
200 "constants.cc",
201 ],
202 hdrs = [
203 "constants.h",
204 ],
205 visibility = ["//visibility:public"],
206 deps = [
207 "//aos/mutex",
208 "//aos/network:team_number",
209 "//frc971:constants",
210 "//frc971/control_loops:pose",
211 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
212 "//frc971/shooter_interpolation:interpolation",
213 "//frc971/zeroing:absolute_encoder",
214 "//frc971/zeroing:pot_and_absolute_encoder",
215 "//y2024/control_loops/drivetrain:polydrivetrain_plants",
Niko Sohmers27d92c62024-02-19 14:15:07 -0800216 "//y2024/control_loops/superstructure/altitude:altitude_plants",
217 "//y2024/control_loops/superstructure/catapult:catapult_plants",
Filip Kujawa37aa0bc2024-01-31 20:59:49 -0800218 "//y2024/control_loops/superstructure/climber:climber_plants",
Austin Schuh3db875a2024-02-18 20:02:40 -0800219 "//y2024/control_loops/superstructure/extend:extend_plants",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -0800220 "//y2024/control_loops/superstructure/intake_pivot:intake_pivot_plants",
Niko Sohmers27d92c62024-02-19 14:15:07 -0800221 "//y2024/control_loops/superstructure/turret:turret_plants",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800222 "@com_github_google_glog//:glog",
223 "@com_google_absl//absl/base",
224 ],
225)
226
227cc_binary(
228 name = "wpilib_interface",
229 srcs = [
230 "wpilib_interface.cc",
231 ],
232 target_compatible_with = ["//tools/platforms/hardware:roborio"],
233 deps = [
234 ":constants",
235 "//aos:init",
236 "//aos:math",
237 "//aos/containers:sized_array",
238 "//aos/events:shm_event_loop",
239 "//aos/logging",
240 "//aos/stl_mutex",
241 "//aos/time",
242 "//aos/util:log_interval",
243 "//aos/util:phased_loop",
244 "//aos/util:wrapping_counter",
245 "//frc971:can_configuration_fbs",
246 "//frc971/autonomous:auto_mode_fbs",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -0800247 "//frc971/constants:constants_sender_lib",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800248 "//frc971/control_loops:control_loop",
249 "//frc971/control_loops:control_loops_fbs",
250 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
251 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
252 "//frc971/input:robot_state_fbs",
253 "//frc971/queues:gyro_fbs",
254 "//frc971/wpilib:ADIS16448",
255 "//frc971/wpilib:buffered_pcm",
Maxwell Hendersonf75800f2024-01-12 19:52:05 -0800256 "//frc971/wpilib:can_drivetrain_writer",
257 "//frc971/wpilib:can_sensor_reader",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800258 "//frc971/wpilib:dma",
259 "//frc971/wpilib:drivetrain_writer",
260 "//frc971/wpilib:encoder_and_potentiometer",
Niko Sohmers1259b2a2024-01-29 18:00:37 -0800261 "//frc971/wpilib:generic_can_writer",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800262 "//frc971/wpilib:joystick_sender",
263 "//frc971/wpilib:logging_fbs",
264 "//frc971/wpilib:pdp_fetcher",
265 "//frc971/wpilib:sensor_reader",
Maxwell Hendersonf75800f2024-01-12 19:52:05 -0800266 "//frc971/wpilib:talonfx",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800267 "//frc971/wpilib:wpilib_robot_base",
268 "//third_party:phoenix",
269 "//third_party:phoenix6",
270 "//third_party:wpilib",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -0800271 "//y2024/constants:constants_fbs",
Niko Sohmers1259b2a2024-01-29 18:00:37 -0800272 "//y2024/control_loops/superstructure:superstructure_can_position_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800273 "//y2024/control_loops/superstructure:superstructure_output_fbs",
274 "//y2024/control_loops/superstructure:superstructure_position_fbs",
275 ],
276)
277
278cc_binary(
279 name = "joystick_reader",
280 srcs = [
281 ":joystick_reader.cc",
282 ],
283 deps = [
284 ":constants",
285 "//aos:init",
286 "//aos/actions:action_lib",
287 "//aos/logging",
288 "//frc971/autonomous:auto_fbs",
289 "//frc971/autonomous:base_autonomous_actor",
290 "//frc971/control_loops:profiled_subsystem_fbs",
291 "//frc971/input:action_joystick_input",
292 "//frc971/input:drivetrain_input",
293 "//frc971/input:joystick_input",
294 "//frc971/input:redundant_joystick_data",
295 "//y2024/control_loops/drivetrain:drivetrain_base",
296 "//y2024/control_loops/superstructure:superstructure_goal_fbs",
297 "//y2024/control_loops/superstructure:superstructure_status_fbs",
298 ],
299)
300
301cc_binary(
302 name = "joystick_republish",
303 srcs = [
304 "joystick_republish.cc",
305 ],
306 target_compatible_with = ["@platforms//os:linux"],
307 visibility = ["//visibility:public"],
308 deps = [
309 "//aos:configuration",
310 "//aos:flatbuffer_merge",
311 "//aos:init",
312 "//aos/events:shm_event_loop",
313 "//frc971/input:joystick_state_fbs",
314 "@com_github_google_glog//:glog",
315 ],
316)
317
318py_library(
319 name = "python_init",
320 srcs = ["__init__.py"],
321 target_compatible_with = ["@platforms//os:linux"],
322 visibility = ["//visibility:public"],
323)
324
325sh_binary(
326 name = "log_web_proxy",
327 srcs = ["log_web_proxy.sh"],
328 data = [
329 ":aos_config",
330 "//aos/network:log_web_proxy_main",
Niko Sohmers2d108762024-02-02 20:21:14 -0800331 "//y2024/www:field_main_bundle.min.js",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800332 "//y2024/www:files",
333 ],
334 target_compatible_with = ["@platforms//os:linux"],
335)