blob: 7c04d992eb638465a226d05e04a861548ef46e95 [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")
James Kuszmaule50ef1e2023-05-16 21:08:04 -07005load("//aos/util:config_validator_macro.bzl", "config_validator_test")
6
7config_validator_test(
8 name = "config_validator_test",
9 config = "//y2020:aos_config",
10)
Stephan Massaltd021f972020-01-05 20:41:23 -080011
12robot_downloader(
Austin Schuhd58b2902020-03-01 19:28:04 -080013 binaries = [
14 ":setpoint_setter",
James Kuszmaul39a47bb2021-08-18 20:03:09 -070015 "//aos/network:web_proxy_main",
Austin Schuhd58b2902020-03-01 19:28:04 -080016 ],
Stephan Massaltd021f972020-01-05 20:41:23 -080017 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -080018 ":aos_config",
Austin Schuhde605f12022-02-23 23:08:19 -080019 "@ctre_phoenix_api_cpp_athena//:shared_libraries",
20 "@ctre_phoenix_cci_athena//:shared_libraries",
Stephan Massaltd021f972020-01-05 20:41:23 -080021 ],
Ravago Jonesc2a08022021-02-06 17:40:54 -080022 dirs = [
James Kuszmaul75a18c52021-03-10 22:02:07 -080023 "//y2020/actors:splines",
James Kuszmaul39a47bb2021-08-18 20:03:09 -070024 "//y2020/www:www_files",
Ravago Jonesc2a08022021-02-06 17:40:54 -080025 ],
Stephan Massaltd021f972020-01-05 20:41:23 -080026 start_binaries = [
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080027 "//aos/events/logging:logger_main",
James Kuszmaul5e6aa252021-08-28 22:19:29 -070028 "//aos/network:web_proxy_main",
Stephan Massaltd021f972020-01-05 20:41:23 -080029 ":joystick_reader",
30 ":wpilib_interface",
Austin Schuh6aa77be2020-02-22 21:06:40 -080031 "//aos/network:message_bridge_client",
32 "//aos/network:message_bridge_server",
33 "//y2020/actors:binaries",
Stephan Massaltd021f972020-01-05 20:41:23 -080034 "//y2020/control_loops/drivetrain:drivetrain",
James Kuszmaul75a18c52021-03-10 22:02:07 -080035 "//y2020/control_loops/drivetrain:trajectory_generator",
Stephan Massaltd021f972020-01-05 20:41:23 -080036 "//y2020/control_loops/superstructure:superstructure",
Stephan Massaltd021f972020-01-05 20:41:23 -080037 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080038 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -080039)
40
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080041robot_downloader(
42 name = "pi_download",
Jim Ostrowskibaa43692020-03-08 16:25:10 -070043 binaries = [
James Kuszmaul7e958812023-02-11 15:34:31 -080044 "//frc971/vision:intrinsics_calibration",
Jim Ostrowskibaa43692020-03-08 16:25:10 -070045 "//y2020/vision:viewer",
46 ],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080047 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -080048 ":aos_config",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080049 ],
50 dirs = [
51 "//y2020/www:www_files",
52 ],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080053 start_binaries = [
Austin Schuh867bd922021-11-07 16:59:52 -080054 "//aos/events/logging:logger_main",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080055 "//aos/network:message_bridge_client",
56 "//aos/network:message_bridge_server",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080057 "//aos/network:web_proxy_main",
Austin Schuh393015b2020-04-20 17:24:39 -070058 "//y2020/vision:camera_reader",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080059 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080060 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080061 target_type = "pi",
62)
63
Stephan Massaltd021f972020-01-05 20:41:23 -080064cc_library(
65 name = "constants",
66 srcs = [
67 "constants.cc",
68 ],
69 hdrs = [
70 "constants.h",
71 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080072 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -080073 visibility = ["//visibility:public"],
74 deps = [
Stephan Massaltd021f972020-01-05 20:41:23 -080075 "//aos/network:team_number",
Brian Silverman1463c092020-10-30 17:28:24 -070076 "//aos/stl_mutex",
Stephan Massaltd021f972020-01-05 20:41:23 -080077 "//frc971:constants",
Stephan Massaltd021f972020-01-05 20:41:23 -080078 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
James Kuszmaul98154a22021-04-03 16:09:29 -070079 "//frc971/shooter_interpolation:interpolation",
James Kuszmaulec635d22023-08-12 18:39:24 -070080 "//frc971/zeroing:absolute_and_absolute_encoder",
81 "//frc971/zeroing:absolute_encoder",
82 "//frc971/zeroing:pot_and_absolute_encoder",
Stephan Massaltd021f972020-01-05 20:41:23 -080083 "//y2020/control_loops/drivetrain:polydrivetrain_plants",
Austin Schuh9dcd5202020-02-20 20:06:04 -080084 "//y2020/control_loops/superstructure/accelerator:accelerator_plants",
85 "//y2020/control_loops/superstructure/control_panel:control_panel_plants",
86 "//y2020/control_loops/superstructure/finisher:finisher_plants",
Sabina Davisa587fbd2020-01-31 22:11:15 -080087 "//y2020/control_loops/superstructure/hood:hood_plants",
Sabina Davise8d38992020-02-02 15:00:31 -080088 "//y2020/control_loops/superstructure/intake:intake_plants",
Kai Tinkess10943cf2020-02-01 15:49:57 -080089 "//y2020/control_loops/superstructure/turret:turret_plants",
Brian Silvermanf4d329c2021-11-04 19:32:10 -070090 "@com_github_google_glog//:glog",
Stephan Massaltd021f972020-01-05 20:41:23 -080091 "@com_google_absl//absl/base",
92 ],
93)
94
95cc_binary(
96 name = "wpilib_interface",
97 srcs = [
98 "wpilib_interface.cc",
99 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800100 target_compatible_with = ["//tools/platforms/hardware:roborio"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800101 deps = [
102 ":constants",
103 "//aos:init",
Stephan Massaltd021f972020-01-05 20:41:23 -0800104 "//aos:math",
Stephan Massaltd021f972020-01-05 20:41:23 -0800105 "//aos/events:shm_event_loop",
106 "//aos/logging",
Stephan Massaltd021f972020-01-05 20:41:23 -0800107 "//aos/stl_mutex",
108 "//aos/time",
109 "//aos/util:log_interval",
110 "//aos/util:phased_loop",
111 "//aos/util:wrapping_counter",
112 "//frc971/autonomous:auto_mode_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700113 "//frc971/control_loops:control_loop",
Stephan Massaltd021f972020-01-05 20:41:23 -0800114 "//frc971/control_loops:control_loops_fbs",
115 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700116 "//frc971/input:robot_state_fbs",
James Kuszmaul0a981402021-10-09 21:00:34 -0700117 "//frc971/wpilib:ADIS16448",
James Kuszmaula244a912020-01-18 13:50:50 -0800118 "//frc971/wpilib:ADIS16470",
Stephan Massaltd021f972020-01-05 20:41:23 -0800119 "//frc971/wpilib:buffered_pcm",
120 "//frc971/wpilib:drivetrain_writer",
121 "//frc971/wpilib:encoder_and_potentiometer",
122 "//frc971/wpilib:interrupt_edge_counting",
123 "//frc971/wpilib:joystick_sender",
124 "//frc971/wpilib:logging_fbs",
125 "//frc971/wpilib:loop_output_handler",
126 "//frc971/wpilib:pdp_fetcher",
127 "//frc971/wpilib:sensor_reader",
128 "//frc971/wpilib:wpilib_interface",
129 "//frc971/wpilib:wpilib_robot_base",
Alex Perryc4691f52020-02-17 19:20:01 -0800130 "//third_party:phoenix",
Stephan Massaltd021f972020-01-05 20:41:23 -0800131 "//third_party:wpilib",
132 "//y2020/control_loops/superstructure:superstructure_output_fbs",
133 "//y2020/control_loops/superstructure:superstructure_position_fbs",
James Kuszmaul0a981402021-10-09 21:00:34 -0700134 "//y2020/control_loops/superstructure/shooter:shooter_tuning_readings_fbs",
Stephan Massaltd021f972020-01-05 20:41:23 -0800135 ],
136)
137
138cc_binary(
139 name = "joystick_reader",
140 srcs = [
141 ":joystick_reader.cc",
142 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800143 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800144 deps = [
Austin Schuhd58b2902020-03-01 19:28:04 -0800145 ":setpoint_fbs",
Stephan Massaltd021f972020-01-05 20:41:23 -0800146 "//aos:init",
147 "//aos/actions:action_lib",
Stephan Massaltd021f972020-01-05 20:41:23 -0800148 "//aos/logging",
149 "//frc971/autonomous:auto_fbs",
150 "//frc971/autonomous:base_autonomous_actor",
151 "//frc971/control_loops:profiled_subsystem_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700152 "//frc971/input:action_joystick_input",
153 "//frc971/input:drivetrain_input",
154 "//frc971/input:joystick_input",
Austin Schuh0b00c862021-10-17 17:39:10 -0700155 "//frc971/zeroing:wrap",
Sabina Davisa8fed3d2020-02-22 21:44:57 -0800156 "//y2020:constants",
Stephan Massaltd021f972020-01-05 20:41:23 -0800157 "//y2020/control_loops/drivetrain:drivetrain_base",
158 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
159 "//y2020/control_loops/superstructure:superstructure_status_fbs",
160 ],
161)
162
163aos_config(
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800164 name = "aos_config",
Stephan Massaltd021f972020-01-05 20:41:23 -0800165 src = "y2020.json",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700166 flatbuffers = [
167 "//aos/network:message_bridge_client_fbs",
168 "//aos/network:message_bridge_server_fbs",
169 "//aos/network:timestamp_fbs",
Jim Ostrowski977850f2022-01-22 21:04:22 -0800170 "//frc971/vision:vision_fbs",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700171 "//y2020/vision/sift:sift_fbs",
172 "//y2020/vision/sift:sift_training_fbs",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700173 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800174 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800175 visibility = ["//visibility:public"],
176 deps = [
Austin Schuh41fad8c2021-10-23 21:25:12 -0700177 ":config_logger",
Austin Schuhce3a1912020-03-15 15:14:19 -0700178 ":config_pi1",
179 ":config_pi2",
180 ":config_pi3",
Austin Schuh196a4452020-03-15 23:12:03 -0700181 ":config_pi4",
James Kuszmaul9c128122021-03-22 22:24:36 -0700182 ":config_pi5",
Austin Schuhce3a1912020-03-15 15:14:19 -0700183 ":config_roborio",
184 ],
185)
186
187[
188 aos_config(
189 name = "config_" + pi,
190 src = "y2020_" + pi + ".json",
191 flatbuffers = [
192 "//aos/network:message_bridge_client_fbs",
193 "//aos/network:message_bridge_server_fbs",
Jim Ostrowski977850f2022-01-22 21:04:22 -0800194 "//aos/network:remote_message_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700195 "//aos/network:timestamp_fbs",
Jim Ostrowski977850f2022-01-22 21:04:22 -0800196 "//frc971/vision:vision_fbs",
197 "//y2020/vision:galactic_search_path_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700198 "//y2020/vision/sift:sift_fbs",
199 "//y2020/vision/sift:sift_training_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700200 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800201 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhce3a1912020-03-15 15:14:19 -0700202 visibility = ["//visibility:public"],
203 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800204 "//aos/events:aos_config",
205 "//frc971/control_loops/drivetrain:aos_config",
206 "//frc971/input:aos_config",
Austin Schuhce3a1912020-03-15 15:14:19 -0700207 ],
208 )
209 for pi in [
210 "pi1",
211 "pi2",
212 "pi3",
Austin Schuh196a4452020-03-15 23:12:03 -0700213 "pi4",
James Kuszmaul9c128122021-03-22 22:24:36 -0700214 "pi5",
Austin Schuhce3a1912020-03-15 15:14:19 -0700215 ]
216]
217
218aos_config(
Austin Schuh41fad8c2021-10-23 21:25:12 -0700219 name = "config_logger",
220 src = "y2020_logger.json",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700221 flatbuffers = [
222 "//aos/network:message_bridge_client_fbs",
223 "//aos/network:message_bridge_server_fbs",
Jim Ostrowski977850f2022-01-22 21:04:22 -0800224 "//aos/network:remote_message_fbs",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700225 "//aos/network:timestamp_fbs",
Jim Ostrowski977850f2022-01-22 21:04:22 -0800226 "//frc971/vision:vision_fbs",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700227 "//y2020/vision/sift:sift_fbs",
228 "//y2020/vision/sift:sift_training_fbs",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700229 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800230 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700231 visibility = ["//visibility:public"],
232 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800233 "//aos/events:aos_config",
234 "//frc971/control_loops/drivetrain:aos_config",
235 "//frc971/input:aos_config",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700236 ],
237)
238
239aos_config(
Austin Schuhce3a1912020-03-15 15:14:19 -0700240 name = "config_roborio",
241 src = "y2020_roborio.json",
242 flatbuffers = [
243 ":setpoint_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800244 "//aos/network:remote_message_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700245 "//aos/network:message_bridge_client_fbs",
246 "//aos/network:message_bridge_server_fbs",
247 "//aos/network:timestamp_fbs",
milind-u661a1182021-09-21 20:30:43 -0700248 "//y2020/control_loops/superstructure/shooter:shooter_tuning_params_fbs",
milind-u4b31c4d2021-09-18 16:08:23 -0700249 "//y2020/control_loops/superstructure/shooter:shooter_tuning_readings_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700250 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
251 "//y2019/control_loops/drivetrain:target_selector_fbs",
James Kuszmaul5ff8a862021-09-25 17:29:43 -0700252 "//y2020/control_loops/drivetrain:localizer_debug_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700253 "//y2020/control_loops/superstructure:superstructure_output_fbs",
254 "//y2020/control_loops/superstructure:superstructure_position_fbs",
255 "//y2020/control_loops/superstructure:superstructure_status_fbs",
256 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800257 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhce3a1912020-03-15 15:14:19 -0700258 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800259 "//aos/events:aos_config",
260 "//frc971/autonomous:aos_config",
261 "//frc971/control_loops/drivetrain:aos_config",
262 "//frc971/input:aos_config",
263 "//frc971/wpilib:aos_config",
Stephan Massaltd021f972020-01-05 20:41:23 -0800264 ],
265)
266
267py_library(
268 name = "python_init",
269 srcs = ["__init__.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800270 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800271 visibility = ["//visibility:public"],
272)
Alex Perry5f474f22020-02-01 12:14:24 -0800273
274sh_binary(
James Kuszmaul5e6aa252021-08-28 22:19:29 -0700275 name = "log_web_proxy",
276 srcs = ["log_web_proxy.sh"],
277 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800278 ":aos_config",
James Kuszmaul5e6aa252021-08-28 22:19:29 -0700279 "//aos/network:log_web_proxy_main",
280 "//y2020/www:camera_main_bundle.min.js",
281 "//y2020/www:field_main_bundle.min.js",
282 "//y2020/www:files",
283 ],
284 target_compatible_with = ["@platforms//os:linux"],
285)
286
287sh_binary(
Alex Perry5f474f22020-02-01 12:14:24 -0800288 name = "web_proxy",
289 srcs = ["web_proxy.sh"],
290 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800291 ":aos_config",
Alex Perry5f474f22020-02-01 12:14:24 -0800292 "//aos/network:web_proxy_main",
Austin Schuhda9d0602019-09-15 17:29:38 -0700293 "//y2020/www:camera_main_bundle.min.js",
294 "//y2020/www:field_main_bundle.min.js",
Alex Perry5f474f22020-02-01 12:14:24 -0800295 "//y2020/www:files",
Alex Perry5f474f22020-02-01 12:14:24 -0800296 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800297 target_compatible_with = ["@platforms//os:linux"],
Alex Perry5f474f22020-02-01 12:14:24 -0800298)
Austin Schuhd58b2902020-03-01 19:28:04 -0800299
Austin Schuhd58b2902020-03-01 19:28:04 -0800300flatbuffer_cc_library(
301 name = "setpoint_fbs",
302 srcs = [
303 "setpoint.fbs",
304 ],
305 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -0800306 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhd58b2902020-03-01 19:28:04 -0800307)
308
309cc_binary(
310 name = "setpoint_setter",
311 srcs = ["setpoint_setter.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800312 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhd58b2902020-03-01 19:28:04 -0800313 deps = [
314 ":setpoint_fbs",
315 "//aos:init",
316 "//aos/events:shm_event_loop",
317 ],
318)
James Kuszmaul55d9fc72020-05-10 18:58:08 -0700319
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700320[
321 jinja2_template(
322 name = "y2020_pi" + str(num) + ".json",
323 src = "y2020_pi_template.json",
324 parameters = {"NUM": str(num)},
Philipp Schraderdada1072020-11-24 11:34:46 -0800325 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700326 )
James Kuszmaul9c128122021-03-22 22:24:36 -0700327 for num in range(1, 6)
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700328]