blob: 9e80b5f88032c861e4e957205ef95e3ca7f8d870 [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",
milind-u6b6e1002022-01-22 13:26:42 -080044 ],
45 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -080046 ":aos_config",
milind-u6b6e1002022-01-22 13:26:42 -080047 ],
James Kuszmaulb35e2342022-03-06 15:44:00 -080048 dirs = [
49 "//y2022/www:www_files",
50 ],
milind-u6b6e1002022-01-22 13:26:42 -080051 start_binaries = [
52 "//aos/events/logging:logger_main",
53 "//aos/network:message_bridge_client",
54 "//aos/network:message_bridge_server",
55 "//aos/network:web_proxy_main",
56 "//y2022/vision:camera_reader",
57 ],
58 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
59 target_type = "pi",
60)
61
milind-uf2f59aa2022-01-23 21:06:12 -080062aos_config(
Austin Schuhc5fa6d92022-02-25 14:36:28 -080063 name = "aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -080064 src = "y2022.json",
65 flatbuffers = [
66 "//aos/network:message_bridge_client_fbs",
67 "//aos/network:message_bridge_server_fbs",
68 "//aos/network:timestamp_fbs",
69 "//frc971/input:robot_state_fbs",
70 "//frc971/vision:vision_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -080071 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -080072 ],
73 target_compatible_with = ["@platforms//os:linux"],
74 visibility = ["//visibility:public"],
75 deps = [
James Kuszmaulef35d732022-02-12 16:37:32 -080076 ":config_imu",
milind-uf2f59aa2022-01-23 21:06:12 -080077 ":config_logger",
78 ":config_pi1",
79 ":config_pi2",
80 ":config_pi3",
81 ":config_pi4",
milind-uf2f59aa2022-01-23 21:06:12 -080082 ":config_roborio",
83 ],
84)
85
86[
87 aos_config(
88 name = "config_" + pi,
89 src = "y2022_" + pi + ".json",
90 flatbuffers = [
91 "//aos/network:message_bridge_client_fbs",
92 "//aos/network:message_bridge_server_fbs",
93 "//aos/network:timestamp_fbs",
94 "//aos/network:remote_message_fbs",
95 "//frc971/vision:vision_fbs",
Milind Upadhyayd67e9cf2022-03-13 13:56:57 -070096 "//y2022/localizer:localizer_output_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -080097 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -080098 "//y2022/vision:target_estimate_fbs",
99 ],
100 target_compatible_with = ["@platforms//os:linux"],
101 visibility = ["//visibility:public"],
102 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800103 "//aos/events:aos_config",
104 "//frc971/control_loops/drivetrain:aos_config",
105 "//frc971/input:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800106 ],
107 )
108 for pi in [
109 "pi1",
110 "pi2",
111 "pi3",
112 "pi4",
milind-uf2f59aa2022-01-23 21:06:12 -0800113 ]
114]
115
116aos_config(
James Kuszmaulef35d732022-02-12 16:37:32 -0800117 name = "config_imu",
118 src = "y2022_imu.json",
119 flatbuffers = [
120 "//aos/network:message_bridge_client_fbs",
121 "//aos/network:message_bridge_server_fbs",
122 "//aos/network:timestamp_fbs",
123 "//aos/network:remote_message_fbs",
James Kuszmaul51fa1ae2022-02-26 00:49:57 -0800124 "//y2022/localizer:localizer_status_fbs",
125 "//y2022/localizer:localizer_output_fbs",
James Kuszmaul0dedb5e2022-03-05 16:02:20 -0800126 "//y2022/localizer:localizer_visualization_fbs",
James Kuszmaulef35d732022-02-12 16:37:32 -0800127 ],
128 target_compatible_with = ["@platforms//os:linux"],
129 visibility = ["//visibility:public"],
130 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800131 "//aos/events:aos_config",
132 "//frc971/control_loops/drivetrain:aos_config",
James Kuszmaulef35d732022-02-12 16:37:32 -0800133 ],
134)
135
136aos_config(
milind-uf2f59aa2022-01-23 21:06:12 -0800137 name = "config_logger",
138 src = "y2022_logger.json",
139 flatbuffers = [
140 "//aos/network:message_bridge_client_fbs",
141 "//aos/network:message_bridge_server_fbs",
142 "//aos/network:timestamp_fbs",
143 "//aos/network:remote_message_fbs",
144 "//frc971/vision:vision_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -0800145 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800146 ],
147 target_compatible_with = ["@platforms//os:linux"],
148 visibility = ["//visibility:public"],
149 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800150 "//aos/events:aos_config",
151 "//frc971/control_loops/drivetrain:aos_config",
152 "//frc971/input:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800153 ],
154)
155
156aos_config(
157 name = "config_roborio",
158 src = "y2022_roborio.json",
159 flatbuffers = [
Henry Speiser0b9b0052022-03-02 23:07:40 -0800160 ":setpoint_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800161 "//aos/network:remote_message_fbs",
162 "//aos/network:message_bridge_client_fbs",
163 "//aos/network:message_bridge_server_fbs",
164 "//aos/network:timestamp_fbs",
165 "//y2019/control_loops/drivetrain:target_selector_fbs",
166 "//y2022/control_loops/superstructure:superstructure_goal_fbs",
167 "//y2022/control_loops/superstructure:superstructure_output_fbs",
168 "//y2022/control_loops/superstructure:superstructure_position_fbs",
Milind Upadhyay482b0ba2022-02-26 21:51:59 -0800169 "//y2022/control_loops/superstructure:superstructure_can_position_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800170 "//y2022/control_loops/superstructure:superstructure_status_fbs",
171 ],
172 target_compatible_with = ["@platforms//os:linux"],
173 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800174 "//aos/events:aos_config",
175 "//frc971/autonomous:aos_config",
176 "//frc971/control_loops/drivetrain:aos_config",
177 "//frc971/input:aos_config",
178 "//frc971/wpilib:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800179 ],
180)
181
182[
183 jinja2_template(
184 name = "y2022_pi" + str(num) + ".json",
185 src = "y2022_pi_template.json",
186 parameters = {"NUM": str(num)},
187 target_compatible_with = ["@platforms//os:linux"],
188 )
189 for num in range(1, 6)
190]
191
milind-u086d7262022-01-19 20:44:18 -0800192cc_library(
193 name = "constants",
194 srcs = [
195 "constants.cc",
196 ],
197 hdrs = [
198 "constants.h",
199 ],
200 visibility = ["//visibility:public"],
201 deps = [
202 "//aos/mutex",
203 "//aos/network:team_number",
204 "//frc971:constants",
205 "//frc971/control_loops:pose",
206 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
Ravago Jones3283ce02022-03-09 19:31:29 -0800207 "//frc971/shooter_interpolation:interpolation",
milind-u086d7262022-01-19 20:44:18 -0800208 "//y2022/control_loops/drivetrain:polydrivetrain_plants",
Austin Schuh39f26f62022-02-24 21:34:46 -0800209 "//y2022/control_loops/superstructure/catapult:catapult_plants",
Siddhant Kanwar0e37f592022-02-21 19:26:50 -0800210 "//y2022/control_loops/superstructure/climber:climber_plants",
Yash Chainani997a7492022-01-29 15:48:56 -0800211 "//y2022/control_loops/superstructure/intake:intake_plants",
Henry Speiser55aa3ba2022-02-21 23:21:12 -0800212 "//y2022/control_loops/superstructure/turret:turret_plants",
milind-u086d7262022-01-19 20:44:18 -0800213 "@com_github_google_glog//:glog",
214 "@com_google_absl//absl/base",
215 ],
216)
217
218cc_binary(
219 name = "wpilib_interface",
220 srcs = [
221 "wpilib_interface.cc",
222 ],
223 target_compatible_with = ["//tools/platforms/hardware:roborio"],
224 deps = [
225 ":constants",
226 "//aos:init",
227 "//aos:math",
228 "//aos/events:shm_event_loop",
229 "//aos/logging",
230 "//aos/stl_mutex",
231 "//aos/time",
232 "//aos/util:log_interval",
233 "//aos/util:phased_loop",
234 "//aos/util:wrapping_counter",
235 "//frc971/autonomous:auto_mode_fbs",
236 "//frc971/control_loops:control_loop",
237 "//frc971/control_loops:control_loops_fbs",
238 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
239 "//frc971/input:robot_state_fbs",
Ravago Jones0e86e242022-02-12 18:38:14 -0800240 "//frc971/queues:gyro_fbs",
milind-u086d7262022-01-19 20:44:18 -0800241 "//frc971/wpilib:ADIS16448",
242 "//frc971/wpilib:buffered_pcm",
243 "//frc971/wpilib:drivetrain_writer",
244 "//frc971/wpilib:encoder_and_potentiometer",
245 "//frc971/wpilib:interrupt_edge_counting",
246 "//frc971/wpilib:joystick_sender",
247 "//frc971/wpilib:logging_fbs",
248 "//frc971/wpilib:loop_output_handler",
249 "//frc971/wpilib:pdp_fetcher",
250 "//frc971/wpilib:sensor_reader",
251 "//frc971/wpilib:wpilib_interface",
252 "//frc971/wpilib:wpilib_robot_base",
253 "//third_party:phoenix",
254 "//third_party:wpilib",
Henry Speiser77747b72022-03-06 17:18:29 -0800255 "//y2022/control_loops/superstructure:led_indicator_lib",
Milind Upadhyay482b0ba2022-02-26 21:51:59 -0800256 "//y2022/control_loops/superstructure:superstructure_can_position_fbs",
milind-u086d7262022-01-19 20:44:18 -0800257 "//y2022/control_loops/superstructure:superstructure_output_fbs",
258 "//y2022/control_loops/superstructure:superstructure_position_fbs",
259 ],
260)
261
262cc_binary(
263 name = "joystick_reader",
264 srcs = [
265 ":joystick_reader.cc",
266 ],
267 deps = [
Henry Speiser0b9b0052022-03-02 23:07:40 -0800268 ":constants",
269 ":setpoint_fbs",
milind-u086d7262022-01-19 20:44:18 -0800270 "//aos:init",
271 "//aos/actions:action_lib",
272 "//aos/logging",
273 "//frc971/autonomous:auto_fbs",
274 "//frc971/autonomous:base_autonomous_actor",
275 "//frc971/control_loops:profiled_subsystem_fbs",
276 "//frc971/input:action_joystick_input",
277 "//frc971/input:drivetrain_input",
278 "//frc971/input:joystick_input",
279 "//y2022/control_loops/drivetrain:drivetrain_base",
280 "//y2022/control_loops/superstructure:superstructure_goal_fbs",
281 "//y2022/control_loops/superstructure:superstructure_status_fbs",
282 ],
283)
Milo Lin5d49af02022-02-05 12:50:32 -0800284
Henry Speiser0b9b0052022-03-02 23:07:40 -0800285flatbuffer_cc_library(
286 name = "setpoint_fbs",
287 srcs = [
288 "setpoint.fbs",
289 ],
290 gen_reflections = 1,
291 target_compatible_with = ["@platforms//os:linux"],
292)
293
294cc_binary(
295 name = "setpoint_setter",
296 srcs = ["setpoint_setter.cc"],
297 target_compatible_with = ["@platforms//os:linux"],
298 deps = [
299 ":constants",
300 ":setpoint_fbs",
301 "//aos:init",
302 "//aos/events:shm_event_loop",
303 ],
304)
305
Milo Lin5d49af02022-02-05 12:50:32 -0800306py_library(
307 name = "python_init",
308 srcs = ["__init__.py"],
309 target_compatible_with = ["@platforms//os:linux"],
310 visibility = ["//visibility:public"],
311)
James Kuszmaulf3ef9e12022-03-05 17:13:00 -0800312
313sh_binary(
314 name = "log_web_proxy",
315 srcs = ["log_web_proxy.sh"],
316 data = [
317 ":aos_config",
318 "//aos/network:log_web_proxy_main",
319 "//y2022/www:field_main_bundle.min.js",
320 "//y2022/www:files",
321 ],
322 target_compatible_with = ["@platforms//os:linux"],
323)