blob: 2f6f9632856ef93157c2aab467c840db94e95314 [file] [log] [blame]
Stephan Massaltd021f972020-01-05 20:41:23 -08001load("//frc971:downloader.bzl", "robot_downloader")
2load("//aos:config.bzl", "aos_config")
Stephan Massaltd021f972020-01-05 20:41:23 -08003load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
Austin Schuh3a2f4a42020-09-16 14:10:39 -07004load("//tools/build_rules:template.bzl", "jinja2_template")
Stephan Massaltd021f972020-01-05 20:41:23 -08005
6robot_downloader(
Austin Schuhd58b2902020-03-01 19:28:04 -08007 binaries = [
8 ":setpoint_setter",
James Kuszmaul39a47bb2021-08-18 20:03:09 -07009 "//aos/network:web_proxy_main",
Austin Schuhd58b2902020-03-01 19:28:04 -080010 ],
Stephan Massaltd021f972020-01-05 20:41:23 -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",
Stephan Massaltd021f972020-01-05 20:41:23 -080015 ],
Ravago Jonesc2a08022021-02-06 17:40:54 -080016 dirs = [
James Kuszmaul75a18c52021-03-10 22:02:07 -080017 "//y2020/actors:splines",
James Kuszmaul39a47bb2021-08-18 20:03:09 -070018 "//y2020/www:www_files",
Ravago Jonesc2a08022021-02-06 17:40:54 -080019 ],
Stephan Massaltd021f972020-01-05 20:41:23 -080020 start_binaries = [
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080021 "//aos/events/logging:logger_main",
James Kuszmaul5e6aa252021-08-28 22:19:29 -070022 "//aos/network:web_proxy_main",
Stephan Massaltd021f972020-01-05 20:41:23 -080023 ":joystick_reader",
24 ":wpilib_interface",
Austin Schuh6aa77be2020-02-22 21:06:40 -080025 "//aos/network:message_bridge_client",
26 "//aos/network:message_bridge_server",
27 "//y2020/actors:binaries",
Stephan Massaltd021f972020-01-05 20:41:23 -080028 "//y2020/control_loops/drivetrain:drivetrain",
James Kuszmaul75a18c52021-03-10 22:02:07 -080029 "//y2020/control_loops/drivetrain:trajectory_generator",
Stephan Massaltd021f972020-01-05 20:41:23 -080030 "//y2020/control_loops/superstructure:superstructure",
Stephan Massaltd021f972020-01-05 20:41:23 -080031 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080032 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -080033)
34
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080035robot_downloader(
36 name = "pi_download",
Jim Ostrowskibaa43692020-03-08 16:25:10 -070037 binaries = [
James Kuszmaul7e958812023-02-11 15:34:31 -080038 "//frc971/vision:intrinsics_calibration",
Jim Ostrowskibaa43692020-03-08 16:25:10 -070039 "//y2020/vision:viewer",
40 ],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080041 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -080042 ":aos_config",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080043 ],
44 dirs = [
45 "//y2020/www:www_files",
46 ],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080047 start_binaries = [
Austin Schuh867bd922021-11-07 16:59:52 -080048 "//aos/events/logging:logger_main",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080049 "//aos/network:message_bridge_client",
50 "//aos/network:message_bridge_server",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080051 "//aos/network:web_proxy_main",
Austin Schuh393015b2020-04-20 17:24:39 -070052 "//y2020/vision:camera_reader",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080053 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080054 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080055 target_type = "pi",
56)
57
Stephan Massaltd021f972020-01-05 20:41:23 -080058cc_library(
59 name = "constants",
60 srcs = [
61 "constants.cc",
62 ],
63 hdrs = [
64 "constants.h",
65 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080066 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -080067 visibility = ["//visibility:public"],
68 deps = [
Stephan Massaltd021f972020-01-05 20:41:23 -080069 "//aos/network:team_number",
Brian Silverman1463c092020-10-30 17:28:24 -070070 "//aos/stl_mutex",
Stephan Massaltd021f972020-01-05 20:41:23 -080071 "//frc971:constants",
Stephan Massaltd021f972020-01-05 20:41:23 -080072 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
James Kuszmaul98154a22021-04-03 16:09:29 -070073 "//frc971/shooter_interpolation:interpolation",
Stephan Massaltd021f972020-01-05 20:41:23 -080074 "//y2020/control_loops/drivetrain:polydrivetrain_plants",
Austin Schuh9dcd5202020-02-20 20:06:04 -080075 "//y2020/control_loops/superstructure/accelerator:accelerator_plants",
76 "//y2020/control_loops/superstructure/control_panel:control_panel_plants",
77 "//y2020/control_loops/superstructure/finisher:finisher_plants",
Sabina Davisa587fbd2020-01-31 22:11:15 -080078 "//y2020/control_loops/superstructure/hood:hood_plants",
Sabina Davise8d38992020-02-02 15:00:31 -080079 "//y2020/control_loops/superstructure/intake:intake_plants",
Kai Tinkess10943cf2020-02-01 15:49:57 -080080 "//y2020/control_loops/superstructure/turret:turret_plants",
Brian Silvermanf4d329c2021-11-04 19:32:10 -070081 "@com_github_google_glog//:glog",
Stephan Massaltd021f972020-01-05 20:41:23 -080082 "@com_google_absl//absl/base",
83 ],
84)
85
86cc_binary(
87 name = "wpilib_interface",
88 srcs = [
89 "wpilib_interface.cc",
90 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080091 target_compatible_with = ["//tools/platforms/hardware:roborio"],
Stephan Massaltd021f972020-01-05 20:41:23 -080092 deps = [
93 ":constants",
94 "//aos:init",
Stephan Massaltd021f972020-01-05 20:41:23 -080095 "//aos:math",
Stephan Massaltd021f972020-01-05 20:41:23 -080096 "//aos/events:shm_event_loop",
97 "//aos/logging",
Stephan Massaltd021f972020-01-05 20:41:23 -080098 "//aos/stl_mutex",
99 "//aos/time",
100 "//aos/util:log_interval",
101 "//aos/util:phased_loop",
102 "//aos/util:wrapping_counter",
103 "//frc971/autonomous:auto_mode_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700104 "//frc971/control_loops:control_loop",
Stephan Massaltd021f972020-01-05 20:41:23 -0800105 "//frc971/control_loops:control_loops_fbs",
106 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700107 "//frc971/input:robot_state_fbs",
James Kuszmaul0a981402021-10-09 21:00:34 -0700108 "//frc971/wpilib:ADIS16448",
James Kuszmaula244a912020-01-18 13:50:50 -0800109 "//frc971/wpilib:ADIS16470",
Stephan Massaltd021f972020-01-05 20:41:23 -0800110 "//frc971/wpilib:buffered_pcm",
111 "//frc971/wpilib:drivetrain_writer",
112 "//frc971/wpilib:encoder_and_potentiometer",
113 "//frc971/wpilib:interrupt_edge_counting",
114 "//frc971/wpilib:joystick_sender",
115 "//frc971/wpilib:logging_fbs",
116 "//frc971/wpilib:loop_output_handler",
117 "//frc971/wpilib:pdp_fetcher",
118 "//frc971/wpilib:sensor_reader",
119 "//frc971/wpilib:wpilib_interface",
120 "//frc971/wpilib:wpilib_robot_base",
Alex Perryc4691f52020-02-17 19:20:01 -0800121 "//third_party:phoenix",
Stephan Massaltd021f972020-01-05 20:41:23 -0800122 "//third_party:wpilib",
123 "//y2020/control_loops/superstructure:superstructure_output_fbs",
124 "//y2020/control_loops/superstructure:superstructure_position_fbs",
James Kuszmaul0a981402021-10-09 21:00:34 -0700125 "//y2020/control_loops/superstructure/shooter:shooter_tuning_readings_fbs",
Stephan Massaltd021f972020-01-05 20:41:23 -0800126 ],
127)
128
129cc_binary(
130 name = "joystick_reader",
131 srcs = [
132 ":joystick_reader.cc",
133 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800134 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800135 deps = [
Austin Schuhd58b2902020-03-01 19:28:04 -0800136 ":setpoint_fbs",
Stephan Massaltd021f972020-01-05 20:41:23 -0800137 "//aos:init",
138 "//aos/actions:action_lib",
Stephan Massaltd021f972020-01-05 20:41:23 -0800139 "//aos/logging",
140 "//frc971/autonomous:auto_fbs",
141 "//frc971/autonomous:base_autonomous_actor",
142 "//frc971/control_loops:profiled_subsystem_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700143 "//frc971/input:action_joystick_input",
144 "//frc971/input:drivetrain_input",
145 "//frc971/input:joystick_input",
Austin Schuh0b00c862021-10-17 17:39:10 -0700146 "//frc971/zeroing:wrap",
Sabina Davisa8fed3d2020-02-22 21:44:57 -0800147 "//y2020:constants",
Stephan Massaltd021f972020-01-05 20:41:23 -0800148 "//y2020/control_loops/drivetrain:drivetrain_base",
149 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
150 "//y2020/control_loops/superstructure:superstructure_status_fbs",
151 ],
152)
153
154aos_config(
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800155 name = "aos_config",
Stephan Massaltd021f972020-01-05 20:41:23 -0800156 src = "y2020.json",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700157 flatbuffers = [
158 "//aos/network:message_bridge_client_fbs",
159 "//aos/network:message_bridge_server_fbs",
160 "//aos/network:timestamp_fbs",
Jim Ostrowski977850f2022-01-22 21:04:22 -0800161 "//frc971/vision:vision_fbs",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700162 "//y2020/vision/sift:sift_fbs",
163 "//y2020/vision/sift:sift_training_fbs",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700164 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800165 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800166 visibility = ["//visibility:public"],
167 deps = [
Austin Schuh41fad8c2021-10-23 21:25:12 -0700168 ":config_logger",
Austin Schuhce3a1912020-03-15 15:14:19 -0700169 ":config_pi1",
170 ":config_pi2",
171 ":config_pi3",
Austin Schuh196a4452020-03-15 23:12:03 -0700172 ":config_pi4",
James Kuszmaul9c128122021-03-22 22:24:36 -0700173 ":config_pi5",
Austin Schuhce3a1912020-03-15 15:14:19 -0700174 ":config_roborio",
175 ],
176)
177
178[
179 aos_config(
180 name = "config_" + pi,
181 src = "y2020_" + pi + ".json",
182 flatbuffers = [
183 "//aos/network:message_bridge_client_fbs",
184 "//aos/network:message_bridge_server_fbs",
Jim Ostrowski977850f2022-01-22 21:04:22 -0800185 "//aos/network:remote_message_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700186 "//aos/network:timestamp_fbs",
Jim Ostrowski977850f2022-01-22 21:04:22 -0800187 "//frc971/vision:vision_fbs",
188 "//y2020/vision:galactic_search_path_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700189 "//y2020/vision/sift:sift_fbs",
190 "//y2020/vision/sift:sift_training_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700191 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800192 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhce3a1912020-03-15 15:14:19 -0700193 visibility = ["//visibility:public"],
194 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800195 "//aos/events:aos_config",
196 "//frc971/control_loops/drivetrain:aos_config",
197 "//frc971/input:aos_config",
Austin Schuhce3a1912020-03-15 15:14:19 -0700198 ],
199 )
200 for pi in [
201 "pi1",
202 "pi2",
203 "pi3",
Austin Schuh196a4452020-03-15 23:12:03 -0700204 "pi4",
James Kuszmaul9c128122021-03-22 22:24:36 -0700205 "pi5",
Austin Schuhce3a1912020-03-15 15:14:19 -0700206 ]
207]
208
209aos_config(
Austin Schuh41fad8c2021-10-23 21:25:12 -0700210 name = "config_logger",
211 src = "y2020_logger.json",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700212 flatbuffers = [
213 "//aos/network:message_bridge_client_fbs",
214 "//aos/network:message_bridge_server_fbs",
Jim Ostrowski977850f2022-01-22 21:04:22 -0800215 "//aos/network:remote_message_fbs",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700216 "//aos/network:timestamp_fbs",
Jim Ostrowski977850f2022-01-22 21:04:22 -0800217 "//frc971/vision:vision_fbs",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700218 "//y2020/vision/sift:sift_fbs",
219 "//y2020/vision/sift:sift_training_fbs",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700220 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800221 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700222 visibility = ["//visibility:public"],
223 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800224 "//aos/events:aos_config",
225 "//frc971/control_loops/drivetrain:aos_config",
226 "//frc971/input:aos_config",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700227 ],
228)
229
230aos_config(
Austin Schuhce3a1912020-03-15 15:14:19 -0700231 name = "config_roborio",
232 src = "y2020_roborio.json",
233 flatbuffers = [
234 ":setpoint_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800235 "//aos/network:remote_message_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700236 "//aos/network:message_bridge_client_fbs",
237 "//aos/network:message_bridge_server_fbs",
238 "//aos/network:timestamp_fbs",
milind-u661a1182021-09-21 20:30:43 -0700239 "//y2020/control_loops/superstructure/shooter:shooter_tuning_params_fbs",
milind-u4b31c4d2021-09-18 16:08:23 -0700240 "//y2020/control_loops/superstructure/shooter:shooter_tuning_readings_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700241 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
242 "//y2019/control_loops/drivetrain:target_selector_fbs",
James Kuszmaul5ff8a862021-09-25 17:29:43 -0700243 "//y2020/control_loops/drivetrain:localizer_debug_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700244 "//y2020/control_loops/superstructure:superstructure_output_fbs",
245 "//y2020/control_loops/superstructure:superstructure_position_fbs",
246 "//y2020/control_loops/superstructure:superstructure_status_fbs",
247 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800248 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhce3a1912020-03-15 15:14:19 -0700249 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800250 "//aos/events:aos_config",
251 "//frc971/autonomous:aos_config",
252 "//frc971/control_loops/drivetrain:aos_config",
253 "//frc971/input:aos_config",
254 "//frc971/wpilib:aos_config",
Stephan Massaltd021f972020-01-05 20:41:23 -0800255 ],
256)
257
258py_library(
259 name = "python_init",
260 srcs = ["__init__.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800261 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800262 visibility = ["//visibility:public"],
263)
Alex Perry5f474f22020-02-01 12:14:24 -0800264
265sh_binary(
James Kuszmaul5e6aa252021-08-28 22:19:29 -0700266 name = "log_web_proxy",
267 srcs = ["log_web_proxy.sh"],
268 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800269 ":aos_config",
James Kuszmaul5e6aa252021-08-28 22:19:29 -0700270 "//aos/network:log_web_proxy_main",
271 "//y2020/www:camera_main_bundle.min.js",
272 "//y2020/www:field_main_bundle.min.js",
273 "//y2020/www:files",
274 ],
275 target_compatible_with = ["@platforms//os:linux"],
276)
277
278sh_binary(
Alex Perry5f474f22020-02-01 12:14:24 -0800279 name = "web_proxy",
280 srcs = ["web_proxy.sh"],
281 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800282 ":aos_config",
Alex Perry5f474f22020-02-01 12:14:24 -0800283 "//aos/network:web_proxy_main",
Austin Schuhda9d0602019-09-15 17:29:38 -0700284 "//y2020/www:camera_main_bundle.min.js",
285 "//y2020/www:field_main_bundle.min.js",
Alex Perry5f474f22020-02-01 12:14:24 -0800286 "//y2020/www:files",
Alex Perry5f474f22020-02-01 12:14:24 -0800287 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800288 target_compatible_with = ["@platforms//os:linux"],
Alex Perry5f474f22020-02-01 12:14:24 -0800289)
Austin Schuhd58b2902020-03-01 19:28:04 -0800290
Austin Schuhd58b2902020-03-01 19:28:04 -0800291flatbuffer_cc_library(
292 name = "setpoint_fbs",
293 srcs = [
294 "setpoint.fbs",
295 ],
296 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -0800297 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhd58b2902020-03-01 19:28:04 -0800298)
299
300cc_binary(
301 name = "setpoint_setter",
302 srcs = ["setpoint_setter.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800303 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhd58b2902020-03-01 19:28:04 -0800304 deps = [
305 ":setpoint_fbs",
306 "//aos:init",
307 "//aos/events:shm_event_loop",
308 ],
309)
James Kuszmaul55d9fc72020-05-10 18:58:08 -0700310
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700311[
312 jinja2_template(
313 name = "y2020_pi" + str(num) + ".json",
314 src = "y2020_pi_template.json",
315 parameters = {"NUM": str(num)},
Philipp Schraderdada1072020-11-24 11:34:46 -0800316 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700317 )
James Kuszmaul9c128122021-03-22 22:24:36 -0700318 for num in range(1, 6)
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700319]