blob: d8d0db7f6ed0603772433d19324f48dda1fc813f [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 Henderson0604e6f2024-01-15 15:24:44 -0800115 "//frc971/can_logger:can_logging_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800116 "//aos/network:timestamp_fbs",
117 "//aos/network:remote_message_fbs",
118 ],
119 target_compatible_with = ["@platforms//os:linux"],
120 visibility = ["//visibility:public"],
121 deps = [
122 "//aos/events:aos_config",
123 "//frc971/control_loops/drivetrain:aos_config",
124 ],
125)
126
127aos_config(
128 name = "config_roborio",
129 src = "y2024_roborio.json",
130 flatbuffers = [
131 "//frc971:can_configuration_fbs",
132 "//aos/network:remote_message_fbs",
133 "//aos/network:message_bridge_client_fbs",
134 "//aos/network:message_bridge_server_fbs",
135 #y2019 stuff shouldn't be here (e.g. target selector)
136 "//y2024/constants:constants_fbs",
137 "//aos/network:timestamp_fbs",
138 "//y2024/control_loops/superstructure:superstructure_goal_fbs",
139 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
Niko Sohmers1259b2a2024-01-29 18:00:37 -0800140 "//y2024/control_loops/superstructure:superstructure_can_position_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800141 "//y2024/control_loops/superstructure:superstructure_output_fbs",
142 "//y2024/control_loops/superstructure:superstructure_position_fbs",
143 "//y2024/control_loops/superstructure:superstructure_status_fbs",
144 "//frc971/can_logger:can_logging_fbs",
145 ],
146 target_compatible_with = ["@platforms//os:linux"],
147 deps = [
148 "//aos/events:aos_config",
149 "//frc971/autonomous:aos_config",
150 "//frc971/control_loops/drivetrain:aos_config",
151 "//frc971/input:aos_config",
152 ],
153)
154
Maxwell Henderson440e3f12024-01-17 19:44:13 -0800155[
156 aos_config(
157 name = "config_" + orin,
158 src = "y2024_" + orin + ".json",
159 flatbuffers = [
160 "//aos/network:message_bridge_client_fbs",
161 "//aos/network:message_bridge_server_fbs",
162 "//aos/network:timestamp_fbs",
163 "//aos/network:remote_message_fbs",
164 "//y2024/constants:constants_fbs",
165 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
166 "//frc971/vision:calibration_fbs",
167 "//frc971/vision:target_map_fbs",
168 "//frc971/vision:vision_fbs",
169 "@com_github_foxglove_schemas//:schemas",
170 ],
171 target_compatible_with = ["@platforms//os:linux"],
172 visibility = ["//visibility:public"],
173 deps = [
174 "//aos/events:aos_config",
175 "//frc971/control_loops/drivetrain:aos_config",
176 "//frc971/input:aos_config",
177 ],
178 )
179 for orin in [
180 "orin1",
181 "orin2",
182 ]
183]
184
185[
186 jinja2_template(
187 name = "y2024_orin" + str(num) + ".json",
188 src = "y2024_orin_template.json",
189 parameters = {"NUM": str(num)},
190 target_compatible_with = ["@platforms//os:linux"],
191 )
192 for num in range(1, 3)
193]
194
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800195cc_library(
196 name = "constants",
197 srcs = [
198 "constants.cc",
199 ],
200 hdrs = [
201 "constants.h",
202 ],
203 visibility = ["//visibility:public"],
204 deps = [
205 "//aos/mutex",
206 "//aos/network:team_number",
207 "//frc971:constants",
208 "//frc971/control_loops:pose",
209 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
210 "//frc971/shooter_interpolation:interpolation",
211 "//frc971/zeroing:absolute_encoder",
212 "//frc971/zeroing:pot_and_absolute_encoder",
213 "//y2024/control_loops/drivetrain:polydrivetrain_plants",
Filip Kujawa37aa0bc2024-01-31 20:59:49 -0800214 "//y2024/control_loops/superstructure/climber:climber_plants",
Austin Schuh3db875a2024-02-18 20:02:40 -0800215 "//y2024/control_loops/superstructure/extend:extend_plants",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -0800216 "//y2024/control_loops/superstructure/intake_pivot:intake_pivot_plants",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800217 "@com_github_google_glog//:glog",
218 "@com_google_absl//absl/base",
219 ],
220)
221
222cc_binary(
223 name = "wpilib_interface",
224 srcs = [
225 "wpilib_interface.cc",
226 ],
227 target_compatible_with = ["//tools/platforms/hardware:roborio"],
228 deps = [
229 ":constants",
230 "//aos:init",
231 "//aos:math",
232 "//aos/containers:sized_array",
233 "//aos/events:shm_event_loop",
234 "//aos/logging",
235 "//aos/stl_mutex",
236 "//aos/time",
237 "//aos/util:log_interval",
238 "//aos/util:phased_loop",
239 "//aos/util:wrapping_counter",
240 "//frc971:can_configuration_fbs",
241 "//frc971/autonomous:auto_mode_fbs",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -0800242 "//frc971/constants:constants_sender_lib",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800243 "//frc971/control_loops:control_loop",
244 "//frc971/control_loops:control_loops_fbs",
245 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
246 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
247 "//frc971/input:robot_state_fbs",
248 "//frc971/queues:gyro_fbs",
249 "//frc971/wpilib:ADIS16448",
250 "//frc971/wpilib:buffered_pcm",
Maxwell Hendersonf75800f2024-01-12 19:52:05 -0800251 "//frc971/wpilib:can_drivetrain_writer",
252 "//frc971/wpilib:can_sensor_reader",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800253 "//frc971/wpilib:dma",
254 "//frc971/wpilib:drivetrain_writer",
255 "//frc971/wpilib:encoder_and_potentiometer",
Niko Sohmers1259b2a2024-01-29 18:00:37 -0800256 "//frc971/wpilib:generic_can_writer",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800257 "//frc971/wpilib:joystick_sender",
258 "//frc971/wpilib:logging_fbs",
259 "//frc971/wpilib:pdp_fetcher",
260 "//frc971/wpilib:sensor_reader",
Maxwell Hendersonf75800f2024-01-12 19:52:05 -0800261 "//frc971/wpilib:talonfx",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800262 "//frc971/wpilib:wpilib_robot_base",
263 "//third_party:phoenix",
264 "//third_party:phoenix6",
265 "//third_party:wpilib",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -0800266 "//y2024/constants:constants_fbs",
Niko Sohmers1259b2a2024-01-29 18:00:37 -0800267 "//y2024/control_loops/superstructure:superstructure_can_position_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800268 "//y2024/control_loops/superstructure:superstructure_output_fbs",
269 "//y2024/control_loops/superstructure:superstructure_position_fbs",
270 ],
271)
272
273cc_binary(
274 name = "joystick_reader",
275 srcs = [
276 ":joystick_reader.cc",
277 ],
278 deps = [
279 ":constants",
280 "//aos:init",
281 "//aos/actions:action_lib",
282 "//aos/logging",
283 "//frc971/autonomous:auto_fbs",
284 "//frc971/autonomous:base_autonomous_actor",
285 "//frc971/control_loops:profiled_subsystem_fbs",
286 "//frc971/input:action_joystick_input",
287 "//frc971/input:drivetrain_input",
288 "//frc971/input:joystick_input",
289 "//frc971/input:redundant_joystick_data",
290 "//y2024/control_loops/drivetrain:drivetrain_base",
291 "//y2024/control_loops/superstructure:superstructure_goal_fbs",
292 "//y2024/control_loops/superstructure:superstructure_status_fbs",
293 ],
294)
295
296cc_binary(
297 name = "joystick_republish",
298 srcs = [
299 "joystick_republish.cc",
300 ],
301 target_compatible_with = ["@platforms//os:linux"],
302 visibility = ["//visibility:public"],
303 deps = [
304 "//aos:configuration",
305 "//aos:flatbuffer_merge",
306 "//aos:init",
307 "//aos/events:shm_event_loop",
308 "//frc971/input:joystick_state_fbs",
309 "@com_github_google_glog//:glog",
310 ],
311)
312
313py_library(
314 name = "python_init",
315 srcs = ["__init__.py"],
316 target_compatible_with = ["@platforms//os:linux"],
317 visibility = ["//visibility:public"],
318)
319
320sh_binary(
321 name = "log_web_proxy",
322 srcs = ["log_web_proxy.sh"],
323 data = [
324 ":aos_config",
325 "//aos/network:log_web_proxy_main",
Niko Sohmers2d108762024-02-02 20:21:14 -0800326 "//y2024/www:field_main_bundle.min.js",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800327 "//y2024/www:files",
328 ],
329 target_compatible_with = ["@platforms//os:linux"],
330)