blob: 19debdcca1ece0eae21ca3654d0d549c426e195f [file] [log] [blame]
Stephan Massaltd021f972020-01-05 20:41:23 -08001load("//frc971:downloader.bzl", "robot_downloader")
2load("//aos:config.bzl", "aos_config")
3load("@com_google_protobuf//:protobuf.bzl", "cc_proto_library")
4load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
Austin Schuh3a2f4a42020-09-16 14:10:39 -07005load("//tools/build_rules:template.bzl", "jinja2_template")
Stephan Massaltd021f972020-01-05 20:41:23 -08006
7robot_downloader(
Austin Schuhd58b2902020-03-01 19:28:04 -08008 binaries = [
9 ":setpoint_setter",
James Kuszmaul39a47bb2021-08-18 20:03:09 -070010 "//aos/network:web_proxy_main",
Austin Schuhd58b2902020-03-01 19:28:04 -080011 ],
Stephan Massaltd021f972020-01-05 20:41:23 -080012 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -070013 ":config",
Stephan Massaltd021f972020-01-05 20:41:23 -080014 ],
Ravago Jonesc2a08022021-02-06 17:40:54 -080015 dirs = [
James Kuszmaul75a18c52021-03-10 22:02:07 -080016 "//y2020/actors:splines",
James Kuszmaul39a47bb2021-08-18 20:03:09 -070017 "//y2020/www:www_files",
Ravago Jonesc2a08022021-02-06 17:40:54 -080018 ],
Stephan Massaltd021f972020-01-05 20:41:23 -080019 start_binaries = [
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080020 "//aos/events/logging:logger_main",
James Kuszmaul5e6aa252021-08-28 22:19:29 -070021 "//aos/network:web_proxy_main",
Stephan Massaltd021f972020-01-05 20:41:23 -080022 ":joystick_reader",
23 ":wpilib_interface",
Austin Schuh6aa77be2020-02-22 21:06:40 -080024 "//aos/network:message_bridge_client",
25 "//aos/network:message_bridge_server",
26 "//y2020/actors:binaries",
Stephan Massaltd021f972020-01-05 20:41:23 -080027 "//y2020/control_loops/drivetrain:drivetrain",
James Kuszmaul75a18c52021-03-10 22:02:07 -080028 "//y2020/control_loops/drivetrain:trajectory_generator",
Stephan Massaltd021f972020-01-05 20:41:23 -080029 "//y2020/control_loops/superstructure:superstructure",
Stephan Massaltd021f972020-01-05 20:41:23 -080030 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080031 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -080032)
33
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080034robot_downloader(
35 name = "pi_download",
Jim Ostrowskibaa43692020-03-08 16:25:10 -070036 binaries = [
37 "//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 = [
46 "//aos/network:message_bridge_client",
47 "//aos/network:message_bridge_server",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080048 "//aos/network:web_proxy_main",
Austin Schuh393015b2020-04-20 17:24:39 -070049 "//y2020/vision:camera_reader",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080050 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080051 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080052 target_type = "pi",
53)
54
Stephan Massaltd021f972020-01-05 20:41:23 -080055cc_library(
56 name = "constants",
57 srcs = [
58 "constants.cc",
59 ],
60 hdrs = [
61 "constants.h",
62 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080063 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -080064 visibility = ["//visibility:public"],
65 deps = [
66 "//aos/logging",
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",
Stephan Massaltd021f972020-01-05 20:41:23 -080079 "@com_google_absl//absl/base",
80 ],
81)
82
83cc_binary(
84 name = "wpilib_interface",
85 srcs = [
86 "wpilib_interface.cc",
87 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080088 target_compatible_with = ["//tools/platforms/hardware:roborio"],
Stephan Massaltd021f972020-01-05 20:41:23 -080089 deps = [
90 ":constants",
91 "//aos:init",
Stephan Massaltd021f972020-01-05 20:41:23 -080092 "//aos:math",
Stephan Massaltd021f972020-01-05 20:41:23 -080093 "//aos/events:shm_event_loop",
94 "//aos/logging",
Stephan Massaltd021f972020-01-05 20:41:23 -080095 "//aos/stl_mutex",
96 "//aos/time",
97 "//aos/util:log_interval",
98 "//aos/util:phased_loop",
99 "//aos/util:wrapping_counter",
100 "//frc971/autonomous:auto_mode_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700101 "//frc971/control_loops:control_loop",
Stephan Massaltd021f972020-01-05 20:41:23 -0800102 "//frc971/control_loops:control_loops_fbs",
103 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700104 "//frc971/input:robot_state_fbs",
James Kuszmaula244a912020-01-18 13:50:50 -0800105 "//frc971/wpilib:ADIS16470",
Stephan Massaltd021f972020-01-05 20:41:23 -0800106 "//frc971/wpilib:buffered_pcm",
107 "//frc971/wpilib:drivetrain_writer",
108 "//frc971/wpilib:encoder_and_potentiometer",
109 "//frc971/wpilib:interrupt_edge_counting",
110 "//frc971/wpilib:joystick_sender",
111 "//frc971/wpilib:logging_fbs",
112 "//frc971/wpilib:loop_output_handler",
113 "//frc971/wpilib:pdp_fetcher",
114 "//frc971/wpilib:sensor_reader",
115 "//frc971/wpilib:wpilib_interface",
116 "//frc971/wpilib:wpilib_robot_base",
Alex Perryc4691f52020-02-17 19:20:01 -0800117 "//third_party:phoenix",
Stephan Massaltd021f972020-01-05 20:41:23 -0800118 "//third_party:wpilib",
119 "//y2020/control_loops/superstructure:superstructure_output_fbs",
120 "//y2020/control_loops/superstructure:superstructure_position_fbs",
121 ],
122)
123
124cc_binary(
125 name = "joystick_reader",
126 srcs = [
127 ":joystick_reader.cc",
128 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800129 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800130 deps = [
Austin Schuhd58b2902020-03-01 19:28:04 -0800131 ":setpoint_fbs",
Stephan Massaltd021f972020-01-05 20:41:23 -0800132 "//aos:init",
133 "//aos/actions:action_lib",
Stephan Massaltd021f972020-01-05 20:41:23 -0800134 "//aos/logging",
135 "//frc971/autonomous:auto_fbs",
136 "//frc971/autonomous:base_autonomous_actor",
137 "//frc971/control_loops:profiled_subsystem_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700138 "//frc971/input:action_joystick_input",
139 "//frc971/input:drivetrain_input",
140 "//frc971/input:joystick_input",
Sabina Davisa8fed3d2020-02-22 21:44:57 -0800141 "//y2020:constants",
Stephan Massaltd021f972020-01-05 20:41:23 -0800142 "//y2020/control_loops/drivetrain:drivetrain_base",
143 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
144 "//y2020/control_loops/superstructure:superstructure_status_fbs",
145 ],
146)
147
148aos_config(
149 name = "config",
150 src = "y2020.json",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700151 flatbuffers = [
152 "//aos/network:message_bridge_client_fbs",
153 "//aos/network:message_bridge_server_fbs",
154 "//aos/network:timestamp_fbs",
155 "//y2020/vision/sift:sift_fbs",
156 "//y2020/vision/sift:sift_training_fbs",
157 "//y2020/vision:vision_fbs",
158 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800159 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800160 visibility = ["//visibility:public"],
161 deps = [
Austin Schuh196a4452020-03-15 23:12:03 -0700162 ":config_laptop",
Austin Schuhce3a1912020-03-15 15:14:19 -0700163 ":config_pi1",
164 ":config_pi2",
165 ":config_pi3",
Austin Schuh196a4452020-03-15 23:12:03 -0700166 ":config_pi4",
James Kuszmaul9c128122021-03-22 22:24:36 -0700167 ":config_pi5",
Austin Schuhce3a1912020-03-15 15:14:19 -0700168 ":config_roborio",
169 ],
170)
171
172[
173 aos_config(
174 name = "config_" + pi,
175 src = "y2020_" + pi + ".json",
176 flatbuffers = [
177 "//aos/network:message_bridge_client_fbs",
178 "//aos/network:message_bridge_server_fbs",
179 "//aos/network:timestamp_fbs",
180 "//y2020/vision/sift:sift_fbs",
181 "//y2020/vision/sift:sift_training_fbs",
182 "//y2020/vision:vision_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800183 "//aos/network:remote_message_fbs",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700184 "//y2020/vision:galactic_search_path_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700185 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800186 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhce3a1912020-03-15 15:14:19 -0700187 visibility = ["//visibility:public"],
188 deps = [
189 "//aos/events:config",
Austin Schuhac17fba2020-03-28 15:55:33 -0700190 "//frc971/control_loops/drivetrain:config",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700191 "//frc971/input:config",
Austin Schuhce3a1912020-03-15 15:14:19 -0700192 ],
193 )
194 for pi in [
195 "pi1",
196 "pi2",
197 "pi3",
Austin Schuh196a4452020-03-15 23:12:03 -0700198 "pi4",
James Kuszmaul9c128122021-03-22 22:24:36 -0700199 "pi5",
Austin Schuhce3a1912020-03-15 15:14:19 -0700200 ]
201]
202
203aos_config(
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700204 name = "config_laptop",
205 src = "y2020_laptop.json",
206 flatbuffers = [
207 "//aos/network:message_bridge_client_fbs",
208 "//aos/network:message_bridge_server_fbs",
209 "//aos/network:timestamp_fbs",
210 "//y2020/vision/sift:sift_fbs",
211 "//y2020/vision/sift:sift_training_fbs",
212 "//y2020/vision:vision_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800213 "//aos/network:remote_message_fbs",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700214 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800215 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700216 visibility = ["//visibility:public"],
217 deps = [
218 "//aos/events:config",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700219 "//frc971/control_loops/drivetrain:config",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700220 "//frc971/input:config",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700221 ],
222)
223
224aos_config(
Austin Schuhce3a1912020-03-15 15:14:19 -0700225 name = "config_roborio",
226 src = "y2020_roborio.json",
227 flatbuffers = [
228 ":setpoint_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800229 "//aos/network:remote_message_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700230 "//aos/network:message_bridge_client_fbs",
231 "//aos/network:message_bridge_server_fbs",
232 "//aos/network:timestamp_fbs",
233 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
234 "//y2019/control_loops/drivetrain:target_selector_fbs",
James Kuszmaul5ff8a862021-09-25 17:29:43 -0700235 "//y2020/control_loops/drivetrain:localizer_debug_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700236 "//y2020/control_loops/superstructure:superstructure_output_fbs",
237 "//y2020/control_loops/superstructure:superstructure_position_fbs",
238 "//y2020/control_loops/superstructure:superstructure_status_fbs",
239 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800240 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhce3a1912020-03-15 15:14:19 -0700241 deps = [
242 "//aos/events:config",
Stephan Massaltd021f972020-01-05 20:41:23 -0800243 "//frc971/autonomous:config",
244 "//frc971/control_loops/drivetrain:config",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700245 "//frc971/input:config",
Stephan Massaltd021f972020-01-05 20:41:23 -0800246 "//frc971/wpilib:config",
247 ],
248)
249
250py_library(
251 name = "python_init",
252 srcs = ["__init__.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800253 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800254 visibility = ["//visibility:public"],
255)
Alex Perry5f474f22020-02-01 12:14:24 -0800256
257sh_binary(
James Kuszmaul5e6aa252021-08-28 22:19:29 -0700258 name = "log_web_proxy",
259 srcs = ["log_web_proxy.sh"],
260 data = [
261 ":config",
262 "//aos/network:log_web_proxy_main",
263 "//y2020/www:camera_main_bundle.min.js",
264 "//y2020/www:field_main_bundle.min.js",
265 "//y2020/www:files",
266 ],
267 target_compatible_with = ["@platforms//os:linux"],
268)
269
270sh_binary(
Alex Perry5f474f22020-02-01 12:14:24 -0800271 name = "web_proxy",
272 srcs = ["web_proxy.sh"],
273 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700274 ":config",
Alex Perry5f474f22020-02-01 12:14:24 -0800275 "//aos/network:web_proxy_main",
Austin Schuhda9d0602019-09-15 17:29:38 -0700276 "//y2020/www:camera_main_bundle.min.js",
277 "//y2020/www:field_main_bundle.min.js",
Alex Perry5f474f22020-02-01 12:14:24 -0800278 "//y2020/www:files",
Alex Perry5f474f22020-02-01 12:14:24 -0800279 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800280 target_compatible_with = ["@platforms//os:linux"],
Alex Perry5f474f22020-02-01 12:14:24 -0800281)
Austin Schuhd58b2902020-03-01 19:28:04 -0800282
283load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
284
285flatbuffer_cc_library(
286 name = "setpoint_fbs",
287 srcs = [
288 "setpoint.fbs",
289 ],
290 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -0800291 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhd58b2902020-03-01 19:28:04 -0800292)
293
294cc_binary(
295 name = "setpoint_setter",
296 srcs = ["setpoint_setter.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800297 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhd58b2902020-03-01 19:28:04 -0800298 deps = [
299 ":setpoint_fbs",
300 "//aos:init",
301 "//aos/events:shm_event_loop",
302 ],
303)
James Kuszmaul55d9fc72020-05-10 18:58:08 -0700304
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700305[
306 jinja2_template(
307 name = "y2020_pi" + str(num) + ".json",
308 src = "y2020_pi_template.json",
309 parameters = {"NUM": str(num)},
Philipp Schraderdada1072020-11-24 11:34:46 -0800310 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700311 )
James Kuszmaul9c128122021-03-22 22:24:36 -0700312 for num in range(1, 6)
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700313]