blob: 95f6f74f448bbf4d7b7ae741f3538bb921357d50 [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 Schuh14d7d3d2020-09-10 18:14:36 -070012 ":config",
Stephan Massaltd021f972020-01-05 20:41:23 -080013 ],
Ravago Jonesc2a08022021-02-06 17:40:54 -080014 dirs = [
James Kuszmaul75a18c52021-03-10 22:02:07 -080015 "//y2020/actors:splines",
James Kuszmaul39a47bb2021-08-18 20:03:09 -070016 "//y2020/www:www_files",
Ravago Jonesc2a08022021-02-06 17:40:54 -080017 ],
Stephan Massaltd021f972020-01-05 20:41:23 -080018 start_binaries = [
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080019 "//aos/events/logging:logger_main",
James Kuszmaul5e6aa252021-08-28 22:19:29 -070020 "//aos/network:web_proxy_main",
Stephan Massaltd021f972020-01-05 20:41:23 -080021 ":joystick_reader",
22 ":wpilib_interface",
Austin Schuh6aa77be2020-02-22 21:06:40 -080023 "//aos/network:message_bridge_client",
24 "//aos/network:message_bridge_server",
25 "//y2020/actors:binaries",
Stephan Massaltd021f972020-01-05 20:41:23 -080026 "//y2020/control_loops/drivetrain:drivetrain",
James Kuszmaul75a18c52021-03-10 22:02:07 -080027 "//y2020/control_loops/drivetrain:trajectory_generator",
Stephan Massaltd021f972020-01-05 20:41:23 -080028 "//y2020/control_loops/superstructure:superstructure",
Stephan Massaltd021f972020-01-05 20:41:23 -080029 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080030 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -080031)
32
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080033robot_downloader(
34 name = "pi_download",
Jim Ostrowskibaa43692020-03-08 16:25:10 -070035 binaries = [
Yash Chainani5c005da2022-01-22 16:51:11 -080036 "//y2020/vision:calibration",
Jim Ostrowskibaa43692020-03-08 16:25:10 -070037 "//y2020/vision:viewer",
38 ],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080039 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -070040 ":config",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080041 ],
42 dirs = [
43 "//y2020/www:www_files",
44 ],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080045 start_binaries = [
Austin Schuh867bd922021-11-07 16:59:52 -080046 "//aos/events/logging:logger_main",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080047 "//aos/network:message_bridge_client",
48 "//aos/network:message_bridge_server",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080049 "//aos/network:web_proxy_main",
Austin Schuh393015b2020-04-20 17:24:39 -070050 "//y2020/vision:camera_reader",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080051 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080052 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080053 target_type = "pi",
54)
55
Stephan Massaltd021f972020-01-05 20:41:23 -080056cc_library(
57 name = "constants",
58 srcs = [
59 "constants.cc",
60 ],
61 hdrs = [
62 "constants.h",
63 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080064 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -080065 visibility = ["//visibility:public"],
66 deps = [
Stephan Massaltd021f972020-01-05 20:41:23 -080067 "//aos/network:team_number",
Brian Silverman1463c092020-10-30 17:28:24 -070068 "//aos/stl_mutex",
Stephan Massaltd021f972020-01-05 20:41:23 -080069 "//frc971:constants",
Stephan Massaltd021f972020-01-05 20:41:23 -080070 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
James Kuszmaul98154a22021-04-03 16:09:29 -070071 "//frc971/shooter_interpolation:interpolation",
Stephan Massaltd021f972020-01-05 20:41:23 -080072 "//y2020/control_loops/drivetrain:polydrivetrain_plants",
Austin Schuh9dcd5202020-02-20 20:06:04 -080073 "//y2020/control_loops/superstructure/accelerator:accelerator_plants",
74 "//y2020/control_loops/superstructure/control_panel:control_panel_plants",
75 "//y2020/control_loops/superstructure/finisher:finisher_plants",
Sabina Davisa587fbd2020-01-31 22:11:15 -080076 "//y2020/control_loops/superstructure/hood:hood_plants",
Sabina Davise8d38992020-02-02 15:00:31 -080077 "//y2020/control_loops/superstructure/intake:intake_plants",
Kai Tinkess10943cf2020-02-01 15:49:57 -080078 "//y2020/control_loops/superstructure/turret:turret_plants",
Brian Silvermanf4d329c2021-11-04 19:32:10 -070079 "@com_github_google_glog//:glog",
Stephan Massaltd021f972020-01-05 20:41:23 -080080 "@com_google_absl//absl/base",
81 ],
82)
83
84cc_binary(
85 name = "wpilib_interface",
86 srcs = [
87 "wpilib_interface.cc",
88 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080089 target_compatible_with = ["//tools/platforms/hardware:roborio"],
Stephan Massaltd021f972020-01-05 20:41:23 -080090 deps = [
91 ":constants",
92 "//aos:init",
Stephan Massaltd021f972020-01-05 20:41:23 -080093 "//aos:math",
Stephan Massaltd021f972020-01-05 20:41:23 -080094 "//aos/events:shm_event_loop",
95 "//aos/logging",
Stephan Massaltd021f972020-01-05 20:41:23 -080096 "//aos/stl_mutex",
97 "//aos/time",
98 "//aos/util:log_interval",
99 "//aos/util:phased_loop",
100 "//aos/util:wrapping_counter",
101 "//frc971/autonomous:auto_mode_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700102 "//frc971/control_loops:control_loop",
Stephan Massaltd021f972020-01-05 20:41:23 -0800103 "//frc971/control_loops:control_loops_fbs",
104 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700105 "//frc971/input:robot_state_fbs",
James Kuszmaul0a981402021-10-09 21:00:34 -0700106 "//frc971/wpilib:ADIS16448",
James Kuszmaula244a912020-01-18 13:50:50 -0800107 "//frc971/wpilib:ADIS16470",
Stephan Massaltd021f972020-01-05 20:41:23 -0800108 "//frc971/wpilib:buffered_pcm",
109 "//frc971/wpilib:drivetrain_writer",
110 "//frc971/wpilib:encoder_and_potentiometer",
111 "//frc971/wpilib:interrupt_edge_counting",
112 "//frc971/wpilib:joystick_sender",
113 "//frc971/wpilib:logging_fbs",
114 "//frc971/wpilib:loop_output_handler",
115 "//frc971/wpilib:pdp_fetcher",
116 "//frc971/wpilib:sensor_reader",
117 "//frc971/wpilib:wpilib_interface",
118 "//frc971/wpilib:wpilib_robot_base",
Alex Perryc4691f52020-02-17 19:20:01 -0800119 "//third_party:phoenix",
Stephan Massaltd021f972020-01-05 20:41:23 -0800120 "//third_party:wpilib",
121 "//y2020/control_loops/superstructure:superstructure_output_fbs",
122 "//y2020/control_loops/superstructure:superstructure_position_fbs",
James Kuszmaul0a981402021-10-09 21:00:34 -0700123 "//y2020/control_loops/superstructure/shooter:shooter_tuning_readings_fbs",
Stephan Massaltd021f972020-01-05 20:41:23 -0800124 ],
125)
126
127cc_binary(
128 name = "joystick_reader",
129 srcs = [
130 ":joystick_reader.cc",
131 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800132 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800133 deps = [
Austin Schuhd58b2902020-03-01 19:28:04 -0800134 ":setpoint_fbs",
Stephan Massaltd021f972020-01-05 20:41:23 -0800135 "//aos:init",
136 "//aos/actions:action_lib",
Stephan Massaltd021f972020-01-05 20:41:23 -0800137 "//aos/logging",
138 "//frc971/autonomous:auto_fbs",
139 "//frc971/autonomous:base_autonomous_actor",
140 "//frc971/control_loops:profiled_subsystem_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700141 "//frc971/input:action_joystick_input",
142 "//frc971/input:drivetrain_input",
143 "//frc971/input:joystick_input",
Austin Schuh0b00c862021-10-17 17:39:10 -0700144 "//frc971/zeroing:wrap",
Sabina Davisa8fed3d2020-02-22 21:44:57 -0800145 "//y2020:constants",
Stephan Massaltd021f972020-01-05 20:41:23 -0800146 "//y2020/control_loops/drivetrain:drivetrain_base",
147 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
148 "//y2020/control_loops/superstructure:superstructure_status_fbs",
149 ],
150)
151
152aos_config(
153 name = "config",
154 src = "y2020.json",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700155 flatbuffers = [
156 "//aos/network:message_bridge_client_fbs",
157 "//aos/network:message_bridge_server_fbs",
158 "//aos/network:timestamp_fbs",
159 "//y2020/vision/sift:sift_fbs",
160 "//y2020/vision/sift:sift_training_fbs",
161 "//y2020/vision:vision_fbs",
162 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800163 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800164 visibility = ["//visibility:public"],
165 deps = [
Austin Schuh41fad8c2021-10-23 21:25:12 -0700166 ":config_logger",
Austin Schuhce3a1912020-03-15 15:14:19 -0700167 ":config_pi1",
168 ":config_pi2",
169 ":config_pi3",
Austin Schuh196a4452020-03-15 23:12:03 -0700170 ":config_pi4",
James Kuszmaul9c128122021-03-22 22:24:36 -0700171 ":config_pi5",
Austin Schuhce3a1912020-03-15 15:14:19 -0700172 ":config_roborio",
173 ],
174)
175
176[
177 aos_config(
178 name = "config_" + pi,
179 src = "y2020_" + pi + ".json",
180 flatbuffers = [
181 "//aos/network:message_bridge_client_fbs",
182 "//aos/network:message_bridge_server_fbs",
183 "//aos/network:timestamp_fbs",
184 "//y2020/vision/sift:sift_fbs",
185 "//y2020/vision/sift:sift_training_fbs",
186 "//y2020/vision:vision_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800187 "//aos/network:remote_message_fbs",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700188 "//y2020/vision:galactic_search_path_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700189 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800190 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhce3a1912020-03-15 15:14:19 -0700191 visibility = ["//visibility:public"],
192 deps = [
193 "//aos/events:config",
Austin Schuhac17fba2020-03-28 15:55:33 -0700194 "//frc971/control_loops/drivetrain:config",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700195 "//frc971/input:config",
Austin Schuhce3a1912020-03-15 15:14:19 -0700196 ],
197 )
198 for pi in [
199 "pi1",
200 "pi2",
201 "pi3",
Austin Schuh196a4452020-03-15 23:12:03 -0700202 "pi4",
James Kuszmaul9c128122021-03-22 22:24:36 -0700203 "pi5",
Austin Schuhce3a1912020-03-15 15:14:19 -0700204 ]
205]
206
207aos_config(
Austin Schuh41fad8c2021-10-23 21:25:12 -0700208 name = "config_logger",
209 src = "y2020_logger.json",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700210 flatbuffers = [
211 "//aos/network:message_bridge_client_fbs",
212 "//aos/network:message_bridge_server_fbs",
213 "//aos/network:timestamp_fbs",
214 "//y2020/vision/sift:sift_fbs",
215 "//y2020/vision/sift:sift_training_fbs",
216 "//y2020/vision:vision_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800217 "//aos/network:remote_message_fbs",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700218 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800219 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700220 visibility = ["//visibility:public"],
221 deps = [
222 "//aos/events:config",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700223 "//frc971/control_loops/drivetrain:config",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700224 "//frc971/input:config",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700225 ],
226)
227
228aos_config(
Austin Schuhce3a1912020-03-15 15:14:19 -0700229 name = "config_roborio",
230 src = "y2020_roborio.json",
231 flatbuffers = [
232 ":setpoint_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800233 "//aos/network:remote_message_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700234 "//aos/network:message_bridge_client_fbs",
235 "//aos/network:message_bridge_server_fbs",
236 "//aos/network:timestamp_fbs",
milind-u661a1182021-09-21 20:30:43 -0700237 "//y2020/control_loops/superstructure/shooter:shooter_tuning_params_fbs",
milind-u4b31c4d2021-09-18 16:08:23 -0700238 "//y2020/control_loops/superstructure/shooter:shooter_tuning_readings_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700239 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
240 "//y2019/control_loops/drivetrain:target_selector_fbs",
James Kuszmaul5ff8a862021-09-25 17:29:43 -0700241 "//y2020/control_loops/drivetrain:localizer_debug_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700242 "//y2020/control_loops/superstructure:superstructure_output_fbs",
243 "//y2020/control_loops/superstructure:superstructure_position_fbs",
244 "//y2020/control_loops/superstructure:superstructure_status_fbs",
245 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800246 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhce3a1912020-03-15 15:14:19 -0700247 deps = [
248 "//aos/events:config",
Stephan Massaltd021f972020-01-05 20:41:23 -0800249 "//frc971/autonomous:config",
250 "//frc971/control_loops/drivetrain:config",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700251 "//frc971/input:config",
Stephan Massaltd021f972020-01-05 20:41:23 -0800252 "//frc971/wpilib:config",
253 ],
254)
255
256py_library(
257 name = "python_init",
258 srcs = ["__init__.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800259 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800260 visibility = ["//visibility:public"],
261)
Alex Perry5f474f22020-02-01 12:14:24 -0800262
263sh_binary(
James Kuszmaul5e6aa252021-08-28 22:19:29 -0700264 name = "log_web_proxy",
265 srcs = ["log_web_proxy.sh"],
266 data = [
267 ":config",
268 "//aos/network:log_web_proxy_main",
269 "//y2020/www:camera_main_bundle.min.js",
270 "//y2020/www:field_main_bundle.min.js",
271 "//y2020/www:files",
272 ],
273 target_compatible_with = ["@platforms//os:linux"],
274)
275
276sh_binary(
Alex Perry5f474f22020-02-01 12:14:24 -0800277 name = "web_proxy",
278 srcs = ["web_proxy.sh"],
279 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700280 ":config",
Alex Perry5f474f22020-02-01 12:14:24 -0800281 "//aos/network:web_proxy_main",
Austin Schuhda9d0602019-09-15 17:29:38 -0700282 "//y2020/www:camera_main_bundle.min.js",
283 "//y2020/www:field_main_bundle.min.js",
Alex Perry5f474f22020-02-01 12:14:24 -0800284 "//y2020/www:files",
Alex Perry5f474f22020-02-01 12:14:24 -0800285 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800286 target_compatible_with = ["@platforms//os:linux"],
Alex Perry5f474f22020-02-01 12:14:24 -0800287)
Austin Schuhd58b2902020-03-01 19:28:04 -0800288
Austin Schuhd58b2902020-03-01 19:28:04 -0800289flatbuffer_cc_library(
290 name = "setpoint_fbs",
291 srcs = [
292 "setpoint.fbs",
293 ],
294 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -0800295 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhd58b2902020-03-01 19:28:04 -0800296)
297
298cc_binary(
299 name = "setpoint_setter",
300 srcs = ["setpoint_setter.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800301 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhd58b2902020-03-01 19:28:04 -0800302 deps = [
303 ":setpoint_fbs",
304 "//aos:init",
305 "//aos/events:shm_event_loop",
306 ],
307)
James Kuszmaul55d9fc72020-05-10 18:58:08 -0700308
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700309[
310 jinja2_template(
311 name = "y2020_pi" + str(num) + ".json",
312 src = "y2020_pi_template.json",
313 parameters = {"NUM": str(num)},
Philipp Schraderdada1072020-11-24 11:34:46 -0800314 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700315 )
James Kuszmaul9c128122021-03-22 22:24:36 -0700316 for num in range(1, 6)
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700317]