blob: eb266cf3f6c0db6a3cc825bdca08d0a541cbb2cb [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",
Maxwell Henderson7be07d52024-02-20 07:59:16 -080022 "@ctre_phoenix6_api_cpp_athena//:shared_libraries",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080023 "@ctre_phoenix6_tools_athena//:shared_libraries",
Maxwell Henderson7be07d52024-02-20 07:59:16 -080024 "@ctre_phoenix_api_cpp_athena//:shared_libraries",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080025 "@ctre_phoenix_cci_athena//:shared_libraries",
26 ],
27 dirs = [
28 "//y2024/www:www_files",
29 "//y2024/autonomous:splines",
30 ],
31 start_binaries = [
32 "//aos/events/logging:logger_main",
33 "//aos/network:web_proxy_main",
34 "//aos/starter:irq_affinity",
35 "//y2024/autonomous:binaries",
36 ":joystick_reader",
37 ":wpilib_interface",
38 "//frc971/can_logger",
39 "//aos/network:message_bridge_client",
40 "//aos/network:message_bridge_server",
41 "//y2024/control_loops/drivetrain:drivetrain",
42 "//y2024/control_loops/drivetrain:trajectory_generator",
43 "//y2024/control_loops/superstructure:superstructure",
44 ],
45 target_compatible_with = ["@platforms//os:linux"],
46)
47
48robot_downloader(
49 name = "orin_download",
50 binaries = [
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080051 ":joystick_republish",
52 "//aos/events:aos_timing_report_streamer",
53 "//aos/events/logging:log_cat",
54 "//aos/network:web_proxy_main",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080055 "//aos/starter:irq_affinity",
56 "//aos/util:foxglove_websocket",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080057 "//frc971/image_streamer:image_streamer",
Jim Ostrowskicb8b4082024-01-21 02:23:46 -080058 "//frc971/vision:intrinsics_calibration",
Jim Ostrowski9bf206a2024-01-26 23:31:58 -080059 "//y2024/vision:viewer",
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080060 "//y2024/constants:constants_sender",
Jim Ostrowski855b7442024-01-20 18:03:09 -080061 "//y2024/vision:foxglove_image_converter",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080062 ],
63 data = [
64 ":aos_config",
Jim Ostrowski855b7442024-01-20 18:03:09 -080065 "//frc971/rockpi:rockpi_config.json",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080066 "//y2024/constants:constants.json",
67 "//y2024/vision:image_streamer_start",
68 "//y2024/www:www_files",
69 ],
70 dirs = [
71 "//y2024/www:www_files",
72 "//frc971/image_streamer/www:www_files",
73 ],
74 start_binaries = [
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080075 "//aos/events/logging:logger_main",
Maxwell Henderson4f35c832024-02-11 15:40:30 -080076 "//frc971/imu_fdcan:can_translator",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080077 "//aos/network:message_bridge_client",
78 "//aos/network:message_bridge_server",
79 "//aos/network:web_proxy_main",
80 "//aos/starter:irq_affinity",
Maxwell Henderson440e3f12024-01-17 19:44:13 -080081 "//frc971/orin:argus_camera",
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080082 "//y2024/orin:can_logger",
Jim Ostrowskicb8b4082024-01-21 02:23:46 -080083 "//y2024/vision:apriltag_detector",
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080084 "//y2024/vision:image_logger",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080085 ],
86 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
Maxwell Hendersone5d758f2024-01-20 13:30:42 -080087 target_type = "pi",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080088)
89
90aos_config(
91 name = "aos_config",
92 src = "y2024.json",
93 flatbuffers = [
94 "//aos/network:message_bridge_client_fbs",
95 "//aos/network:message_bridge_server_fbs",
96 "//aos/network:timestamp_fbs",
97 "//frc971/input:robot_state_fbs",
98 "//frc971/vision:vision_fbs",
99 "//frc971/vision:target_map_fbs",
100 ],
101 target_compatible_with = ["@platforms//os:linux"],
102 visibility = ["//visibility:public"],
103 deps = [
104 ":config_imu",
Maxwell Henderson440e3f12024-01-17 19:44:13 -0800105 ":config_orin1",
106 ":config_orin2",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800107 ":config_roborio",
108 ],
109)
110
111aos_config(
112 name = "config_imu",
113 src = "y2024_imu.json",
114 flatbuffers = [
115 "//aos/network:message_bridge_client_fbs",
116 "//aos/network:message_bridge_server_fbs",
Maxwell Henderson4f35c832024-02-11 15:40:30 -0800117 "//frc971/imu_fdcan:dual_imu_fbs",
118 "//frc971/imu_fdcan:can_translator_status_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800119 "//y2024/constants:constants_fbs",
Maxwell Henderson563efed2024-02-17 21:11:33 -0800120 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
Maxwell Henderson0604e6f2024-01-15 15:24:44 -0800121 "//frc971/can_logger:can_logging_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800122 "//aos/network:timestamp_fbs",
123 "//aos/network:remote_message_fbs",
124 ],
125 target_compatible_with = ["@platforms//os:linux"],
126 visibility = ["//visibility:public"],
127 deps = [
128 "//aos/events:aos_config",
129 "//frc971/control_loops/drivetrain:aos_config",
130 ],
131)
132
133aos_config(
134 name = "config_roborio",
135 src = "y2024_roborio.json",
136 flatbuffers = [
137 "//frc971:can_configuration_fbs",
138 "//aos/network:remote_message_fbs",
139 "//aos/network:message_bridge_client_fbs",
140 "//aos/network:message_bridge_server_fbs",
Maxwell Henderson563efed2024-02-17 21:11:33 -0800141 "//frc971/wpilib:pdp_values_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800142 #y2019 stuff shouldn't be here (e.g. target selector)
143 "//y2024/constants:constants_fbs",
144 "//aos/network:timestamp_fbs",
145 "//y2024/control_loops/superstructure:superstructure_goal_fbs",
146 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
Niko Sohmers1259b2a2024-01-29 18:00:37 -0800147 "//y2024/control_loops/superstructure:superstructure_can_position_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800148 "//y2024/control_loops/superstructure:superstructure_output_fbs",
149 "//y2024/control_loops/superstructure:superstructure_position_fbs",
150 "//y2024/control_loops/superstructure:superstructure_status_fbs",
151 "//frc971/can_logger:can_logging_fbs",
152 ],
153 target_compatible_with = ["@platforms//os:linux"],
154 deps = [
155 "//aos/events:aos_config",
156 "//frc971/autonomous:aos_config",
157 "//frc971/control_loops/drivetrain:aos_config",
158 "//frc971/input:aos_config",
159 ],
160)
161
Maxwell Henderson440e3f12024-01-17 19:44:13 -0800162[
163 aos_config(
164 name = "config_" + orin,
165 src = "y2024_" + orin + ".json",
166 flatbuffers = [
167 "//aos/network:message_bridge_client_fbs",
168 "//aos/network:message_bridge_server_fbs",
169 "//aos/network:timestamp_fbs",
170 "//aos/network:remote_message_fbs",
171 "//y2024/constants:constants_fbs",
172 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
173 "//frc971/vision:calibration_fbs",
174 "//frc971/vision:target_map_fbs",
175 "//frc971/vision:vision_fbs",
176 "@com_github_foxglove_schemas//:schemas",
177 ],
178 target_compatible_with = ["@platforms//os:linux"],
179 visibility = ["//visibility:public"],
180 deps = [
181 "//aos/events:aos_config",
182 "//frc971/control_loops/drivetrain:aos_config",
183 "//frc971/input:aos_config",
184 ],
185 )
186 for orin in [
187 "orin1",
188 "orin2",
189 ]
190]
191
192[
193 jinja2_template(
194 name = "y2024_orin" + str(num) + ".json",
195 src = "y2024_orin_template.json",
196 parameters = {"NUM": str(num)},
197 target_compatible_with = ["@platforms//os:linux"],
198 )
199 for num in range(1, 3)
200]
201
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800202cc_library(
203 name = "constants",
204 srcs = [
205 "constants.cc",
206 ],
207 hdrs = [
208 "constants.h",
209 ],
210 visibility = ["//visibility:public"],
211 deps = [
212 "//aos/mutex",
213 "//aos/network:team_number",
214 "//frc971:constants",
215 "//frc971/control_loops:pose",
216 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
217 "//frc971/shooter_interpolation:interpolation",
218 "//frc971/zeroing:absolute_encoder",
219 "//frc971/zeroing:pot_and_absolute_encoder",
220 "//y2024/control_loops/drivetrain:polydrivetrain_plants",
Niko Sohmers27d92c62024-02-19 14:15:07 -0800221 "//y2024/control_loops/superstructure/altitude:altitude_plants",
222 "//y2024/control_loops/superstructure/catapult:catapult_plants",
Filip Kujawa37aa0bc2024-01-31 20:59:49 -0800223 "//y2024/control_loops/superstructure/climber:climber_plants",
Austin Schuh3db875a2024-02-18 20:02:40 -0800224 "//y2024/control_loops/superstructure/extend:extend_plants",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -0800225 "//y2024/control_loops/superstructure/intake_pivot:intake_pivot_plants",
Niko Sohmers27d92c62024-02-19 14:15:07 -0800226 "//y2024/control_loops/superstructure/turret:turret_plants",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800227 "@com_github_google_glog//:glog",
228 "@com_google_absl//absl/base",
229 ],
230)
231
232cc_binary(
233 name = "wpilib_interface",
234 srcs = [
235 "wpilib_interface.cc",
236 ],
237 target_compatible_with = ["//tools/platforms/hardware:roborio"],
238 deps = [
239 ":constants",
240 "//aos:init",
241 "//aos:math",
242 "//aos/containers:sized_array",
243 "//aos/events:shm_event_loop",
244 "//aos/logging",
245 "//aos/stl_mutex",
246 "//aos/time",
247 "//aos/util:log_interval",
248 "//aos/util:phased_loop",
249 "//aos/util:wrapping_counter",
250 "//frc971:can_configuration_fbs",
251 "//frc971/autonomous:auto_mode_fbs",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -0800252 "//frc971/constants:constants_sender_lib",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800253 "//frc971/control_loops:control_loop",
254 "//frc971/control_loops:control_loops_fbs",
255 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
256 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
257 "//frc971/input:robot_state_fbs",
258 "//frc971/queues:gyro_fbs",
259 "//frc971/wpilib:ADIS16448",
260 "//frc971/wpilib:buffered_pcm",
Maxwell Hendersonf75800f2024-01-12 19:52:05 -0800261 "//frc971/wpilib:can_drivetrain_writer",
262 "//frc971/wpilib:can_sensor_reader",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800263 "//frc971/wpilib:dma",
264 "//frc971/wpilib:drivetrain_writer",
265 "//frc971/wpilib:encoder_and_potentiometer",
Niko Sohmers1259b2a2024-01-29 18:00:37 -0800266 "//frc971/wpilib:generic_can_writer",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800267 "//frc971/wpilib:joystick_sender",
268 "//frc971/wpilib:logging_fbs",
269 "//frc971/wpilib:pdp_fetcher",
270 "//frc971/wpilib:sensor_reader",
Maxwell Hendersonf75800f2024-01-12 19:52:05 -0800271 "//frc971/wpilib:talonfx",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800272 "//frc971/wpilib:wpilib_robot_base",
273 "//third_party:phoenix",
274 "//third_party:phoenix6",
275 "//third_party:wpilib",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -0800276 "//y2024/constants:constants_fbs",
Niko Sohmers1259b2a2024-01-29 18:00:37 -0800277 "//y2024/control_loops/superstructure:superstructure_can_position_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800278 "//y2024/control_loops/superstructure:superstructure_output_fbs",
279 "//y2024/control_loops/superstructure:superstructure_position_fbs",
280 ],
281)
282
283cc_binary(
284 name = "joystick_reader",
285 srcs = [
286 ":joystick_reader.cc",
287 ],
288 deps = [
289 ":constants",
290 "//aos:init",
291 "//aos/actions:action_lib",
292 "//aos/logging",
293 "//frc971/autonomous:auto_fbs",
294 "//frc971/autonomous:base_autonomous_actor",
295 "//frc971/control_loops:profiled_subsystem_fbs",
296 "//frc971/input:action_joystick_input",
297 "//frc971/input:drivetrain_input",
298 "//frc971/input:joystick_input",
299 "//frc971/input:redundant_joystick_data",
300 "//y2024/control_loops/drivetrain:drivetrain_base",
301 "//y2024/control_loops/superstructure:superstructure_goal_fbs",
302 "//y2024/control_loops/superstructure:superstructure_status_fbs",
303 ],
304)
305
306cc_binary(
307 name = "joystick_republish",
308 srcs = [
309 "joystick_republish.cc",
310 ],
311 target_compatible_with = ["@platforms//os:linux"],
312 visibility = ["//visibility:public"],
313 deps = [
314 "//aos:configuration",
315 "//aos:flatbuffer_merge",
316 "//aos:init",
317 "//aos/events:shm_event_loop",
318 "//frc971/input:joystick_state_fbs",
319 "@com_github_google_glog//:glog",
320 ],
321)
322
323py_library(
324 name = "python_init",
325 srcs = ["__init__.py"],
326 target_compatible_with = ["@platforms//os:linux"],
327 visibility = ["//visibility:public"],
328)
329
330sh_binary(
331 name = "log_web_proxy",
332 srcs = ["log_web_proxy.sh"],
333 data = [
334 ":aos_config",
335 "//aos/network:log_web_proxy_main",
Niko Sohmers2d108762024-02-02 20:21:14 -0800336 "//y2024/www:field_main_bundle.min.js",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800337 "//y2024/www:files",
338 ],
339 target_compatible_with = ["@platforms//os:linux"],
340)