blob: 83438ec2fd960dc8035bc2076814006e0a0a6247 [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 Schuhde605f12022-02-23 23:08:19 -080013 "@ctre_phoenix_api_cpp_athena//:shared_libraries",
14 "@ctre_phoenix_cci_athena//:shared_libraries",
milind-u086d7262022-01-19 20:44:18 -080015 ],
Austin Schuh76f227c2022-02-23 16:34:08 -080016 dirs = [
Ravago Jones81e50632022-03-11 16:23:51 -080017 "//y2022/actors:splines",
Austin Schuh76f227c2022-02-23 16:34:08 -080018 "//y2022/www:www_files",
19 ],
milind-u086d7262022-01-19 20:44:18 -080020 start_binaries = [
milind-uf2f59aa2022-01-23 21:06:12 -080021 "//aos/events/logging:logger_main",
22 "//aos/network:web_proxy_main",
milind-u086d7262022-01-19 20:44:18 -080023 ":joystick_reader",
24 ":wpilib_interface",
milind-uf2f59aa2022-01-23 21:06:12 -080025 "//aos/network:message_bridge_client",
26 "//aos/network:message_bridge_server",
27 "//y2022/actors:binaries",
milind-u086d7262022-01-19 20:44:18 -080028 "//y2022/control_loops/drivetrain:drivetrain",
Milind Upadhyayb8abf022022-02-22 21:07:44 -080029 "//y2022/control_loops/drivetrain:trajectory_generator",
milind-u086d7262022-01-19 20:44:18 -080030 "//y2022/control_loops/superstructure:superstructure",
milind-u086d7262022-01-19 20:44:18 -080031 ],
milind-uf2f59aa2022-01-23 21:06:12 -080032 target_compatible_with = ["@platforms//os:linux"],
milind-u086d7262022-01-19 20:44:18 -080033)
34
milind-u6b6e1002022-01-22 13:26:42 -080035robot_downloader(
36 name = "pi_download",
37 binaries = [
Jim Ostrowskib9135a92022-02-06 22:49:11 -080038 "//y2020/vision:calibration",
milind-u6b6e1002022-01-22 13:26:42 -080039 "//y2022/vision:viewer",
Ravago Jonese12b7902022-02-04 22:50:44 -080040 "//y2022/localizer:imu_main",
James Kuszmaul51fa1ae2022-02-26 00:49:57 -080041 "//y2022/localizer:localizer_main",
James Kuszmaul3eb753d2022-03-12 15:21:12 -080042 "//y2022/vision:image_decimator",
milind-u6b6e1002022-01-22 13:26:42 -080043 ],
44 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -080045 ":aos_config",
milind-u6b6e1002022-01-22 13:26:42 -080046 ],
James Kuszmaulb35e2342022-03-06 15:44:00 -080047 dirs = [
48 "//y2022/www:www_files",
49 ],
milind-u6b6e1002022-01-22 13:26:42 -080050 start_binaries = [
51 "//aos/events/logging:logger_main",
52 "//aos/network:message_bridge_client",
53 "//aos/network:message_bridge_server",
54 "//aos/network:web_proxy_main",
55 "//y2022/vision:camera_reader",
56 ],
57 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
58 target_type = "pi",
59)
60
milind-uf2f59aa2022-01-23 21:06:12 -080061aos_config(
Austin Schuhc5fa6d92022-02-25 14:36:28 -080062 name = "aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -080063 src = "y2022.json",
64 flatbuffers = [
65 "//aos/network:message_bridge_client_fbs",
66 "//aos/network:message_bridge_server_fbs",
67 "//aos/network:timestamp_fbs",
68 "//frc971/input:robot_state_fbs",
69 "//frc971/vision:vision_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -080070 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -080071 ],
72 target_compatible_with = ["@platforms//os:linux"],
73 visibility = ["//visibility:public"],
74 deps = [
James Kuszmaulef35d732022-02-12 16:37:32 -080075 ":config_imu",
milind-uf2f59aa2022-01-23 21:06:12 -080076 ":config_logger",
77 ":config_pi1",
78 ":config_pi2",
79 ":config_pi3",
80 ":config_pi4",
milind-uf2f59aa2022-01-23 21:06:12 -080081 ":config_roborio",
82 ],
83)
84
85[
86 aos_config(
87 name = "config_" + pi,
88 src = "y2022_" + pi + ".json",
89 flatbuffers = [
90 "//aos/network:message_bridge_client_fbs",
91 "//aos/network:message_bridge_server_fbs",
92 "//aos/network:timestamp_fbs",
93 "//aos/network:remote_message_fbs",
94 "//frc971/vision:vision_fbs",
Milind Upadhyayd67e9cf2022-03-13 13:56:57 -070095 "//y2022/localizer:localizer_output_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -080096 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -080097 "//y2022/vision:target_estimate_fbs",
98 ],
99 target_compatible_with = ["@platforms//os:linux"],
100 visibility = ["//visibility:public"],
101 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800102 "//aos/events:aos_config",
103 "//frc971/control_loops/drivetrain:aos_config",
104 "//frc971/input:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800105 ],
106 )
107 for pi in [
108 "pi1",
109 "pi2",
110 "pi3",
111 "pi4",
milind-uf2f59aa2022-01-23 21:06:12 -0800112 ]
113]
114
115aos_config(
James Kuszmaulef35d732022-02-12 16:37:32 -0800116 name = "config_imu",
117 src = "y2022_imu.json",
118 flatbuffers = [
119 "//aos/network:message_bridge_client_fbs",
120 "//aos/network:message_bridge_server_fbs",
121 "//aos/network:timestamp_fbs",
122 "//aos/network:remote_message_fbs",
James Kuszmaul51fa1ae2022-02-26 00:49:57 -0800123 "//y2022/localizer:localizer_status_fbs",
124 "//y2022/localizer:localizer_output_fbs",
James Kuszmaul0dedb5e2022-03-05 16:02:20 -0800125 "//y2022/localizer:localizer_visualization_fbs",
James Kuszmaulef35d732022-02-12 16:37:32 -0800126 ],
127 target_compatible_with = ["@platforms//os:linux"],
128 visibility = ["//visibility:public"],
129 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800130 "//aos/events:aos_config",
131 "//frc971/control_loops/drivetrain:aos_config",
James Kuszmaulef35d732022-02-12 16:37:32 -0800132 ],
133)
134
135aos_config(
milind-uf2f59aa2022-01-23 21:06:12 -0800136 name = "config_logger",
137 src = "y2022_logger.json",
138 flatbuffers = [
139 "//aos/network:message_bridge_client_fbs",
140 "//aos/network:message_bridge_server_fbs",
141 "//aos/network:timestamp_fbs",
142 "//aos/network:remote_message_fbs",
143 "//frc971/vision:vision_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -0800144 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800145 ],
146 target_compatible_with = ["@platforms//os:linux"],
147 visibility = ["//visibility:public"],
148 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800149 "//aos/events:aos_config",
150 "//frc971/control_loops/drivetrain:aos_config",
151 "//frc971/input:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800152 ],
153)
154
155aos_config(
156 name = "config_roborio",
157 src = "y2022_roborio.json",
158 flatbuffers = [
Henry Speiser0b9b0052022-03-02 23:07:40 -0800159 ":setpoint_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800160 "//aos/network:remote_message_fbs",
161 "//aos/network:message_bridge_client_fbs",
162 "//aos/network:message_bridge_server_fbs",
163 "//aos/network:timestamp_fbs",
164 "//y2019/control_loops/drivetrain:target_selector_fbs",
165 "//y2022/control_loops/superstructure:superstructure_goal_fbs",
166 "//y2022/control_loops/superstructure:superstructure_output_fbs",
167 "//y2022/control_loops/superstructure:superstructure_position_fbs",
Milind Upadhyay482b0ba2022-02-26 21:51:59 -0800168 "//y2022/control_loops/superstructure:superstructure_can_position_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800169 "//y2022/control_loops/superstructure:superstructure_status_fbs",
170 ],
171 target_compatible_with = ["@platforms//os:linux"],
172 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800173 "//aos/events:aos_config",
174 "//frc971/autonomous:aos_config",
175 "//frc971/control_loops/drivetrain:aos_config",
176 "//frc971/input:aos_config",
177 "//frc971/wpilib:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800178 ],
179)
180
181[
182 jinja2_template(
183 name = "y2022_pi" + str(num) + ".json",
184 src = "y2022_pi_template.json",
185 parameters = {"NUM": str(num)},
186 target_compatible_with = ["@platforms//os:linux"],
187 )
188 for num in range(1, 6)
189]
190
milind-u086d7262022-01-19 20:44:18 -0800191cc_library(
192 name = "constants",
193 srcs = [
194 "constants.cc",
195 ],
196 hdrs = [
197 "constants.h",
198 ],
199 visibility = ["//visibility:public"],
200 deps = [
201 "//aos/mutex",
202 "//aos/network:team_number",
203 "//frc971:constants",
204 "//frc971/control_loops:pose",
205 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
Ravago Jones3283ce02022-03-09 19:31:29 -0800206 "//frc971/shooter_interpolation:interpolation",
milind-u086d7262022-01-19 20:44:18 -0800207 "//y2022/control_loops/drivetrain:polydrivetrain_plants",
Austin Schuh39f26f62022-02-24 21:34:46 -0800208 "//y2022/control_loops/superstructure/catapult:catapult_plants",
Siddhant Kanwar0e37f592022-02-21 19:26:50 -0800209 "//y2022/control_loops/superstructure/climber:climber_plants",
Yash Chainani997a7492022-01-29 15:48:56 -0800210 "//y2022/control_loops/superstructure/intake:intake_plants",
Henry Speiser55aa3ba2022-02-21 23:21:12 -0800211 "//y2022/control_loops/superstructure/turret:turret_plants",
milind-u086d7262022-01-19 20:44:18 -0800212 "@com_github_google_glog//:glog",
213 "@com_google_absl//absl/base",
214 ],
215)
216
217cc_binary(
218 name = "wpilib_interface",
219 srcs = [
220 "wpilib_interface.cc",
221 ],
222 target_compatible_with = ["//tools/platforms/hardware:roborio"],
223 deps = [
224 ":constants",
225 "//aos:init",
226 "//aos:math",
227 "//aos/events:shm_event_loop",
228 "//aos/logging",
229 "//aos/stl_mutex",
230 "//aos/time",
231 "//aos/util:log_interval",
232 "//aos/util:phased_loop",
233 "//aos/util:wrapping_counter",
234 "//frc971/autonomous:auto_mode_fbs",
235 "//frc971/control_loops:control_loop",
236 "//frc971/control_loops:control_loops_fbs",
237 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
238 "//frc971/input:robot_state_fbs",
Ravago Jones0e86e242022-02-12 18:38:14 -0800239 "//frc971/queues:gyro_fbs",
milind-u086d7262022-01-19 20:44:18 -0800240 "//frc971/wpilib:ADIS16448",
241 "//frc971/wpilib:buffered_pcm",
242 "//frc971/wpilib:drivetrain_writer",
243 "//frc971/wpilib:encoder_and_potentiometer",
244 "//frc971/wpilib:interrupt_edge_counting",
245 "//frc971/wpilib:joystick_sender",
246 "//frc971/wpilib:logging_fbs",
247 "//frc971/wpilib:loop_output_handler",
248 "//frc971/wpilib:pdp_fetcher",
249 "//frc971/wpilib:sensor_reader",
250 "//frc971/wpilib:wpilib_interface",
251 "//frc971/wpilib:wpilib_robot_base",
252 "//third_party:phoenix",
253 "//third_party:wpilib",
Henry Speiser77747b72022-03-06 17:18:29 -0800254 "//y2022/control_loops/superstructure:led_indicator_lib",
Milind Upadhyay482b0ba2022-02-26 21:51:59 -0800255 "//y2022/control_loops/superstructure:superstructure_can_position_fbs",
milind-u086d7262022-01-19 20:44:18 -0800256 "//y2022/control_loops/superstructure:superstructure_output_fbs",
257 "//y2022/control_loops/superstructure:superstructure_position_fbs",
258 ],
259)
260
261cc_binary(
262 name = "joystick_reader",
263 srcs = [
264 ":joystick_reader.cc",
265 ],
266 deps = [
Henry Speiser0b9b0052022-03-02 23:07:40 -0800267 ":constants",
268 ":setpoint_fbs",
milind-u086d7262022-01-19 20:44:18 -0800269 "//aos:init",
270 "//aos/actions:action_lib",
271 "//aos/logging",
272 "//frc971/autonomous:auto_fbs",
273 "//frc971/autonomous:base_autonomous_actor",
274 "//frc971/control_loops:profiled_subsystem_fbs",
275 "//frc971/input:action_joystick_input",
276 "//frc971/input:drivetrain_input",
277 "//frc971/input:joystick_input",
278 "//y2022/control_loops/drivetrain:drivetrain_base",
279 "//y2022/control_loops/superstructure:superstructure_goal_fbs",
280 "//y2022/control_loops/superstructure:superstructure_status_fbs",
281 ],
282)
Milo Lin5d49af02022-02-05 12:50:32 -0800283
Henry Speiser0b9b0052022-03-02 23:07:40 -0800284flatbuffer_cc_library(
285 name = "setpoint_fbs",
286 srcs = [
287 "setpoint.fbs",
288 ],
289 gen_reflections = 1,
290 target_compatible_with = ["@platforms//os:linux"],
291)
292
293cc_binary(
294 name = "setpoint_setter",
295 srcs = ["setpoint_setter.cc"],
296 target_compatible_with = ["@platforms//os:linux"],
297 deps = [
298 ":constants",
299 ":setpoint_fbs",
300 "//aos:init",
301 "//aos/events:shm_event_loop",
302 ],
303)
304
Milo Lin5d49af02022-02-05 12:50:32 -0800305py_library(
306 name = "python_init",
307 srcs = ["__init__.py"],
308 target_compatible_with = ["@platforms//os:linux"],
309 visibility = ["//visibility:public"],
310)
James Kuszmaulf3ef9e12022-03-05 17:13:00 -0800311
312sh_binary(
313 name = "log_web_proxy",
314 srcs = ["log_web_proxy.sh"],
315 data = [
316 ":aos_config",
317 "//aos/network:log_web_proxy_main",
318 "//y2022/www:field_main_bundle.min.js",
319 "//y2022/www:files",
320 ],
321 target_compatible_with = ["@platforms//os:linux"],
322)