blob: b362f6c1694d3a186a143005f53e3fea36912a57 [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 Ostrowski8a1480f2024-01-20 00:31:51 -080056 "//y2023/vision:viewer",
57 "//y2024/constants:constants_sender",
Jim Ostrowski855b7442024-01-20 18:03:09 -080058 "//y2024/vision:foxglove_image_converter",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080059 ],
60 data = [
61 ":aos_config",
Jim Ostrowski855b7442024-01-20 18:03:09 -080062 "//frc971/rockpi:rockpi_config.json",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080063 "//y2024/constants:constants.json",
64 "//y2024/vision:image_streamer_start",
65 "//y2024/www:www_files",
66 ],
67 dirs = [
68 "//y2024/www:www_files",
69 "//frc971/image_streamer/www:www_files",
70 ],
71 start_binaries = [
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080072 "//aos/events/logging:logger_main",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080073 "//aos/network:message_bridge_client",
74 "//aos/network:message_bridge_server",
75 "//aos/network:web_proxy_main",
76 "//aos/starter:irq_affinity",
Maxwell Henderson440e3f12024-01-17 19:44:13 -080077 "//frc971/orin:argus_camera",
Jim Ostrowski8a1480f2024-01-20 00:31:51 -080078 "//frc971/orin:gpu_apriltag",
79 "//y2024/orin:can_logger",
80 "//y2024/vision:image_logger",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080081 ],
82 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
Maxwell Hendersone5d758f2024-01-20 13:30:42 -080083 target_type = "pi",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080084)
85
86aos_config(
87 name = "aos_config",
88 src = "y2024.json",
89 flatbuffers = [
90 "//aos/network:message_bridge_client_fbs",
91 "//aos/network:message_bridge_server_fbs",
92 "//aos/network:timestamp_fbs",
93 "//frc971/input:robot_state_fbs",
94 "//frc971/vision:vision_fbs",
95 "//frc971/vision:target_map_fbs",
96 ],
97 target_compatible_with = ["@platforms//os:linux"],
98 visibility = ["//visibility:public"],
99 deps = [
100 ":config_imu",
Maxwell Henderson440e3f12024-01-17 19:44:13 -0800101 ":config_orin1",
102 ":config_orin2",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800103 ":config_roborio",
104 ],
105)
106
107aos_config(
108 name = "config_imu",
109 src = "y2024_imu.json",
110 flatbuffers = [
111 "//aos/network:message_bridge_client_fbs",
112 "//aos/network:message_bridge_server_fbs",
113 "//y2024/constants:constants_fbs",
Maxwell Henderson0604e6f2024-01-15 15:24:44 -0800114 "//frc971/can_logger:can_logging_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800115 "//aos/network:timestamp_fbs",
116 "//aos/network:remote_message_fbs",
117 ],
118 target_compatible_with = ["@platforms//os:linux"],
119 visibility = ["//visibility:public"],
120 deps = [
121 "//aos/events:aos_config",
122 "//frc971/control_loops/drivetrain:aos_config",
123 ],
124)
125
126aos_config(
127 name = "config_roborio",
128 src = "y2024_roborio.json",
129 flatbuffers = [
130 "//frc971:can_configuration_fbs",
131 "//aos/network:remote_message_fbs",
132 "//aos/network:message_bridge_client_fbs",
133 "//aos/network:message_bridge_server_fbs",
134 #y2019 stuff shouldn't be here (e.g. target selector)
135 "//y2024/constants:constants_fbs",
136 "//aos/network:timestamp_fbs",
137 "//y2024/control_loops/superstructure:superstructure_goal_fbs",
138 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
Niko Sohmers1259b2a2024-01-29 18:00:37 -0800139 "//y2024/control_loops/superstructure:superstructure_can_position_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800140 "//y2024/control_loops/superstructure:superstructure_output_fbs",
141 "//y2024/control_loops/superstructure:superstructure_position_fbs",
142 "//y2024/control_loops/superstructure:superstructure_status_fbs",
143 "//frc971/can_logger:can_logging_fbs",
144 ],
145 target_compatible_with = ["@platforms//os:linux"],
146 deps = [
147 "//aos/events:aos_config",
148 "//frc971/autonomous:aos_config",
149 "//frc971/control_loops/drivetrain:aos_config",
150 "//frc971/input:aos_config",
151 ],
152)
153
Maxwell Henderson440e3f12024-01-17 19:44:13 -0800154[
155 aos_config(
156 name = "config_" + orin,
157 src = "y2024_" + orin + ".json",
158 flatbuffers = [
159 "//aos/network:message_bridge_client_fbs",
160 "//aos/network:message_bridge_server_fbs",
161 "//aos/network:timestamp_fbs",
162 "//aos/network:remote_message_fbs",
163 "//y2024/constants:constants_fbs",
164 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
165 "//frc971/vision:calibration_fbs",
166 "//frc971/vision:target_map_fbs",
167 "//frc971/vision:vision_fbs",
168 "@com_github_foxglove_schemas//:schemas",
169 ],
170 target_compatible_with = ["@platforms//os:linux"],
171 visibility = ["//visibility:public"],
172 deps = [
173 "//aos/events:aos_config",
174 "//frc971/control_loops/drivetrain:aos_config",
175 "//frc971/input:aos_config",
176 ],
177 )
178 for orin in [
179 "orin1",
180 "orin2",
181 ]
182]
183
184[
185 jinja2_template(
186 name = "y2024_orin" + str(num) + ".json",
187 src = "y2024_orin_template.json",
188 parameters = {"NUM": str(num)},
189 target_compatible_with = ["@platforms//os:linux"],
190 )
191 for num in range(1, 3)
192]
193
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800194cc_library(
195 name = "constants",
196 srcs = [
197 "constants.cc",
198 ],
199 hdrs = [
200 "constants.h",
201 ],
202 visibility = ["//visibility:public"],
203 deps = [
204 "//aos/mutex",
205 "//aos/network:team_number",
206 "//frc971:constants",
207 "//frc971/control_loops:pose",
208 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
209 "//frc971/shooter_interpolation:interpolation",
210 "//frc971/zeroing:absolute_encoder",
211 "//frc971/zeroing:pot_and_absolute_encoder",
212 "//y2024/control_loops/drivetrain:polydrivetrain_plants",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -0800213 "//y2024/control_loops/superstructure/intake_pivot:intake_pivot_plants",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800214 "@com_github_google_glog//:glog",
215 "@com_google_absl//absl/base",
216 ],
217)
218
219cc_binary(
220 name = "wpilib_interface",
221 srcs = [
222 "wpilib_interface.cc",
223 ],
224 target_compatible_with = ["//tools/platforms/hardware:roborio"],
225 deps = [
226 ":constants",
227 "//aos:init",
228 "//aos:math",
229 "//aos/containers:sized_array",
230 "//aos/events:shm_event_loop",
231 "//aos/logging",
232 "//aos/stl_mutex",
233 "//aos/time",
234 "//aos/util:log_interval",
235 "//aos/util:phased_loop",
236 "//aos/util:wrapping_counter",
237 "//frc971:can_configuration_fbs",
238 "//frc971/autonomous:auto_mode_fbs",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -0800239 "//frc971/constants:constants_sender_lib",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800240 "//frc971/control_loops:control_loop",
241 "//frc971/control_loops:control_loops_fbs",
242 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
243 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
244 "//frc971/input:robot_state_fbs",
245 "//frc971/queues:gyro_fbs",
246 "//frc971/wpilib:ADIS16448",
247 "//frc971/wpilib:buffered_pcm",
Maxwell Hendersonf75800f2024-01-12 19:52:05 -0800248 "//frc971/wpilib:can_drivetrain_writer",
249 "//frc971/wpilib:can_sensor_reader",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800250 "//frc971/wpilib:dma",
251 "//frc971/wpilib:drivetrain_writer",
252 "//frc971/wpilib:encoder_and_potentiometer",
Niko Sohmers1259b2a2024-01-29 18:00:37 -0800253 "//frc971/wpilib:generic_can_writer",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800254 "//frc971/wpilib:joystick_sender",
255 "//frc971/wpilib:logging_fbs",
256 "//frc971/wpilib:pdp_fetcher",
257 "//frc971/wpilib:sensor_reader",
Maxwell Hendersonf75800f2024-01-12 19:52:05 -0800258 "//frc971/wpilib:talonfx",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800259 "//frc971/wpilib:wpilib_robot_base",
260 "//third_party:phoenix",
261 "//third_party:phoenix6",
262 "//third_party:wpilib",
Niko Sohmersb21dbdc2024-01-20 20:06:59 -0800263 "//y2024/constants:constants_fbs",
Niko Sohmers1259b2a2024-01-29 18:00:37 -0800264 "//y2024/control_loops/superstructure:superstructure_can_position_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800265 "//y2024/control_loops/superstructure:superstructure_output_fbs",
266 "//y2024/control_loops/superstructure:superstructure_position_fbs",
267 ],
268)
269
270cc_binary(
271 name = "joystick_reader",
272 srcs = [
273 ":joystick_reader.cc",
274 ],
275 deps = [
276 ":constants",
277 "//aos:init",
278 "//aos/actions:action_lib",
279 "//aos/logging",
280 "//frc971/autonomous:auto_fbs",
281 "//frc971/autonomous:base_autonomous_actor",
282 "//frc971/control_loops:profiled_subsystem_fbs",
283 "//frc971/input:action_joystick_input",
284 "//frc971/input:drivetrain_input",
285 "//frc971/input:joystick_input",
286 "//frc971/input:redundant_joystick_data",
287 "//y2024/control_loops/drivetrain:drivetrain_base",
288 "//y2024/control_loops/superstructure:superstructure_goal_fbs",
289 "//y2024/control_loops/superstructure:superstructure_status_fbs",
290 ],
291)
292
293cc_binary(
294 name = "joystick_republish",
295 srcs = [
296 "joystick_republish.cc",
297 ],
298 target_compatible_with = ["@platforms//os:linux"],
299 visibility = ["//visibility:public"],
300 deps = [
301 "//aos:configuration",
302 "//aos:flatbuffer_merge",
303 "//aos:init",
304 "//aos/events:shm_event_loop",
305 "//frc971/input:joystick_state_fbs",
306 "@com_github_google_glog//:glog",
307 ],
308)
309
310py_library(
311 name = "python_init",
312 srcs = ["__init__.py"],
313 target_compatible_with = ["@platforms//os:linux"],
314 visibility = ["//visibility:public"],
315)
316
317sh_binary(
318 name = "log_web_proxy",
319 srcs = ["log_web_proxy.sh"],
320 data = [
321 ":aos_config",
322 "//aos/network:log_web_proxy_main",
323 "//y2024/www:files",
324 ],
325 target_compatible_with = ["@platforms//os:linux"],
326)