blob: 477608dcdf38d1b5b55945888c2c1eaf3ed9917c [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")
milind-u086d7262022-01-19 20:44:18 -08005
6robot_downloader(
milind-uf2f59aa2022-01-23 21:06:12 -08007 binaries = [
Henry Speiser0b9b0052022-03-02 23:07:40 -08008 ":setpoint_setter",
milind-uf2f59aa2022-01-23 21:06:12 -08009 "//aos/network:web_proxy_main",
10 ],
milind-u086d7262022-01-19 20:44:18 -080011 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -080012 ":aos_config",
Austin Schuh6b2edc62022-03-27 13:32:09 -070013 ":message_bridge_client.sh",
Austin Schuhde605f12022-02-23 23:08:19 -080014 "@ctre_phoenix_api_cpp_athena//:shared_libraries",
15 "@ctre_phoenix_cci_athena//:shared_libraries",
milind-u086d7262022-01-19 20:44:18 -080016 ],
Austin Schuh76f227c2022-02-23 16:34:08 -080017 dirs = [
Ravago Jones81e50632022-03-11 16:23:51 -080018 "//y2022/actors:splines",
Austin Schuh76f227c2022-02-23 16:34:08 -080019 "//y2022/www:www_files",
20 ],
milind-u086d7262022-01-19 20:44:18 -080021 start_binaries = [
milind-uf2f59aa2022-01-23 21:06:12 -080022 "//aos/events/logging:logger_main",
23 "//aos/network:web_proxy_main",
milind-u086d7262022-01-19 20:44:18 -080024 ":joystick_reader",
25 ":wpilib_interface",
milind-uf2f59aa2022-01-23 21:06:12 -080026 "//aos/network:message_bridge_client",
27 "//aos/network:message_bridge_server",
28 "//y2022/actors:binaries",
milind-u086d7262022-01-19 20:44:18 -080029 "//y2022/control_loops/drivetrain:drivetrain",
Milind Upadhyayb8abf022022-02-22 21:07:44 -080030 "//y2022/control_loops/drivetrain:trajectory_generator",
milind-u086d7262022-01-19 20:44:18 -080031 "//y2022/control_loops/superstructure:superstructure",
milind-u086d7262022-01-19 20:44:18 -080032 ],
milind-uf2f59aa2022-01-23 21:06:12 -080033 target_compatible_with = ["@platforms//os:linux"],
milind-u086d7262022-01-19 20:44:18 -080034)
35
milind-u6b6e1002022-01-22 13:26:42 -080036robot_downloader(
37 name = "pi_download",
38 binaries = [
Jim Ostrowskib9135a92022-02-06 22:49:11 -080039 "//y2020/vision:calibration",
milind-u6b6e1002022-01-22 13:26:42 -080040 "//y2022/vision:viewer",
Ravago Jonese12b7902022-02-04 22:50:44 -080041 "//y2022/localizer:imu_main",
James Kuszmaul51fa1ae2022-02-26 00:49:57 -080042 "//y2022/localizer:localizer_main",
James Kuszmaul3eb753d2022-03-12 15:21:12 -080043 "//y2022/vision:image_decimator",
Austin Schuh63f65162022-04-01 22:31:19 -070044 "//aos/events/logging:log_cat",
milind-u6b6e1002022-01-22 13:26:42 -080045 ],
46 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -080047 ":aos_config",
milind-u6b6e1002022-01-22 13:26:42 -080048 ],
James Kuszmaulb35e2342022-03-06 15:44:00 -080049 dirs = [
50 "//y2022/www:www_files",
51 ],
milind-u6b6e1002022-01-22 13:26:42 -080052 start_binaries = [
53 "//aos/events/logging:logger_main",
54 "//aos/network:message_bridge_client",
55 "//aos/network:message_bridge_server",
56 "//aos/network:web_proxy_main",
57 "//y2022/vision:camera_reader",
58 ],
59 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
60 target_type = "pi",
61)
62
milind-uf2f59aa2022-01-23 21:06:12 -080063aos_config(
Austin Schuhc5fa6d92022-02-25 14:36:28 -080064 name = "aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -080065 src = "y2022.json",
66 flatbuffers = [
67 "//aos/network:message_bridge_client_fbs",
68 "//aos/network:message_bridge_server_fbs",
69 "//aos/network:timestamp_fbs",
70 "//frc971/input:robot_state_fbs",
71 "//frc971/vision:vision_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -080072 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -080073 ],
74 target_compatible_with = ["@platforms//os:linux"],
75 visibility = ["//visibility:public"],
76 deps = [
James Kuszmaulef35d732022-02-12 16:37:32 -080077 ":config_imu",
milind-uf2f59aa2022-01-23 21:06:12 -080078 ":config_logger",
79 ":config_pi1",
80 ":config_pi2",
81 ":config_pi3",
82 ":config_pi4",
milind-uf2f59aa2022-01-23 21:06:12 -080083 ":config_roborio",
84 ],
85)
86
87[
88 aos_config(
89 name = "config_" + pi,
90 src = "y2022_" + pi + ".json",
91 flatbuffers = [
92 "//aos/network:message_bridge_client_fbs",
93 "//aos/network:message_bridge_server_fbs",
94 "//aos/network:timestamp_fbs",
95 "//aos/network:remote_message_fbs",
96 "//frc971/vision:vision_fbs",
Milind Upadhyayd67e9cf2022-03-13 13:56:57 -070097 "//y2022/localizer:localizer_output_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -080098 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -080099 "//y2022/vision:target_estimate_fbs",
100 ],
101 target_compatible_with = ["@platforms//os:linux"],
102 visibility = ["//visibility:public"],
103 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800104 "//aos/events:aos_config",
105 "//frc971/control_loops/drivetrain:aos_config",
106 "//frc971/input:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800107 ],
108 )
109 for pi in [
110 "pi1",
111 "pi2",
112 "pi3",
113 "pi4",
milind-uf2f59aa2022-01-23 21:06:12 -0800114 ]
115]
116
117aos_config(
James Kuszmaulef35d732022-02-12 16:37:32 -0800118 name = "config_imu",
119 src = "y2022_imu.json",
120 flatbuffers = [
121 "//aos/network:message_bridge_client_fbs",
122 "//aos/network:message_bridge_server_fbs",
123 "//aos/network:timestamp_fbs",
124 "//aos/network:remote_message_fbs",
James Kuszmaul51fa1ae2022-02-26 00:49:57 -0800125 "//y2022/localizer:localizer_status_fbs",
126 "//y2022/localizer:localizer_output_fbs",
James Kuszmaul0dedb5e2022-03-05 16:02:20 -0800127 "//y2022/localizer:localizer_visualization_fbs",
James Kuszmaulef35d732022-02-12 16:37:32 -0800128 ],
129 target_compatible_with = ["@platforms//os:linux"],
130 visibility = ["//visibility:public"],
131 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800132 "//aos/events:aos_config",
133 "//frc971/control_loops/drivetrain:aos_config",
James Kuszmaulef35d732022-02-12 16:37:32 -0800134 ],
135)
136
137aos_config(
milind-uf2f59aa2022-01-23 21:06:12 -0800138 name = "config_logger",
139 src = "y2022_logger.json",
140 flatbuffers = [
141 "//aos/network:message_bridge_client_fbs",
142 "//aos/network:message_bridge_server_fbs",
143 "//aos/network:timestamp_fbs",
144 "//aos/network:remote_message_fbs",
145 "//frc971/vision:vision_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -0800146 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800147 ],
148 target_compatible_with = ["@platforms//os:linux"],
149 visibility = ["//visibility:public"],
150 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800151 "//aos/events:aos_config",
152 "//frc971/control_loops/drivetrain:aos_config",
153 "//frc971/input:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800154 ],
155)
156
157aos_config(
158 name = "config_roborio",
159 src = "y2022_roborio.json",
160 flatbuffers = [
Henry Speiser0b9b0052022-03-02 23:07:40 -0800161 ":setpoint_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800162 "//aos/network:remote_message_fbs",
163 "//aos/network:message_bridge_client_fbs",
164 "//aos/network:message_bridge_server_fbs",
165 "//aos/network:timestamp_fbs",
166 "//y2019/control_loops/drivetrain:target_selector_fbs",
167 "//y2022/control_loops/superstructure:superstructure_goal_fbs",
168 "//y2022/control_loops/superstructure:superstructure_output_fbs",
169 "//y2022/control_loops/superstructure:superstructure_position_fbs",
Milind Upadhyay482b0ba2022-02-26 21:51:59 -0800170 "//y2022/control_loops/superstructure:superstructure_can_position_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800171 "//y2022/control_loops/superstructure:superstructure_status_fbs",
172 ],
173 target_compatible_with = ["@platforms//os:linux"],
174 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800175 "//aos/events:aos_config",
176 "//frc971/autonomous:aos_config",
177 "//frc971/control_loops/drivetrain:aos_config",
178 "//frc971/input:aos_config",
179 "//frc971/wpilib:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800180 ],
181)
182
183[
184 jinja2_template(
185 name = "y2022_pi" + str(num) + ".json",
186 src = "y2022_pi_template.json",
187 parameters = {"NUM": str(num)},
188 target_compatible_with = ["@platforms//os:linux"],
189 )
190 for num in range(1, 6)
191]
192
milind-u086d7262022-01-19 20:44:18 -0800193cc_library(
194 name = "constants",
195 srcs = [
196 "constants.cc",
197 ],
198 hdrs = [
199 "constants.h",
200 ],
201 visibility = ["//visibility:public"],
202 deps = [
203 "//aos/mutex",
204 "//aos/network:team_number",
205 "//frc971:constants",
206 "//frc971/control_loops:pose",
207 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
Ravago Jones3283ce02022-03-09 19:31:29 -0800208 "//frc971/shooter_interpolation:interpolation",
milind-u086d7262022-01-19 20:44:18 -0800209 "//y2022/control_loops/drivetrain:polydrivetrain_plants",
Austin Schuh39f26f62022-02-24 21:34:46 -0800210 "//y2022/control_loops/superstructure/catapult:catapult_plants",
Siddhant Kanwar0e37f592022-02-21 19:26:50 -0800211 "//y2022/control_loops/superstructure/climber:climber_plants",
Yash Chainani997a7492022-01-29 15:48:56 -0800212 "//y2022/control_loops/superstructure/intake:intake_plants",
Henry Speiser55aa3ba2022-02-21 23:21:12 -0800213 "//y2022/control_loops/superstructure/turret:turret_plants",
milind-u086d7262022-01-19 20:44:18 -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/events:shm_event_loop",
230 "//aos/logging",
231 "//aos/stl_mutex",
232 "//aos/time",
233 "//aos/util:log_interval",
234 "//aos/util:phased_loop",
235 "//aos/util:wrapping_counter",
236 "//frc971/autonomous:auto_mode_fbs",
237 "//frc971/control_loops:control_loop",
238 "//frc971/control_loops:control_loops_fbs",
239 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
240 "//frc971/input:robot_state_fbs",
Ravago Jones0e86e242022-02-12 18:38:14 -0800241 "//frc971/queues:gyro_fbs",
milind-u086d7262022-01-19 20:44:18 -0800242 "//frc971/wpilib:ADIS16448",
243 "//frc971/wpilib:buffered_pcm",
244 "//frc971/wpilib:drivetrain_writer",
245 "//frc971/wpilib:encoder_and_potentiometer",
246 "//frc971/wpilib:interrupt_edge_counting",
247 "//frc971/wpilib:joystick_sender",
248 "//frc971/wpilib:logging_fbs",
249 "//frc971/wpilib:loop_output_handler",
250 "//frc971/wpilib:pdp_fetcher",
251 "//frc971/wpilib:sensor_reader",
252 "//frc971/wpilib:wpilib_interface",
253 "//frc971/wpilib:wpilib_robot_base",
254 "//third_party:phoenix",
255 "//third_party:wpilib",
Henry Speiser77747b72022-03-06 17:18:29 -0800256 "//y2022/control_loops/superstructure:led_indicator_lib",
Milind Upadhyay482b0ba2022-02-26 21:51:59 -0800257 "//y2022/control_loops/superstructure:superstructure_can_position_fbs",
milind-u086d7262022-01-19 20:44:18 -0800258 "//y2022/control_loops/superstructure:superstructure_output_fbs",
259 "//y2022/control_loops/superstructure:superstructure_position_fbs",
260 ],
261)
262
263cc_binary(
264 name = "joystick_reader",
265 srcs = [
266 ":joystick_reader.cc",
267 ],
268 deps = [
Henry Speiser0b9b0052022-03-02 23:07:40 -0800269 ":constants",
270 ":setpoint_fbs",
milind-u086d7262022-01-19 20:44:18 -0800271 "//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 "//y2022/control_loops/drivetrain:drivetrain_base",
281 "//y2022/control_loops/superstructure:superstructure_goal_fbs",
282 "//y2022/control_loops/superstructure:superstructure_status_fbs",
283 ],
284)
Milo Lin5d49af02022-02-05 12:50:32 -0800285
Henry Speiser0b9b0052022-03-02 23:07:40 -0800286flatbuffer_cc_library(
287 name = "setpoint_fbs",
288 srcs = [
289 "setpoint.fbs",
290 ],
291 gen_reflections = 1,
292 target_compatible_with = ["@platforms//os:linux"],
293)
294
295cc_binary(
296 name = "setpoint_setter",
297 srcs = ["setpoint_setter.cc"],
298 target_compatible_with = ["@platforms//os:linux"],
299 deps = [
300 ":constants",
301 ":setpoint_fbs",
302 "//aos:init",
303 "//aos/events:shm_event_loop",
304 ],
305)
306
Milo Lin5d49af02022-02-05 12:50:32 -0800307py_library(
308 name = "python_init",
309 srcs = ["__init__.py"],
310 target_compatible_with = ["@platforms//os:linux"],
311 visibility = ["//visibility:public"],
312)
James Kuszmaulf3ef9e12022-03-05 17:13:00 -0800313
314sh_binary(
315 name = "log_web_proxy",
316 srcs = ["log_web_proxy.sh"],
317 data = [
318 ":aos_config",
319 "//aos/network:log_web_proxy_main",
320 "//y2022/www:field_main_bundle.min.js",
321 "//y2022/www:files",
322 ],
323 target_compatible_with = ["@platforms//os:linux"],
324)