blob: d96fd71985ffa3ea29df53f4b4e8b638fadd2870 [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",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080076 "//aos/network:message_bridge_client",
77 "//aos/network:message_bridge_server",
78 "//aos/network:web_proxy_main",
79 "//aos/starter:irq_affinity",
Maxwell Henderson440e3f12024-01-17 19:44:13 -080080 "//frc971/orin:argus_camera",
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080081 "//y2024/orin:can_logger",
Jim Ostrowskicb8b4082024-01-21 02:23:46 -080082 "//y2024/vision:apriltag_detector",
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080083 "//y2024/vision:image_logger",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080084 ],
85 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
Maxwell Hendersone5d758f2024-01-20 13:30:42 -080086 target_type = "pi",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080087)
88
89aos_config(
90 name = "aos_config",
91 src = "y2024.json",
92 flatbuffers = [
93 "//aos/network:message_bridge_client_fbs",
94 "//aos/network:message_bridge_server_fbs",
95 "//aos/network:timestamp_fbs",
96 "//frc971/input:robot_state_fbs",
97 "//frc971/vision:vision_fbs",
98 "//frc971/vision:target_map_fbs",
99 ],
100 target_compatible_with = ["@platforms//os:linux"],
101 visibility = ["//visibility:public"],
102 deps = [
103 ":config_imu",
Maxwell Henderson440e3f12024-01-17 19:44:13 -0800104 ":config_orin1",
105 ":config_orin2",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800106 ":config_roborio",
107 ],
108)
109
110aos_config(
111 name = "config_imu",
112 src = "y2024_imu.json",
113 flatbuffers = [
114 "//aos/network:message_bridge_client_fbs",
115 "//aos/network:message_bridge_server_fbs",
116 "//y2024/constants:constants_fbs",
Maxwell Henderson563efed2024-02-17 21:11:33 -0800117 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
Maxwell Henderson0604e6f2024-01-15 15:24:44 -0800118 "//frc971/can_logger:can_logging_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800119 "//aos/network:timestamp_fbs",
120 "//aos/network:remote_message_fbs",
121 ],
122 target_compatible_with = ["@platforms//os:linux"],
123 visibility = ["//visibility:public"],
124 deps = [
125 "//aos/events:aos_config",
126 "//frc971/control_loops/drivetrain:aos_config",
127 ],
128)
129
130aos_config(
131 name = "config_roborio",
132 src = "y2024_roborio.json",
133 flatbuffers = [
134 "//frc971:can_configuration_fbs",
135 "//aos/network:remote_message_fbs",
136 "//aos/network:message_bridge_client_fbs",
137 "//aos/network:message_bridge_server_fbs",
Maxwell Henderson563efed2024-02-17 21:11:33 -0800138 "//frc971/wpilib:pdp_values_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800139 #y2019 stuff shouldn't be here (e.g. target selector)
140 "//y2024/constants:constants_fbs",
141 "//aos/network:timestamp_fbs",
142 "//y2024/control_loops/superstructure:superstructure_goal_fbs",
143 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
Niko Sohmers1259b2a2024-01-29 18:00:37 -0800144 "//y2024/control_loops/superstructure:superstructure_can_position_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800145 "//y2024/control_loops/superstructure:superstructure_output_fbs",
146 "//y2024/control_loops/superstructure:superstructure_position_fbs",
147 "//y2024/control_loops/superstructure:superstructure_status_fbs",
148 "//frc971/can_logger:can_logging_fbs",
149 ],
150 target_compatible_with = ["@platforms//os:linux"],
151 deps = [
152 "//aos/events:aos_config",
153 "//frc971/autonomous:aos_config",
154 "//frc971/control_loops/drivetrain:aos_config",
155 "//frc971/input:aos_config",
156 ],
157)
158
Maxwell Henderson440e3f12024-01-17 19:44:13 -0800159[
160 aos_config(
161 name = "config_" + orin,
162 src = "y2024_" + orin + ".json",
163 flatbuffers = [
164 "//aos/network:message_bridge_client_fbs",
165 "//aos/network:message_bridge_server_fbs",
166 "//aos/network:timestamp_fbs",
167 "//aos/network:remote_message_fbs",
168 "//y2024/constants:constants_fbs",
169 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
170 "//frc971/vision:calibration_fbs",
171 "//frc971/vision:target_map_fbs",
172 "//frc971/vision:vision_fbs",
173 "@com_github_foxglove_schemas//:schemas",
174 ],
175 target_compatible_with = ["@platforms//os:linux"],
176 visibility = ["//visibility:public"],
177 deps = [
178 "//aos/events:aos_config",
179 "//frc971/control_loops/drivetrain:aos_config",
180 "//frc971/input:aos_config",
181 ],
182 )
183 for orin in [
184 "orin1",
185 "orin2",
186 ]
187]
188
189[
190 jinja2_template(
191 name = "y2024_orin" + str(num) + ".json",
192 src = "y2024_orin_template.json",
193 parameters = {"NUM": str(num)},
194 target_compatible_with = ["@platforms//os:linux"],
195 )
196 for num in range(1, 3)
197]
198
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800199cc_library(
200 name = "constants",
201 srcs = [
202 "constants.cc",
203 ],
204 hdrs = [
205 "constants.h",
206 ],
207 visibility = ["//visibility:public"],
208 deps = [
209 "//aos/mutex",
210 "//aos/network:team_number",
211 "//frc971:constants",
212 "//frc971/control_loops:pose",
213 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
214 "//frc971/shooter_interpolation:interpolation",
215 "//frc971/zeroing:absolute_encoder",
216 "//frc971/zeroing:pot_and_absolute_encoder",
217 "//y2024/control_loops/drivetrain:polydrivetrain_plants",
Niko Sohmers27d92c62024-02-19 14:15:07 -0800218 "//y2024/control_loops/superstructure/altitude:altitude_plants",
219 "//y2024/control_loops/superstructure/catapult:catapult_plants",
Filip Kujawa37aa0bc2024-01-31 20:59:49 -0800220 "//y2024/control_loops/superstructure/climber:climber_plants",
Austin Schuh3db875a2024-02-18 20:02:40 -0800221 "//y2024/control_loops/superstructure/extend:extend_plants",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -0800222 "//y2024/control_loops/superstructure/intake_pivot:intake_pivot_plants",
Niko Sohmers27d92c62024-02-19 14:15:07 -0800223 "//y2024/control_loops/superstructure/turret:turret_plants",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800224 "@com_github_google_glog//:glog",
225 "@com_google_absl//absl/base",
226 ],
227)
228
229cc_binary(
230 name = "wpilib_interface",
231 srcs = [
232 "wpilib_interface.cc",
233 ],
234 target_compatible_with = ["//tools/platforms/hardware:roborio"],
235 deps = [
236 ":constants",
237 "//aos:init",
238 "//aos:math",
239 "//aos/containers:sized_array",
240 "//aos/events:shm_event_loop",
241 "//aos/logging",
242 "//aos/stl_mutex",
243 "//aos/time",
244 "//aos/util:log_interval",
245 "//aos/util:phased_loop",
246 "//aos/util:wrapping_counter",
247 "//frc971:can_configuration_fbs",
248 "//frc971/autonomous:auto_mode_fbs",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -0800249 "//frc971/constants:constants_sender_lib",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800250 "//frc971/control_loops:control_loop",
251 "//frc971/control_loops:control_loops_fbs",
252 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
253 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
254 "//frc971/input:robot_state_fbs",
255 "//frc971/queues:gyro_fbs",
256 "//frc971/wpilib:ADIS16448",
257 "//frc971/wpilib:buffered_pcm",
Maxwell Hendersonf75800f2024-01-12 19:52:05 -0800258 "//frc971/wpilib:can_drivetrain_writer",
259 "//frc971/wpilib:can_sensor_reader",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800260 "//frc971/wpilib:dma",
261 "//frc971/wpilib:drivetrain_writer",
262 "//frc971/wpilib:encoder_and_potentiometer",
Niko Sohmers1259b2a2024-01-29 18:00:37 -0800263 "//frc971/wpilib:generic_can_writer",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800264 "//frc971/wpilib:joystick_sender",
265 "//frc971/wpilib:logging_fbs",
266 "//frc971/wpilib:pdp_fetcher",
267 "//frc971/wpilib:sensor_reader",
Maxwell Hendersonf75800f2024-01-12 19:52:05 -0800268 "//frc971/wpilib:talonfx",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800269 "//frc971/wpilib:wpilib_robot_base",
270 "//third_party:phoenix",
271 "//third_party:phoenix6",
272 "//third_party:wpilib",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -0800273 "//y2024/constants:constants_fbs",
Niko Sohmers1259b2a2024-01-29 18:00:37 -0800274 "//y2024/control_loops/superstructure:superstructure_can_position_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800275 "//y2024/control_loops/superstructure:superstructure_output_fbs",
276 "//y2024/control_loops/superstructure:superstructure_position_fbs",
277 ],
278)
279
280cc_binary(
281 name = "joystick_reader",
282 srcs = [
283 ":joystick_reader.cc",
284 ],
285 deps = [
286 ":constants",
287 "//aos:init",
288 "//aos/actions:action_lib",
289 "//aos/logging",
290 "//frc971/autonomous:auto_fbs",
291 "//frc971/autonomous:base_autonomous_actor",
292 "//frc971/control_loops:profiled_subsystem_fbs",
293 "//frc971/input:action_joystick_input",
294 "//frc971/input:drivetrain_input",
295 "//frc971/input:joystick_input",
296 "//frc971/input:redundant_joystick_data",
297 "//y2024/control_loops/drivetrain:drivetrain_base",
298 "//y2024/control_loops/superstructure:superstructure_goal_fbs",
299 "//y2024/control_loops/superstructure:superstructure_status_fbs",
300 ],
301)
302
303cc_binary(
304 name = "joystick_republish",
305 srcs = [
306 "joystick_republish.cc",
307 ],
308 target_compatible_with = ["@platforms//os:linux"],
309 visibility = ["//visibility:public"],
310 deps = [
311 "//aos:configuration",
312 "//aos:flatbuffer_merge",
313 "//aos:init",
314 "//aos/events:shm_event_loop",
315 "//frc971/input:joystick_state_fbs",
316 "@com_github_google_glog//:glog",
317 ],
318)
319
320py_library(
321 name = "python_init",
322 srcs = ["__init__.py"],
323 target_compatible_with = ["@platforms//os:linux"],
324 visibility = ["//visibility:public"],
325)
326
327sh_binary(
328 name = "log_web_proxy",
329 srcs = ["log_web_proxy.sh"],
330 data = [
331 ":aos_config",
332 "//aos/network:log_web_proxy_main",
Niko Sohmers2d108762024-02-02 20:21:14 -0800333 "//y2024/www:field_main_bundle.min.js",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800334 "//y2024/www:files",
335 ],
336 target_compatible_with = ["@platforms//os:linux"],
337)