blob: f25925e6b8ecd4cb59d355ef6b6c7282ba8b5527 [file] [log] [blame]
milind-u086d7262022-01-19 20:44:18 -08001load("//frc971:downloader.bzl", "robot_downloader")
2load("//aos:config.bzl", "aos_config")
Henry Speiser0b9b0052022-03-02 23:07:40 -08003load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
milind-uf2f59aa2022-01-23 21:06:12 -08004load("//tools/build_rules:template.bzl", "jinja2_template")
James Kuszmaule50ef1e2023-05-16 21:08:04 -07005load("//aos/util:config_validator_macro.bzl", "config_validator_test")
6
7config_validator_test(
8 name = "config_validator_test",
9 config = "//y2022:aos_config",
10)
milind-u086d7262022-01-19 20:44:18 -080011
12robot_downloader(
milind-uf2f59aa2022-01-23 21:06:12 -080013 binaries = [
Henry Speiser0b9b0052022-03-02 23:07:40 -080014 ":setpoint_setter",
milind-uf2f59aa2022-01-23 21:06:12 -080015 "//aos/network:web_proxy_main",
Austin Schuh3d3707a2022-04-02 22:39:50 -070016 "//aos/events/logging:log_cat",
milind-uf2f59aa2022-01-23 21:06:12 -080017 ],
milind-u086d7262022-01-19 20:44:18 -080018 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -080019 ":aos_config",
Austin Schuh6b2edc62022-03-27 13:32:09 -070020 ":message_bridge_client.sh",
Maxwell Hendersonfcc0d122023-08-05 17:03:34 -070021 "@ctre_phoenix6_api_cpp_athena//:shared_libraries",
22 "@ctre_phoenix6_tools_athena//:shared_libraries",
Austin Schuhde605f12022-02-23 23:08:19 -080023 "@ctre_phoenix_api_cpp_athena//:shared_libraries",
24 "@ctre_phoenix_cci_athena//:shared_libraries",
milind-u086d7262022-01-19 20:44:18 -080025 ],
Austin Schuh76f227c2022-02-23 16:34:08 -080026 dirs = [
Ravago Jones81e50632022-03-11 16:23:51 -080027 "//y2022/actors:splines",
Austin Schuh76f227c2022-02-23 16:34:08 -080028 "//y2022/www:www_files",
29 ],
milind-u086d7262022-01-19 20:44:18 -080030 start_binaries = [
milind-uf2f59aa2022-01-23 21:06:12 -080031 "//aos/events/logging:logger_main",
32 "//aos/network:web_proxy_main",
milind-u086d7262022-01-19 20:44:18 -080033 ":joystick_reader",
34 ":wpilib_interface",
milind-uf2f59aa2022-01-23 21:06:12 -080035 "//aos/network:message_bridge_client",
36 "//aos/network:message_bridge_server",
37 "//y2022/actors:binaries",
milind-u086d7262022-01-19 20:44:18 -080038 "//y2022/control_loops/drivetrain:drivetrain",
Milind Upadhyayb8abf022022-02-22 21:07:44 -080039 "//y2022/control_loops/drivetrain:trajectory_generator",
milind-u086d7262022-01-19 20:44:18 -080040 "//y2022/control_loops/superstructure:superstructure",
milind-u086d7262022-01-19 20:44:18 -080041 ],
milind-uf2f59aa2022-01-23 21:06:12 -080042 target_compatible_with = ["@platforms//os:linux"],
milind-u086d7262022-01-19 20:44:18 -080043)
44
milind-u6b6e1002022-01-22 13:26:42 -080045robot_downloader(
46 name = "pi_download",
47 binaries = [
James Kuszmaul7e958812023-02-11 15:34:31 -080048 "//frc971/vision:intrinsics_calibration",
milind-u6b6e1002022-01-22 13:26:42 -080049 "//y2022/vision:viewer",
Ravago Jonese12b7902022-02-04 22:50:44 -080050 "//y2022/localizer:imu_main",
James Kuszmaul51fa1ae2022-02-26 00:49:57 -080051 "//y2022/localizer:localizer_main",
James Kuszmaul3eb753d2022-03-12 15:21:12 -080052 "//y2022/vision:image_decimator",
milind-ub0773e92023-02-05 15:57:43 -080053 "//frc971/image_streamer:image_streamer",
Austin Schuh63f65162022-04-01 22:31:19 -070054 "//aos/events/logging:log_cat",
milind-u6b6e1002022-01-22 13:26:42 -080055 ],
56 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -080057 ":aos_config",
Austin Schuh37559162022-11-09 09:45:15 -080058 ":message_bridge_client.sh",
milind-ub0773e92023-02-05 15:57:43 -080059 "//y2022/vision:image_streamer_start",
milind-u6b6e1002022-01-22 13:26:42 -080060 ],
James Kuszmaulb35e2342022-03-06 15:44:00 -080061 dirs = [
62 "//y2022/www:www_files",
milind-ub0773e92023-02-05 15:57:43 -080063 "//frc971/image_streamer/www:www_files",
James Kuszmaulb35e2342022-03-06 15:44:00 -080064 ],
milind-u6b6e1002022-01-22 13:26:42 -080065 start_binaries = [
66 "//aos/events/logging:logger_main",
67 "//aos/network:message_bridge_client",
68 "//aos/network:message_bridge_server",
69 "//aos/network:web_proxy_main",
70 "//y2022/vision:camera_reader",
Ravago Jones32bd3cb2022-03-26 15:45:03 -070071 "//y2022/vision:ball_color_detector",
milind-u6b6e1002022-01-22 13:26:42 -080072 ],
73 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
74 target_type = "pi",
75)
76
milind-uf2f59aa2022-01-23 21:06:12 -080077aos_config(
Austin Schuhc5fa6d92022-02-25 14:36:28 -080078 name = "aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -080079 src = "y2022.json",
80 flatbuffers = [
81 "//aos/network:message_bridge_client_fbs",
82 "//aos/network:message_bridge_server_fbs",
83 "//aos/network:timestamp_fbs",
84 "//frc971/input:robot_state_fbs",
85 "//frc971/vision:vision_fbs",
milind-u2f101fc2023-01-21 12:28:49 -080086 "//frc971/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -080087 ],
88 target_compatible_with = ["@platforms//os:linux"],
89 visibility = ["//visibility:public"],
90 deps = [
James Kuszmaulef35d732022-02-12 16:37:32 -080091 ":config_imu",
milind-uf2f59aa2022-01-23 21:06:12 -080092 ":config_logger",
93 ":config_pi1",
94 ":config_pi2",
95 ":config_pi3",
96 ":config_pi4",
milind-uf2f59aa2022-01-23 21:06:12 -080097 ":config_roborio",
98 ],
99)
100
101[
102 aos_config(
103 name = "config_" + pi,
104 src = "y2022_" + pi + ".json",
105 flatbuffers = [
106 "//aos/network:message_bridge_client_fbs",
107 "//aos/network:message_bridge_server_fbs",
108 "//aos/network:timestamp_fbs",
109 "//aos/network:remote_message_fbs",
110 "//frc971/vision:vision_fbs",
James Kuszmaule3df1ed2023-02-20 16:21:17 -0800111 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
milind-u2f101fc2023-01-21 12:28:49 -0800112 "//frc971/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800113 "//y2022/vision:target_estimate_fbs",
Ravago Jones32bd3cb2022-03-26 15:45:03 -0700114 "//y2022/vision:ball_color_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800115 ],
116 target_compatible_with = ["@platforms//os:linux"],
117 visibility = ["//visibility:public"],
118 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800119 "//aos/events:aos_config",
120 "//frc971/control_loops/drivetrain:aos_config",
121 "//frc971/input:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800122 ],
123 )
124 for pi in [
125 "pi1",
126 "pi2",
127 "pi3",
128 "pi4",
milind-uf2f59aa2022-01-23 21:06:12 -0800129 ]
130]
131
132aos_config(
James Kuszmaulef35d732022-02-12 16:37:32 -0800133 name = "config_imu",
134 src = "y2022_imu.json",
135 flatbuffers = [
136 "//aos/network:message_bridge_client_fbs",
137 "//aos/network:message_bridge_server_fbs",
138 "//aos/network:timestamp_fbs",
139 "//aos/network:remote_message_fbs",
James Kuszmaul51fa1ae2022-02-26 00:49:57 -0800140 "//y2022/localizer:localizer_status_fbs",
James Kuszmaule3df1ed2023-02-20 16:21:17 -0800141 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
James Kuszmaul0dedb5e2022-03-05 16:02:20 -0800142 "//y2022/localizer:localizer_visualization_fbs",
James Kuszmaulef35d732022-02-12 16:37:32 -0800143 ],
144 target_compatible_with = ["@platforms//os:linux"],
145 visibility = ["//visibility:public"],
146 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800147 "//aos/events:aos_config",
148 "//frc971/control_loops/drivetrain:aos_config",
James Kuszmaulef35d732022-02-12 16:37:32 -0800149 ],
150)
151
152aos_config(
milind-uf2f59aa2022-01-23 21:06:12 -0800153 name = "config_logger",
154 src = "y2022_logger.json",
155 flatbuffers = [
156 "//aos/network:message_bridge_client_fbs",
157 "//aos/network:message_bridge_server_fbs",
158 "//aos/network:timestamp_fbs",
159 "//aos/network:remote_message_fbs",
160 "//frc971/vision:vision_fbs",
milind-u2f101fc2023-01-21 12:28:49 -0800161 "//frc971/vision:calibration_fbs",
Ravago Jones32bd3cb2022-03-26 15:45:03 -0700162 "//y2022/vision:ball_color_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800163 ],
164 target_compatible_with = ["@platforms//os:linux"],
165 visibility = ["//visibility:public"],
166 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800167 "//aos/events:aos_config",
168 "//frc971/control_loops/drivetrain:aos_config",
169 "//frc971/input:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800170 ],
171)
172
173aos_config(
174 name = "config_roborio",
175 src = "y2022_roborio.json",
176 flatbuffers = [
Henry Speiser0b9b0052022-03-02 23:07:40 -0800177 ":setpoint_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800178 "//aos/network:remote_message_fbs",
179 "//aos/network:message_bridge_client_fbs",
180 "//aos/network:message_bridge_server_fbs",
181 "//aos/network:timestamp_fbs",
Ravago Jones32bd3cb2022-03-26 15:45:03 -0700182 "//y2022/vision:ball_color_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800183 "//y2019/control_loops/drivetrain:target_selector_fbs",
184 "//y2022/control_loops/superstructure:superstructure_goal_fbs",
185 "//y2022/control_loops/superstructure:superstructure_output_fbs",
186 "//y2022/control_loops/superstructure:superstructure_position_fbs",
Milind Upadhyay482b0ba2022-02-26 21:51:59 -0800187 "//y2022/control_loops/superstructure:superstructure_can_position_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800188 "//y2022/control_loops/superstructure:superstructure_status_fbs",
189 ],
190 target_compatible_with = ["@platforms//os:linux"],
191 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800192 "//aos/events:aos_config",
193 "//frc971/autonomous:aos_config",
194 "//frc971/control_loops/drivetrain:aos_config",
195 "//frc971/input:aos_config",
196 "//frc971/wpilib:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800197 ],
198)
199
200[
201 jinja2_template(
202 name = "y2022_pi" + str(num) + ".json",
203 src = "y2022_pi_template.json",
204 parameters = {"NUM": str(num)},
205 target_compatible_with = ["@platforms//os:linux"],
206 )
207 for num in range(1, 6)
208]
209
milind-u086d7262022-01-19 20:44:18 -0800210cc_library(
211 name = "constants",
212 srcs = [
213 "constants.cc",
214 ],
215 hdrs = [
216 "constants.h",
217 ],
218 visibility = ["//visibility:public"],
219 deps = [
220 "//aos/mutex",
221 "//aos/network:team_number",
222 "//frc971:constants",
223 "//frc971/control_loops:pose",
224 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
Ravago Jones3283ce02022-03-09 19:31:29 -0800225 "//frc971/shooter_interpolation:interpolation",
Nathan Leong342b85e2023-01-08 13:49:33 -0800226 "//frc971/wpilib:wpilib_utils",
milind-u086d7262022-01-19 20:44:18 -0800227 "//y2022/control_loops/drivetrain:polydrivetrain_plants",
Austin Schuh39f26f62022-02-24 21:34:46 -0800228 "//y2022/control_loops/superstructure/catapult:catapult_plants",
Siddhant Kanwar0e37f592022-02-21 19:26:50 -0800229 "//y2022/control_loops/superstructure/climber:climber_plants",
Yash Chainani997a7492022-01-29 15:48:56 -0800230 "//y2022/control_loops/superstructure/intake:intake_plants",
Henry Speiser55aa3ba2022-02-21 23:21:12 -0800231 "//y2022/control_loops/superstructure/turret:turret_plants",
milind-u086d7262022-01-19 20:44:18 -0800232 "@com_github_google_glog//:glog",
233 "@com_google_absl//absl/base",
234 ],
235)
236
237cc_binary(
238 name = "wpilib_interface",
239 srcs = [
240 "wpilib_interface.cc",
241 ],
242 target_compatible_with = ["//tools/platforms/hardware:roborio"],
243 deps = [
244 ":constants",
245 "//aos:init",
246 "//aos:math",
247 "//aos/events:shm_event_loop",
248 "//aos/logging",
249 "//aos/stl_mutex",
250 "//aos/time",
251 "//aos/util:log_interval",
252 "//aos/util:phased_loop",
253 "//aos/util:wrapping_counter",
254 "//frc971/autonomous:auto_mode_fbs",
255 "//frc971/control_loops:control_loop",
256 "//frc971/control_loops:control_loops_fbs",
257 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
258 "//frc971/input:robot_state_fbs",
Ravago Jones0e86e242022-02-12 18:38:14 -0800259 "//frc971/queues:gyro_fbs",
milind-u086d7262022-01-19 20:44:18 -0800260 "//frc971/wpilib:ADIS16448",
261 "//frc971/wpilib:buffered_pcm",
262 "//frc971/wpilib:drivetrain_writer",
263 "//frc971/wpilib:encoder_and_potentiometer",
264 "//frc971/wpilib:interrupt_edge_counting",
265 "//frc971/wpilib:joystick_sender",
266 "//frc971/wpilib:logging_fbs",
267 "//frc971/wpilib:loop_output_handler",
268 "//frc971/wpilib:pdp_fetcher",
269 "//frc971/wpilib:sensor_reader",
270 "//frc971/wpilib:wpilib_interface",
271 "//frc971/wpilib:wpilib_robot_base",
272 "//third_party:phoenix",
Maxwell Hendersonfcc0d122023-08-05 17:03:34 -0700273 "//third_party:phoenix6",
milind-u086d7262022-01-19 20:44:18 -0800274 "//third_party:wpilib",
Henry Speiser77747b72022-03-06 17:18:29 -0800275 "//y2022/control_loops/superstructure:led_indicator_lib",
Milind Upadhyay482b0ba2022-02-26 21:51:59 -0800276 "//y2022/control_loops/superstructure:superstructure_can_position_fbs",
milind-u086d7262022-01-19 20:44:18 -0800277 "//y2022/control_loops/superstructure:superstructure_output_fbs",
278 "//y2022/control_loops/superstructure:superstructure_position_fbs",
279 ],
280)
281
282cc_binary(
283 name = "joystick_reader",
284 srcs = [
285 ":joystick_reader.cc",
286 ],
287 deps = [
Henry Speiser0b9b0052022-03-02 23:07:40 -0800288 ":constants",
289 ":setpoint_fbs",
milind-u086d7262022-01-19 20:44:18 -0800290 "//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 "//y2022/control_loops/drivetrain:drivetrain_base",
300 "//y2022/control_loops/superstructure:superstructure_goal_fbs",
301 "//y2022/control_loops/superstructure:superstructure_status_fbs",
302 ],
303)
Milo Lin5d49af02022-02-05 12:50:32 -0800304
Henry Speiser0b9b0052022-03-02 23:07:40 -0800305flatbuffer_cc_library(
306 name = "setpoint_fbs",
307 srcs = [
308 "setpoint.fbs",
309 ],
310 gen_reflections = 1,
311 target_compatible_with = ["@platforms//os:linux"],
312)
313
314cc_binary(
315 name = "setpoint_setter",
316 srcs = ["setpoint_setter.cc"],
317 target_compatible_with = ["@platforms//os:linux"],
318 deps = [
319 ":constants",
320 ":setpoint_fbs",
321 "//aos:init",
322 "//aos/events:shm_event_loop",
323 ],
324)
325
Milo Lin5d49af02022-02-05 12:50:32 -0800326py_library(
327 name = "python_init",
328 srcs = ["__init__.py"],
329 target_compatible_with = ["@platforms//os:linux"],
330 visibility = ["//visibility:public"],
331)
James Kuszmaulf3ef9e12022-03-05 17:13:00 -0800332
333sh_binary(
334 name = "log_web_proxy",
335 srcs = ["log_web_proxy.sh"],
336 data = [
337 ":aos_config",
338 "//aos/network:log_web_proxy_main",
339 "//y2022/www:field_main_bundle.min.js",
340 "//y2022/www:files",
341 ],
342 target_compatible_with = ["@platforms//os:linux"],
343)