blob: e00b19a4140c492682abd7c291eceda383bc4acf [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 = [
49 "//aos/starter:irq_affinity",
50 "//aos/util:foxglove_websocket",
51 "//aos/events:aos_timing_report_streamer",
52 "//y2024/constants:constants_sender",
53 "//aos/network:web_proxy_main",
54 ":joystick_republish",
55 "//aos/events/logging:log_cat",
56 "//frc971/image_streamer:image_streamer",
57 ],
58 data = [
59 ":aos_config",
60 "//y2024/constants:constants.json",
61 "//y2024/vision:image_streamer_start",
62 "//y2024/www:www_files",
63 ],
64 dirs = [
65 "//y2024/www:www_files",
66 "//frc971/image_streamer/www:www_files",
67 ],
68 start_binaries = [
69 "//aos/network:message_bridge_client",
70 "//aos/network:message_bridge_server",
71 "//aos/network:web_proxy_main",
72 "//aos/starter:irq_affinity",
73 "//y2024/vision:image_logger",
74 "//aos/events/logging:logger_main",
Maxwell Henderson0604e6f2024-01-15 15:24:44 -080075 "//y2024/orin:can_logger",
Maxwell Henderson440e3f12024-01-17 19:44:13 -080076 "//frc971/orin:gpu_apriltag",
77 "//frc971/orin:argus_camera",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080078 ],
79 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
Maxwell Hendersone5d758f2024-01-20 13:30:42 -080080 target_type = "pi",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080081)
82
83aos_config(
84 name = "aos_config",
85 src = "y2024.json",
86 flatbuffers = [
87 "//aos/network:message_bridge_client_fbs",
88 "//aos/network:message_bridge_server_fbs",
89 "//aos/network:timestamp_fbs",
90 "//frc971/input:robot_state_fbs",
91 "//frc971/vision:vision_fbs",
92 "//frc971/vision:target_map_fbs",
93 ],
94 target_compatible_with = ["@platforms//os:linux"],
95 visibility = ["//visibility:public"],
96 deps = [
97 ":config_imu",
Maxwell Henderson440e3f12024-01-17 19:44:13 -080098 ":config_orin1",
99 ":config_orin2",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800100 ":config_roborio",
101 ],
102)
103
104aos_config(
105 name = "config_imu",
106 src = "y2024_imu.json",
107 flatbuffers = [
108 "//aos/network:message_bridge_client_fbs",
109 "//aos/network:message_bridge_server_fbs",
110 "//y2024/constants:constants_fbs",
Maxwell Henderson0604e6f2024-01-15 15:24:44 -0800111 "//frc971/can_logger:can_logging_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800112 "//aos/network:timestamp_fbs",
113 "//aos/network:remote_message_fbs",
114 ],
115 target_compatible_with = ["@platforms//os:linux"],
116 visibility = ["//visibility:public"],
117 deps = [
118 "//aos/events:aos_config",
119 "//frc971/control_loops/drivetrain:aos_config",
120 ],
121)
122
123aos_config(
124 name = "config_roborio",
125 src = "y2024_roborio.json",
126 flatbuffers = [
127 "//frc971:can_configuration_fbs",
128 "//aos/network:remote_message_fbs",
129 "//aos/network:message_bridge_client_fbs",
130 "//aos/network:message_bridge_server_fbs",
131 #y2019 stuff shouldn't be here (e.g. target selector)
132 "//y2024/constants:constants_fbs",
133 "//aos/network:timestamp_fbs",
134 "//y2024/control_loops/superstructure:superstructure_goal_fbs",
135 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
136 "//y2024/control_loops/superstructure:superstructure_output_fbs",
137 "//y2024/control_loops/superstructure:superstructure_position_fbs",
138 "//y2024/control_loops/superstructure:superstructure_status_fbs",
139 "//frc971/can_logger:can_logging_fbs",
140 ],
141 target_compatible_with = ["@platforms//os:linux"],
142 deps = [
143 "//aos/events:aos_config",
144 "//frc971/autonomous:aos_config",
145 "//frc971/control_loops/drivetrain:aos_config",
146 "//frc971/input:aos_config",
147 ],
148)
149
Maxwell Henderson440e3f12024-01-17 19:44:13 -0800150[
151 aos_config(
152 name = "config_" + orin,
153 src = "y2024_" + orin + ".json",
154 flatbuffers = [
155 "//aos/network:message_bridge_client_fbs",
156 "//aos/network:message_bridge_server_fbs",
157 "//aos/network:timestamp_fbs",
158 "//aos/network:remote_message_fbs",
159 "//y2024/constants:constants_fbs",
160 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
161 "//frc971/vision:calibration_fbs",
162 "//frc971/vision:target_map_fbs",
163 "//frc971/vision:vision_fbs",
164 "@com_github_foxglove_schemas//:schemas",
165 ],
166 target_compatible_with = ["@platforms//os:linux"],
167 visibility = ["//visibility:public"],
168 deps = [
169 "//aos/events:aos_config",
170 "//frc971/control_loops/drivetrain:aos_config",
171 "//frc971/input:aos_config",
172 ],
173 )
174 for orin in [
175 "orin1",
176 "orin2",
177 ]
178]
179
180[
181 jinja2_template(
182 name = "y2024_orin" + str(num) + ".json",
183 src = "y2024_orin_template.json",
184 parameters = {"NUM": str(num)},
185 target_compatible_with = ["@platforms//os:linux"],
186 )
187 for num in range(1, 3)
188]
189
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800190cc_library(
191 name = "constants",
192 srcs = [
193 "constants.cc",
194 ],
195 hdrs = [
196 "constants.h",
197 ],
198 visibility = ["//visibility:public"],
199 deps = [
200 "//aos/mutex",
201 "//aos/network:team_number",
202 "//frc971:constants",
203 "//frc971/control_loops:pose",
204 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
205 "//frc971/shooter_interpolation:interpolation",
206 "//frc971/zeroing:absolute_encoder",
207 "//frc971/zeroing:pot_and_absolute_encoder",
208 "//y2024/control_loops/drivetrain:polydrivetrain_plants",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -0800209 "//y2024/control_loops/superstructure/intake_pivot:intake_pivot_plants",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800210 "@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",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -0800235 "//frc971/constants:constants_sender_lib",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800236 "//frc971/control_loops:control_loop",
237 "//frc971/control_loops:control_loops_fbs",
238 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
239 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
240 "//frc971/input:robot_state_fbs",
241 "//frc971/queues:gyro_fbs",
242 "//frc971/wpilib:ADIS16448",
243 "//frc971/wpilib:buffered_pcm",
Maxwell Hendersonf75800f2024-01-12 19:52:05 -0800244 "//frc971/wpilib:can_drivetrain_writer",
245 "//frc971/wpilib:can_sensor_reader",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800246 "//frc971/wpilib:dma",
247 "//frc971/wpilib:drivetrain_writer",
248 "//frc971/wpilib:encoder_and_potentiometer",
249 "//frc971/wpilib:joystick_sender",
250 "//frc971/wpilib:logging_fbs",
251 "//frc971/wpilib:pdp_fetcher",
252 "//frc971/wpilib:sensor_reader",
Maxwell Hendersonf75800f2024-01-12 19:52:05 -0800253 "//frc971/wpilib:talonfx",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800254 "//frc971/wpilib:wpilib_robot_base",
255 "//third_party:phoenix",
256 "//third_party:phoenix6",
257 "//third_party:wpilib",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -0800258 "//y2024/constants:constants_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800259 "//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)