blob: 48ab7f0edef7622fa0b5643fafb29207db39fd47 [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",
Austin Schuh3d3707a2022-04-02 22:39:50 -070010 "//aos/events/logging:log_cat",
milind-uf2f59aa2022-01-23 21:06:12 -080011 ],
milind-u086d7262022-01-19 20:44:18 -080012 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -080013 ":aos_config",
Austin Schuh6b2edc62022-03-27 13:32:09 -070014 ":message_bridge_client.sh",
Austin Schuhde605f12022-02-23 23:08:19 -080015 "@ctre_phoenix_api_cpp_athena//:shared_libraries",
16 "@ctre_phoenix_cci_athena//:shared_libraries",
milind-u086d7262022-01-19 20:44:18 -080017 ],
Austin Schuh76f227c2022-02-23 16:34:08 -080018 dirs = [
Ravago Jones81e50632022-03-11 16:23:51 -080019 "//y2022/actors:splines",
Austin Schuh76f227c2022-02-23 16:34:08 -080020 "//y2022/www:www_files",
21 ],
milind-u086d7262022-01-19 20:44:18 -080022 start_binaries = [
milind-uf2f59aa2022-01-23 21:06:12 -080023 "//aos/events/logging:logger_main",
24 "//aos/network:web_proxy_main",
milind-u086d7262022-01-19 20:44:18 -080025 ":joystick_reader",
26 ":wpilib_interface",
milind-uf2f59aa2022-01-23 21:06:12 -080027 "//aos/network:message_bridge_client",
28 "//aos/network:message_bridge_server",
29 "//y2022/actors:binaries",
milind-u086d7262022-01-19 20:44:18 -080030 "//y2022/control_loops/drivetrain:drivetrain",
Milind Upadhyayb8abf022022-02-22 21:07:44 -080031 "//y2022/control_loops/drivetrain:trajectory_generator",
milind-u086d7262022-01-19 20:44:18 -080032 "//y2022/control_loops/superstructure:superstructure",
milind-u086d7262022-01-19 20:44:18 -080033 ],
milind-uf2f59aa2022-01-23 21:06:12 -080034 target_compatible_with = ["@platforms//os:linux"],
milind-u086d7262022-01-19 20:44:18 -080035)
36
milind-u6b6e1002022-01-22 13:26:42 -080037robot_downloader(
38 name = "pi_download",
39 binaries = [
Jim Ostrowskib9135a92022-02-06 22:49:11 -080040 "//y2020/vision:calibration",
milind-u6b6e1002022-01-22 13:26:42 -080041 "//y2022/vision:viewer",
Ravago Jonese12b7902022-02-04 22:50:44 -080042 "//y2022/localizer:imu_main",
James Kuszmaul51fa1ae2022-02-26 00:49:57 -080043 "//y2022/localizer:localizer_main",
James Kuszmaul3eb753d2022-03-12 15:21:12 -080044 "//y2022/vision:image_decimator",
Tyler Chatowb3850c12020-02-26 20:55:48 -080045 "//y2022/image_streamer:image_streamer",
Austin Schuh63f65162022-04-01 22:31:19 -070046 "//aos/events/logging:log_cat",
milind-u6b6e1002022-01-22 13:26:42 -080047 ],
48 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -080049 ":aos_config",
Tyler Chatowb3850c12020-02-26 20:55:48 -080050 "//y2022/image_streamer:image_streamer_start",
milind-u6b6e1002022-01-22 13:26:42 -080051 ],
James Kuszmaulb35e2342022-03-06 15:44:00 -080052 dirs = [
53 "//y2022/www:www_files",
Tyler Chatowb3850c12020-02-26 20:55:48 -080054 "//y2022/image_streamer/www:www_files",
James Kuszmaulb35e2342022-03-06 15:44:00 -080055 ],
milind-u6b6e1002022-01-22 13:26:42 -080056 start_binaries = [
57 "//aos/events/logging:logger_main",
58 "//aos/network:message_bridge_client",
59 "//aos/network:message_bridge_server",
60 "//aos/network:web_proxy_main",
61 "//y2022/vision:camera_reader",
62 ],
63 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
64 target_type = "pi",
65)
66
milind-uf2f59aa2022-01-23 21:06:12 -080067aos_config(
Austin Schuhc5fa6d92022-02-25 14:36:28 -080068 name = "aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -080069 src = "y2022.json",
70 flatbuffers = [
71 "//aos/network:message_bridge_client_fbs",
72 "//aos/network:message_bridge_server_fbs",
73 "//aos/network:timestamp_fbs",
74 "//frc971/input:robot_state_fbs",
75 "//frc971/vision:vision_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -080076 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -080077 ],
78 target_compatible_with = ["@platforms//os:linux"],
79 visibility = ["//visibility:public"],
80 deps = [
James Kuszmaulef35d732022-02-12 16:37:32 -080081 ":config_imu",
milind-uf2f59aa2022-01-23 21:06:12 -080082 ":config_logger",
83 ":config_pi1",
84 ":config_pi2",
85 ":config_pi3",
86 ":config_pi4",
milind-uf2f59aa2022-01-23 21:06:12 -080087 ":config_roborio",
88 ],
89)
90
91[
92 aos_config(
93 name = "config_" + pi,
94 src = "y2022_" + pi + ".json",
95 flatbuffers = [
96 "//aos/network:message_bridge_client_fbs",
97 "//aos/network:message_bridge_server_fbs",
98 "//aos/network:timestamp_fbs",
99 "//aos/network:remote_message_fbs",
100 "//frc971/vision:vision_fbs",
Milind Upadhyayd67e9cf2022-03-13 13:56:57 -0700101 "//y2022/localizer:localizer_output_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -0800102 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800103 "//y2022/vision:target_estimate_fbs",
104 ],
105 target_compatible_with = ["@platforms//os:linux"],
106 visibility = ["//visibility:public"],
107 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800108 "//aos/events:aos_config",
109 "//frc971/control_loops/drivetrain:aos_config",
110 "//frc971/input:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800111 ],
112 )
113 for pi in [
114 "pi1",
115 "pi2",
116 "pi3",
117 "pi4",
milind-uf2f59aa2022-01-23 21:06:12 -0800118 ]
119]
120
121aos_config(
James Kuszmaulef35d732022-02-12 16:37:32 -0800122 name = "config_imu",
123 src = "y2022_imu.json",
124 flatbuffers = [
125 "//aos/network:message_bridge_client_fbs",
126 "//aos/network:message_bridge_server_fbs",
127 "//aos/network:timestamp_fbs",
128 "//aos/network:remote_message_fbs",
James Kuszmaul51fa1ae2022-02-26 00:49:57 -0800129 "//y2022/localizer:localizer_status_fbs",
130 "//y2022/localizer:localizer_output_fbs",
James Kuszmaul0dedb5e2022-03-05 16:02:20 -0800131 "//y2022/localizer:localizer_visualization_fbs",
James Kuszmaulef35d732022-02-12 16:37:32 -0800132 ],
133 target_compatible_with = ["@platforms//os:linux"],
134 visibility = ["//visibility:public"],
135 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800136 "//aos/events:aos_config",
137 "//frc971/control_loops/drivetrain:aos_config",
James Kuszmaulef35d732022-02-12 16:37:32 -0800138 ],
139)
140
141aos_config(
milind-uf2f59aa2022-01-23 21:06:12 -0800142 name = "config_logger",
143 src = "y2022_logger.json",
144 flatbuffers = [
145 "//aos/network:message_bridge_client_fbs",
146 "//aos/network:message_bridge_server_fbs",
147 "//aos/network:timestamp_fbs",
148 "//aos/network:remote_message_fbs",
149 "//frc971/vision:vision_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -0800150 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800151 ],
152 target_compatible_with = ["@platforms//os:linux"],
153 visibility = ["//visibility:public"],
154 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800155 "//aos/events:aos_config",
156 "//frc971/control_loops/drivetrain:aos_config",
157 "//frc971/input:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800158 ],
159)
160
161aos_config(
162 name = "config_roborio",
163 src = "y2022_roborio.json",
164 flatbuffers = [
Henry Speiser0b9b0052022-03-02 23:07:40 -0800165 ":setpoint_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800166 "//aos/network:remote_message_fbs",
167 "//aos/network:message_bridge_client_fbs",
168 "//aos/network:message_bridge_server_fbs",
169 "//aos/network:timestamp_fbs",
170 "//y2019/control_loops/drivetrain:target_selector_fbs",
171 "//y2022/control_loops/superstructure:superstructure_goal_fbs",
172 "//y2022/control_loops/superstructure:superstructure_output_fbs",
173 "//y2022/control_loops/superstructure:superstructure_position_fbs",
Milind Upadhyay482b0ba2022-02-26 21:51:59 -0800174 "//y2022/control_loops/superstructure:superstructure_can_position_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800175 "//y2022/control_loops/superstructure:superstructure_status_fbs",
176 ],
177 target_compatible_with = ["@platforms//os:linux"],
178 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800179 "//aos/events:aos_config",
180 "//frc971/autonomous:aos_config",
181 "//frc971/control_loops/drivetrain:aos_config",
182 "//frc971/input:aos_config",
183 "//frc971/wpilib:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800184 ],
185)
186
187[
188 jinja2_template(
189 name = "y2022_pi" + str(num) + ".json",
190 src = "y2022_pi_template.json",
191 parameters = {"NUM": str(num)},
192 target_compatible_with = ["@platforms//os:linux"],
193 )
194 for num in range(1, 6)
195]
196
milind-u086d7262022-01-19 20:44:18 -0800197cc_library(
198 name = "constants",
199 srcs = [
200 "constants.cc",
201 ],
202 hdrs = [
203 "constants.h",
204 ],
205 visibility = ["//visibility:public"],
206 deps = [
207 "//aos/mutex",
208 "//aos/network:team_number",
209 "//frc971:constants",
210 "//frc971/control_loops:pose",
211 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
Ravago Jones3283ce02022-03-09 19:31:29 -0800212 "//frc971/shooter_interpolation:interpolation",
milind-u086d7262022-01-19 20:44:18 -0800213 "//y2022/control_loops/drivetrain:polydrivetrain_plants",
Austin Schuh39f26f62022-02-24 21:34:46 -0800214 "//y2022/control_loops/superstructure/catapult:catapult_plants",
Siddhant Kanwar0e37f592022-02-21 19:26:50 -0800215 "//y2022/control_loops/superstructure/climber:climber_plants",
Yash Chainani997a7492022-01-29 15:48:56 -0800216 "//y2022/control_loops/superstructure/intake:intake_plants",
Henry Speiser55aa3ba2022-02-21 23:21:12 -0800217 "//y2022/control_loops/superstructure/turret:turret_plants",
milind-u086d7262022-01-19 20:44:18 -0800218 "@com_github_google_glog//:glog",
219 "@com_google_absl//absl/base",
220 ],
221)
222
223cc_binary(
224 name = "wpilib_interface",
225 srcs = [
226 "wpilib_interface.cc",
227 ],
228 target_compatible_with = ["//tools/platforms/hardware:roborio"],
229 deps = [
230 ":constants",
231 "//aos:init",
232 "//aos:math",
233 "//aos/events:shm_event_loop",
234 "//aos/logging",
235 "//aos/stl_mutex",
236 "//aos/time",
237 "//aos/util:log_interval",
238 "//aos/util:phased_loop",
239 "//aos/util:wrapping_counter",
240 "//frc971/autonomous:auto_mode_fbs",
241 "//frc971/control_loops:control_loop",
242 "//frc971/control_loops:control_loops_fbs",
243 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
244 "//frc971/input:robot_state_fbs",
Ravago Jones0e86e242022-02-12 18:38:14 -0800245 "//frc971/queues:gyro_fbs",
milind-u086d7262022-01-19 20:44:18 -0800246 "//frc971/wpilib:ADIS16448",
247 "//frc971/wpilib:buffered_pcm",
248 "//frc971/wpilib:drivetrain_writer",
249 "//frc971/wpilib:encoder_and_potentiometer",
250 "//frc971/wpilib:interrupt_edge_counting",
251 "//frc971/wpilib:joystick_sender",
252 "//frc971/wpilib:logging_fbs",
253 "//frc971/wpilib:loop_output_handler",
254 "//frc971/wpilib:pdp_fetcher",
255 "//frc971/wpilib:sensor_reader",
256 "//frc971/wpilib:wpilib_interface",
257 "//frc971/wpilib:wpilib_robot_base",
258 "//third_party:phoenix",
259 "//third_party:wpilib",
Henry Speiser77747b72022-03-06 17:18:29 -0800260 "//y2022/control_loops/superstructure:led_indicator_lib",
Milind Upadhyay482b0ba2022-02-26 21:51:59 -0800261 "//y2022/control_loops/superstructure:superstructure_can_position_fbs",
milind-u086d7262022-01-19 20:44:18 -0800262 "//y2022/control_loops/superstructure:superstructure_output_fbs",
263 "//y2022/control_loops/superstructure:superstructure_position_fbs",
264 ],
265)
266
267cc_binary(
268 name = "joystick_reader",
269 srcs = [
270 ":joystick_reader.cc",
271 ],
272 deps = [
Henry Speiser0b9b0052022-03-02 23:07:40 -0800273 ":constants",
274 ":setpoint_fbs",
milind-u086d7262022-01-19 20:44:18 -0800275 "//aos:init",
276 "//aos/actions:action_lib",
277 "//aos/logging",
278 "//frc971/autonomous:auto_fbs",
279 "//frc971/autonomous:base_autonomous_actor",
280 "//frc971/control_loops:profiled_subsystem_fbs",
281 "//frc971/input:action_joystick_input",
282 "//frc971/input:drivetrain_input",
283 "//frc971/input:joystick_input",
284 "//y2022/control_loops/drivetrain:drivetrain_base",
285 "//y2022/control_loops/superstructure:superstructure_goal_fbs",
286 "//y2022/control_loops/superstructure:superstructure_status_fbs",
287 ],
288)
Milo Lin5d49af02022-02-05 12:50:32 -0800289
Henry Speiser0b9b0052022-03-02 23:07:40 -0800290flatbuffer_cc_library(
291 name = "setpoint_fbs",
292 srcs = [
293 "setpoint.fbs",
294 ],
295 gen_reflections = 1,
296 target_compatible_with = ["@platforms//os:linux"],
297)
298
299cc_binary(
300 name = "setpoint_setter",
301 srcs = ["setpoint_setter.cc"],
302 target_compatible_with = ["@platforms//os:linux"],
303 deps = [
304 ":constants",
305 ":setpoint_fbs",
306 "//aos:init",
307 "//aos/events:shm_event_loop",
308 ],
309)
310
Milo Lin5d49af02022-02-05 12:50:32 -0800311py_library(
312 name = "python_init",
313 srcs = ["__init__.py"],
314 target_compatible_with = ["@platforms//os:linux"],
315 visibility = ["//visibility:public"],
316)
James Kuszmaulf3ef9e12022-03-05 17:13:00 -0800317
318sh_binary(
319 name = "log_web_proxy",
320 srcs = ["log_web_proxy.sh"],
321 data = [
322 ":aos_config",
323 "//aos/network:log_web_proxy_main",
324 "//y2022/www:field_main_bundle.min.js",
325 "//y2022/www:files",
326 ],
327 target_compatible_with = ["@platforms//os:linux"],
328)