blob: b16067de47afe5d60f6410bafe20982dcb34a5af [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",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -080095 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -080096 "//y2022/vision:target_estimate_fbs",
97 ],
98 target_compatible_with = ["@platforms//os:linux"],
99 visibility = ["//visibility:public"],
100 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800101 "//aos/events:aos_config",
102 "//frc971/control_loops/drivetrain:aos_config",
103 "//frc971/input:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800104 ],
105 )
106 for pi in [
107 "pi1",
108 "pi2",
109 "pi3",
110 "pi4",
milind-uf2f59aa2022-01-23 21:06:12 -0800111 ]
112]
113
114aos_config(
James Kuszmaulef35d732022-02-12 16:37:32 -0800115 name = "config_imu",
116 src = "y2022_imu.json",
117 flatbuffers = [
118 "//aos/network:message_bridge_client_fbs",
119 "//aos/network:message_bridge_server_fbs",
120 "//aos/network:timestamp_fbs",
121 "//aos/network:remote_message_fbs",
James Kuszmaul51fa1ae2022-02-26 00:49:57 -0800122 "//y2022/localizer:localizer_status_fbs",
123 "//y2022/localizer:localizer_output_fbs",
James Kuszmaul0dedb5e2022-03-05 16:02:20 -0800124 "//y2022/localizer:localizer_visualization_fbs",
James Kuszmaulef35d732022-02-12 16:37:32 -0800125 ],
126 target_compatible_with = ["@platforms//os:linux"],
127 visibility = ["//visibility:public"],
128 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800129 "//aos/events:aos_config",
130 "//frc971/control_loops/drivetrain:aos_config",
James Kuszmaulef35d732022-02-12 16:37:32 -0800131 ],
132)
133
134aos_config(
milind-uf2f59aa2022-01-23 21:06:12 -0800135 name = "config_logger",
136 src = "y2022_logger.json",
137 flatbuffers = [
138 "//aos/network:message_bridge_client_fbs",
139 "//aos/network:message_bridge_server_fbs",
140 "//aos/network:timestamp_fbs",
141 "//aos/network:remote_message_fbs",
142 "//frc971/vision:vision_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -0800143 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800144 ],
145 target_compatible_with = ["@platforms//os:linux"],
146 visibility = ["//visibility:public"],
147 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800148 "//aos/events:aos_config",
149 "//frc971/control_loops/drivetrain:aos_config",
150 "//frc971/input:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800151 ],
152)
153
154aos_config(
155 name = "config_roborio",
156 src = "y2022_roborio.json",
157 flatbuffers = [
Henry Speiser0b9b0052022-03-02 23:07:40 -0800158 ":setpoint_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800159 "//aos/network:remote_message_fbs",
160 "//aos/network:message_bridge_client_fbs",
161 "//aos/network:message_bridge_server_fbs",
162 "//aos/network:timestamp_fbs",
163 "//y2019/control_loops/drivetrain:target_selector_fbs",
164 "//y2022/control_loops/superstructure:superstructure_goal_fbs",
165 "//y2022/control_loops/superstructure:superstructure_output_fbs",
166 "//y2022/control_loops/superstructure:superstructure_position_fbs",
Milind Upadhyay482b0ba2022-02-26 21:51:59 -0800167 "//y2022/control_loops/superstructure:superstructure_can_position_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800168 "//y2022/control_loops/superstructure:superstructure_status_fbs",
169 ],
170 target_compatible_with = ["@platforms//os:linux"],
171 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800172 "//aos/events:aos_config",
173 "//frc971/autonomous:aos_config",
174 "//frc971/control_loops/drivetrain:aos_config",
175 "//frc971/input:aos_config",
176 "//frc971/wpilib:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800177 ],
178)
179
180[
181 jinja2_template(
182 name = "y2022_pi" + str(num) + ".json",
183 src = "y2022_pi_template.json",
184 parameters = {"NUM": str(num)},
185 target_compatible_with = ["@platforms//os:linux"],
186 )
187 for num in range(1, 6)
188]
189
milind-u086d7262022-01-19 20:44:18 -0800190cc_library(
191 name = "constants",
192 srcs = [
193 "constants.cc",
194 ],
195 hdrs = [
196 "constants.h",
197 ],
198 visibility = ["//visibility:public"],
199 deps = [
200 "//aos/mutex",
201 "//aos/network:team_number",
202 "//frc971:constants",
203 "//frc971/control_loops:pose",
204 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
205 "//y2022/control_loops/drivetrain:polydrivetrain_plants",
Austin Schuh39f26f62022-02-24 21:34:46 -0800206 "//y2022/control_loops/superstructure/catapult:catapult_plants",
Siddhant Kanwar0e37f592022-02-21 19:26:50 -0800207 "//y2022/control_loops/superstructure/climber:climber_plants",
Yash Chainani997a7492022-01-29 15:48:56 -0800208 "//y2022/control_loops/superstructure/intake:intake_plants",
Henry Speiser55aa3ba2022-02-21 23:21:12 -0800209 "//y2022/control_loops/superstructure/turret:turret_plants",
milind-u086d7262022-01-19 20:44:18 -0800210 "@com_github_google_glog//:glog",
211 "@com_google_absl//absl/base",
212 ],
213)
214
215cc_binary(
216 name = "wpilib_interface",
217 srcs = [
218 "wpilib_interface.cc",
219 ],
220 target_compatible_with = ["//tools/platforms/hardware:roborio"],
221 deps = [
222 ":constants",
223 "//aos:init",
224 "//aos:math",
225 "//aos/events:shm_event_loop",
226 "//aos/logging",
227 "//aos/stl_mutex",
228 "//aos/time",
229 "//aos/util:log_interval",
230 "//aos/util:phased_loop",
231 "//aos/util:wrapping_counter",
232 "//frc971/autonomous:auto_mode_fbs",
233 "//frc971/control_loops:control_loop",
234 "//frc971/control_loops:control_loops_fbs",
235 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
236 "//frc971/input:robot_state_fbs",
Ravago Jones0e86e242022-02-12 18:38:14 -0800237 "//frc971/queues:gyro_fbs",
milind-u086d7262022-01-19 20:44:18 -0800238 "//frc971/wpilib:ADIS16448",
239 "//frc971/wpilib:buffered_pcm",
240 "//frc971/wpilib:drivetrain_writer",
241 "//frc971/wpilib:encoder_and_potentiometer",
242 "//frc971/wpilib:interrupt_edge_counting",
243 "//frc971/wpilib:joystick_sender",
244 "//frc971/wpilib:logging_fbs",
245 "//frc971/wpilib:loop_output_handler",
246 "//frc971/wpilib:pdp_fetcher",
247 "//frc971/wpilib:sensor_reader",
248 "//frc971/wpilib:wpilib_interface",
249 "//frc971/wpilib:wpilib_robot_base",
250 "//third_party:phoenix",
251 "//third_party:wpilib",
Milind Upadhyay482b0ba2022-02-26 21:51:59 -0800252 "//y2022/control_loops/superstructure:superstructure_can_position_fbs",
milind-u086d7262022-01-19 20:44:18 -0800253 "//y2022/control_loops/superstructure:superstructure_output_fbs",
254 "//y2022/control_loops/superstructure:superstructure_position_fbs",
255 ],
256)
257
258cc_binary(
259 name = "joystick_reader",
260 srcs = [
261 ":joystick_reader.cc",
262 ],
263 deps = [
Henry Speiser0b9b0052022-03-02 23:07:40 -0800264 ":constants",
265 ":setpoint_fbs",
milind-u086d7262022-01-19 20:44:18 -0800266 "//aos:init",
267 "//aos/actions:action_lib",
268 "//aos/logging",
269 "//frc971/autonomous:auto_fbs",
270 "//frc971/autonomous:base_autonomous_actor",
271 "//frc971/control_loops:profiled_subsystem_fbs",
272 "//frc971/input:action_joystick_input",
273 "//frc971/input:drivetrain_input",
274 "//frc971/input:joystick_input",
275 "//y2022/control_loops/drivetrain:drivetrain_base",
276 "//y2022/control_loops/superstructure:superstructure_goal_fbs",
277 "//y2022/control_loops/superstructure:superstructure_status_fbs",
278 ],
279)
Milo Lin5d49af02022-02-05 12:50:32 -0800280
Henry Speiser0b9b0052022-03-02 23:07:40 -0800281flatbuffer_cc_library(
282 name = "setpoint_fbs",
283 srcs = [
284 "setpoint.fbs",
285 ],
286 gen_reflections = 1,
287 target_compatible_with = ["@platforms//os:linux"],
288)
289
290cc_binary(
291 name = "setpoint_setter",
292 srcs = ["setpoint_setter.cc"],
293 target_compatible_with = ["@platforms//os:linux"],
294 deps = [
295 ":constants",
296 ":setpoint_fbs",
297 "//aos:init",
298 "//aos/events:shm_event_loop",
299 ],
300)
301
Milo Lin5d49af02022-02-05 12:50:32 -0800302py_library(
303 name = "python_init",
304 srcs = ["__init__.py"],
305 target_compatible_with = ["@platforms//os:linux"],
306 visibility = ["//visibility:public"],
307)
James Kuszmaulf3ef9e12022-03-05 17:13:00 -0800308
309sh_binary(
310 name = "log_web_proxy",
311 srcs = ["log_web_proxy.sh"],
312 data = [
313 ":aos_config",
314 "//aos/network:log_web_proxy_main",
315 "//y2022/www:field_main_bundle.min.js",
316 "//y2022/www:files",
317 ],
318 target_compatible_with = ["@platforms//os:linux"],
319)