blob: 51fbb54b3812c18ff0bb464679383f88acf517ff [file] [log] [blame]
Stephan Massaltd021f972020-01-05 20:41:23 -08001load("//aos:config.bzl", "aos_config")
Austin Schuh8f99c822024-05-05 22:43:40 -07002load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
James Kuszmaule50ef1e2023-05-16 21:08:04 -07003load("//aos/util:config_validator_macro.bzl", "config_validator_test")
Austin Schuh8f99c822024-05-05 22:43:40 -07004load("//frc971:downloader.bzl", "robot_downloader")
5load("//tools/build_rules:template.bzl", "jinja2_template")
James Kuszmaule50ef1e2023-05-16 21:08:04 -07006
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",
Maxwell Henderson1c0843c2023-12-22 16:20:59 -080019 "@ctre_phoenix6_api_cpp_athena//:shared_libraries",
20 "@ctre_phoenix6_tools_athena//:shared_libraries",
Austin Schuhde605f12022-02-23 23:08:19 -080021 "@ctre_phoenix_api_cpp_athena//:shared_libraries",
22 "@ctre_phoenix_cci_athena//:shared_libraries",
Stephan Massaltd021f972020-01-05 20:41:23 -080023 ],
Ravago Jonesc2a08022021-02-06 17:40:54 -080024 dirs = [
James Kuszmaul75a18c52021-03-10 22:02:07 -080025 "//y2020/actors:splines",
James Kuszmaul39a47bb2021-08-18 20:03:09 -070026 "//y2020/www:www_files",
Ravago Jonesc2a08022021-02-06 17:40:54 -080027 ],
Stephan Massaltd021f972020-01-05 20:41:23 -080028 start_binaries = [
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080029 "//aos/events/logging:logger_main",
James Kuszmaul5e6aa252021-08-28 22:19:29 -070030 "//aos/network:web_proxy_main",
Stephan Massaltd021f972020-01-05 20:41:23 -080031 ":joystick_reader",
32 ":wpilib_interface",
Austin Schuh6aa77be2020-02-22 21:06:40 -080033 "//aos/network:message_bridge_client",
34 "//aos/network:message_bridge_server",
35 "//y2020/actors:binaries",
Stephan Massaltd021f972020-01-05 20:41:23 -080036 "//y2020/control_loops/drivetrain:drivetrain",
James Kuszmaul75a18c52021-03-10 22:02:07 -080037 "//y2020/control_loops/drivetrain:trajectory_generator",
Stephan Massaltd021f972020-01-05 20:41:23 -080038 "//y2020/control_loops/superstructure:superstructure",
Stephan Massaltd021f972020-01-05 20:41:23 -080039 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080040 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -080041)
42
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080043robot_downloader(
44 name = "pi_download",
Jim Ostrowskibaa43692020-03-08 16:25:10 -070045 binaries = [
James Kuszmaul7e958812023-02-11 15:34:31 -080046 "//frc971/vision:intrinsics_calibration",
Jim Ostrowskibaa43692020-03-08 16:25:10 -070047 "//y2020/vision:viewer",
48 ],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080049 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -080050 ":aos_config",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080051 ],
52 dirs = [
53 "//y2020/www:www_files",
54 ],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080055 start_binaries = [
Austin Schuh867bd922021-11-07 16:59:52 -080056 "//aos/events/logging:logger_main",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080057 "//aos/network:message_bridge_client",
58 "//aos/network:message_bridge_server",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080059 "//aos/network:web_proxy_main",
Austin Schuh393015b2020-04-20 17:24:39 -070060 "//y2020/vision:camera_reader",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080061 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080062 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080063 target_type = "pi",
64)
65
Stephan Massaltd021f972020-01-05 20:41:23 -080066cc_library(
67 name = "constants",
68 srcs = [
69 "constants.cc",
70 ],
71 hdrs = [
72 "constants.h",
73 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080074 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -080075 visibility = ["//visibility:public"],
76 deps = [
Stephan Massaltd021f972020-01-05 20:41:23 -080077 "//aos/network:team_number",
Brian Silverman1463c092020-10-30 17:28:24 -070078 "//aos/stl_mutex",
Stephan Massaltd021f972020-01-05 20:41:23 -080079 "//frc971:constants",
Stephan Massaltd021f972020-01-05 20:41:23 -080080 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
James Kuszmaul98154a22021-04-03 16:09:29 -070081 "//frc971/shooter_interpolation:interpolation",
James Kuszmaulec635d22023-08-12 18:39:24 -070082 "//frc971/zeroing:absolute_and_absolute_encoder",
83 "//frc971/zeroing:absolute_encoder",
84 "//frc971/zeroing:pot_and_absolute_encoder",
Stephan Massaltd021f972020-01-05 20:41:23 -080085 "//y2020/control_loops/drivetrain:polydrivetrain_plants",
Austin Schuh9dcd5202020-02-20 20:06:04 -080086 "//y2020/control_loops/superstructure/accelerator:accelerator_plants",
87 "//y2020/control_loops/superstructure/control_panel:control_panel_plants",
88 "//y2020/control_loops/superstructure/finisher:finisher_plants",
Sabina Davisa587fbd2020-01-31 22:11:15 -080089 "//y2020/control_loops/superstructure/hood:hood_plants",
Sabina Davise8d38992020-02-02 15:00:31 -080090 "//y2020/control_loops/superstructure/intake:intake_plants",
Kai Tinkess10943cf2020-02-01 15:49:57 -080091 "//y2020/control_loops/superstructure/turret:turret_plants",
Stephan Massaltd021f972020-01-05 20:41:23 -080092 "@com_google_absl//absl/base",
Austin Schuh99f7c6a2024-06-25 22:07:44 -070093 "@com_google_absl//absl/log",
94 "@com_google_absl//absl/log:check",
Stephan Massaltd021f972020-01-05 20:41:23 -080095 ],
96)
97
98cc_binary(
99 name = "wpilib_interface",
100 srcs = [
101 "wpilib_interface.cc",
102 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800103 target_compatible_with = ["//tools/platforms/hardware:roborio"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800104 deps = [
105 ":constants",
106 "//aos:init",
Stephan Massaltd021f972020-01-05 20:41:23 -0800107 "//aos:math",
Stephan Massaltd021f972020-01-05 20:41:23 -0800108 "//aos/events:shm_event_loop",
109 "//aos/logging",
Stephan Massaltd021f972020-01-05 20:41:23 -0800110 "//aos/stl_mutex",
111 "//aos/time",
112 "//aos/util:log_interval",
113 "//aos/util:phased_loop",
114 "//aos/util:wrapping_counter",
115 "//frc971/autonomous:auto_mode_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700116 "//frc971/control_loops:control_loop",
Stephan Massaltd021f972020-01-05 20:41:23 -0800117 "//frc971/control_loops:control_loops_fbs",
118 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700119 "//frc971/input:robot_state_fbs",
James Kuszmaul0a981402021-10-09 21:00:34 -0700120 "//frc971/wpilib:ADIS16448",
James Kuszmaula244a912020-01-18 13:50:50 -0800121 "//frc971/wpilib:ADIS16470",
Stephan Massaltd021f972020-01-05 20:41:23 -0800122 "//frc971/wpilib:buffered_pcm",
123 "//frc971/wpilib:drivetrain_writer",
124 "//frc971/wpilib:encoder_and_potentiometer",
125 "//frc971/wpilib:interrupt_edge_counting",
126 "//frc971/wpilib:joystick_sender",
127 "//frc971/wpilib:logging_fbs",
128 "//frc971/wpilib:loop_output_handler",
129 "//frc971/wpilib:pdp_fetcher",
130 "//frc971/wpilib:sensor_reader",
131 "//frc971/wpilib:wpilib_interface",
132 "//frc971/wpilib:wpilib_robot_base",
Alex Perryc4691f52020-02-17 19:20:01 -0800133 "//third_party:phoenix",
Maxwell Henderson1c0843c2023-12-22 16:20:59 -0800134 "//third_party:phoenix6",
Stephan Massaltd021f972020-01-05 20:41:23 -0800135 "//third_party:wpilib",
136 "//y2020/control_loops/superstructure:superstructure_output_fbs",
137 "//y2020/control_loops/superstructure:superstructure_position_fbs",
James Kuszmaul0a981402021-10-09 21:00:34 -0700138 "//y2020/control_loops/superstructure/shooter:shooter_tuning_readings_fbs",
Stephan Massaltd021f972020-01-05 20:41:23 -0800139 ],
140)
141
142cc_binary(
143 name = "joystick_reader",
144 srcs = [
145 ":joystick_reader.cc",
146 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800147 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800148 deps = [
Austin Schuhd58b2902020-03-01 19:28:04 -0800149 ":setpoint_fbs",
Stephan Massaltd021f972020-01-05 20:41:23 -0800150 "//aos:init",
151 "//aos/actions:action_lib",
Stephan Massaltd021f972020-01-05 20:41:23 -0800152 "//aos/logging",
153 "//frc971/autonomous:auto_fbs",
154 "//frc971/autonomous:base_autonomous_actor",
155 "//frc971/control_loops:profiled_subsystem_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700156 "//frc971/input:action_joystick_input",
157 "//frc971/input:drivetrain_input",
158 "//frc971/input:joystick_input",
Austin Schuh0b00c862021-10-17 17:39:10 -0700159 "//frc971/zeroing:wrap",
Sabina Davisa8fed3d2020-02-22 21:44:57 -0800160 "//y2020:constants",
Stephan Massaltd021f972020-01-05 20:41:23 -0800161 "//y2020/control_loops/drivetrain:drivetrain_base",
162 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
163 "//y2020/control_loops/superstructure:superstructure_status_fbs",
164 ],
165)
166
167aos_config(
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800168 name = "aos_config",
Stephan Massaltd021f972020-01-05 20:41:23 -0800169 src = "y2020.json",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700170 flatbuffers = [
171 "//aos/network:message_bridge_client_fbs",
172 "//aos/network:message_bridge_server_fbs",
173 "//aos/network:timestamp_fbs",
Jim Ostrowski977850f2022-01-22 21:04:22 -0800174 "//frc971/vision:vision_fbs",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700175 "//y2020/vision/sift:sift_fbs",
176 "//y2020/vision/sift:sift_training_fbs",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700177 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800178 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800179 visibility = ["//visibility:public"],
180 deps = [
Austin Schuh41fad8c2021-10-23 21:25:12 -0700181 ":config_logger",
Austin Schuhce3a1912020-03-15 15:14:19 -0700182 ":config_pi1",
183 ":config_pi2",
184 ":config_pi3",
Austin Schuh196a4452020-03-15 23:12:03 -0700185 ":config_pi4",
James Kuszmaul9c128122021-03-22 22:24:36 -0700186 ":config_pi5",
Austin Schuhce3a1912020-03-15 15:14:19 -0700187 ":config_roborio",
188 ],
189)
190
191[
192 aos_config(
193 name = "config_" + pi,
194 src = "y2020_" + pi + ".json",
195 flatbuffers = [
196 "//aos/network:message_bridge_client_fbs",
197 "//aos/network:message_bridge_server_fbs",
Jim Ostrowski977850f2022-01-22 21:04:22 -0800198 "//aos/network:remote_message_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700199 "//aos/network:timestamp_fbs",
Jim Ostrowski977850f2022-01-22 21:04:22 -0800200 "//frc971/vision:vision_fbs",
201 "//y2020/vision:galactic_search_path_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700202 "//y2020/vision/sift:sift_fbs",
203 "//y2020/vision/sift:sift_training_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700204 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800205 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhce3a1912020-03-15 15:14:19 -0700206 visibility = ["//visibility:public"],
207 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800208 "//aos/events:aos_config",
209 "//frc971/control_loops/drivetrain:aos_config",
210 "//frc971/input:aos_config",
Austin Schuhce3a1912020-03-15 15:14:19 -0700211 ],
212 )
213 for pi in [
214 "pi1",
215 "pi2",
216 "pi3",
Austin Schuh196a4452020-03-15 23:12:03 -0700217 "pi4",
James Kuszmaul9c128122021-03-22 22:24:36 -0700218 "pi5",
Austin Schuhce3a1912020-03-15 15:14:19 -0700219 ]
220]
221
222aos_config(
Austin Schuh41fad8c2021-10-23 21:25:12 -0700223 name = "config_logger",
224 src = "y2020_logger.json",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700225 flatbuffers = [
226 "//aos/network:message_bridge_client_fbs",
227 "//aos/network:message_bridge_server_fbs",
Jim Ostrowski977850f2022-01-22 21:04:22 -0800228 "//aos/network:remote_message_fbs",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700229 "//aos/network:timestamp_fbs",
Jim Ostrowski977850f2022-01-22 21:04:22 -0800230 "//frc971/vision:vision_fbs",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700231 "//y2020/vision/sift:sift_fbs",
232 "//y2020/vision/sift:sift_training_fbs",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700233 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800234 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700235 visibility = ["//visibility:public"],
236 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800237 "//aos/events:aos_config",
238 "//frc971/control_loops/drivetrain:aos_config",
239 "//frc971/input:aos_config",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700240 ],
241)
242
243aos_config(
Austin Schuhce3a1912020-03-15 15:14:19 -0700244 name = "config_roborio",
245 src = "y2020_roborio.json",
246 flatbuffers = [
247 ":setpoint_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800248 "//aos/network:remote_message_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700249 "//aos/network:message_bridge_client_fbs",
250 "//aos/network:message_bridge_server_fbs",
251 "//aos/network:timestamp_fbs",
milind-u661a1182021-09-21 20:30:43 -0700252 "//y2020/control_loops/superstructure/shooter:shooter_tuning_params_fbs",
milind-u4b31c4d2021-09-18 16:08:23 -0700253 "//y2020/control_loops/superstructure/shooter:shooter_tuning_readings_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700254 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
255 "//y2019/control_loops/drivetrain:target_selector_fbs",
James Kuszmaul5ff8a862021-09-25 17:29:43 -0700256 "//y2020/control_loops/drivetrain:localizer_debug_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700257 "//y2020/control_loops/superstructure:superstructure_output_fbs",
258 "//y2020/control_loops/superstructure:superstructure_position_fbs",
259 "//y2020/control_loops/superstructure:superstructure_status_fbs",
260 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800261 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhce3a1912020-03-15 15:14:19 -0700262 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800263 "//aos/events:aos_config",
264 "//frc971/autonomous:aos_config",
265 "//frc971/control_loops/drivetrain:aos_config",
266 "//frc971/input:aos_config",
267 "//frc971/wpilib:aos_config",
Stephan Massaltd021f972020-01-05 20:41:23 -0800268 ],
269)
270
271py_library(
272 name = "python_init",
273 srcs = ["__init__.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800274 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800275 visibility = ["//visibility:public"],
276)
Alex Perry5f474f22020-02-01 12:14:24 -0800277
278sh_binary(
James Kuszmaul5e6aa252021-08-28 22:19:29 -0700279 name = "log_web_proxy",
280 srcs = ["log_web_proxy.sh"],
281 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800282 ":aos_config",
James Kuszmaul5e6aa252021-08-28 22:19:29 -0700283 "//aos/network:log_web_proxy_main",
284 "//y2020/www:camera_main_bundle.min.js",
285 "//y2020/www:field_main_bundle.min.js",
286 "//y2020/www:files",
287 ],
288 target_compatible_with = ["@platforms//os:linux"],
289)
290
291sh_binary(
Alex Perry5f474f22020-02-01 12:14:24 -0800292 name = "web_proxy",
293 srcs = ["web_proxy.sh"],
294 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800295 ":aos_config",
Alex Perry5f474f22020-02-01 12:14:24 -0800296 "//aos/network:web_proxy_main",
Austin Schuhda9d0602019-09-15 17:29:38 -0700297 "//y2020/www:camera_main_bundle.min.js",
298 "//y2020/www:field_main_bundle.min.js",
Alex Perry5f474f22020-02-01 12:14:24 -0800299 "//y2020/www:files",
Alex Perry5f474f22020-02-01 12:14:24 -0800300 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800301 target_compatible_with = ["@platforms//os:linux"],
Alex Perry5f474f22020-02-01 12:14:24 -0800302)
Austin Schuhd58b2902020-03-01 19:28:04 -0800303
James Kuszmaulf01da392023-12-14 11:22:14 -0800304static_flatbuffer(
Austin Schuhd58b2902020-03-01 19:28:04 -0800305 name = "setpoint_fbs",
306 srcs = [
307 "setpoint.fbs",
308 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800309 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhd58b2902020-03-01 19:28:04 -0800310)
311
312cc_binary(
313 name = "setpoint_setter",
314 srcs = ["setpoint_setter.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800315 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhd58b2902020-03-01 19:28:04 -0800316 deps = [
317 ":setpoint_fbs",
318 "//aos:init",
319 "//aos/events:shm_event_loop",
320 ],
321)
James Kuszmaul55d9fc72020-05-10 18:58:08 -0700322
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700323[
324 jinja2_template(
325 name = "y2020_pi" + str(num) + ".json",
326 src = "y2020_pi_template.json",
327 parameters = {"NUM": str(num)},
Philipp Schraderdada1072020-11-24 11:34:46 -0800328 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700329 )
James Kuszmaul9c128122021-03-22 22:24:36 -0700330 for num in range(1, 6)
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700331]