blob: 49e3c7b3febca21fd81485a540afd35af1ba01cc [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",
milind-u4b31c4d2021-09-18 16:08:23 -0700119 "//y2020/control_loops/superstructure/shooter:shooter_tuning_readings_fbs",
Stephan Massaltd021f972020-01-05 20:41:23 -0800120 "//y2020/control_loops/superstructure:superstructure_output_fbs",
121 "//y2020/control_loops/superstructure:superstructure_position_fbs",
122 ],
123)
124
125cc_binary(
126 name = "joystick_reader",
127 srcs = [
128 ":joystick_reader.cc",
129 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800130 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800131 deps = [
Austin Schuhd58b2902020-03-01 19:28:04 -0800132 ":setpoint_fbs",
Stephan Massaltd021f972020-01-05 20:41:23 -0800133 "//aos:init",
134 "//aos/actions:action_lib",
Stephan Massaltd021f972020-01-05 20:41:23 -0800135 "//aos/logging",
136 "//frc971/autonomous:auto_fbs",
137 "//frc971/autonomous:base_autonomous_actor",
138 "//frc971/control_loops:profiled_subsystem_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700139 "//frc971/input:action_joystick_input",
140 "//frc971/input:drivetrain_input",
141 "//frc971/input:joystick_input",
Sabina Davisa8fed3d2020-02-22 21:44:57 -0800142 "//y2020:constants",
Stephan Massaltd021f972020-01-05 20:41:23 -0800143 "//y2020/control_loops/drivetrain:drivetrain_base",
144 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
145 "//y2020/control_loops/superstructure:superstructure_status_fbs",
146 ],
147)
148
149aos_config(
150 name = "config",
151 src = "y2020.json",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700152 flatbuffers = [
153 "//aos/network:message_bridge_client_fbs",
154 "//aos/network:message_bridge_server_fbs",
155 "//aos/network:timestamp_fbs",
156 "//y2020/vision/sift:sift_fbs",
157 "//y2020/vision/sift:sift_training_fbs",
158 "//y2020/vision:vision_fbs",
159 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800160 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800161 visibility = ["//visibility:public"],
162 deps = [
Austin Schuh196a4452020-03-15 23:12:03 -0700163 ":config_laptop",
Austin Schuhce3a1912020-03-15 15:14:19 -0700164 ":config_pi1",
165 ":config_pi2",
166 ":config_pi3",
Austin Schuh196a4452020-03-15 23:12:03 -0700167 ":config_pi4",
James Kuszmaul9c128122021-03-22 22:24:36 -0700168 ":config_pi5",
Austin Schuhce3a1912020-03-15 15:14:19 -0700169 ":config_roborio",
170 ],
171)
172
173[
174 aos_config(
175 name = "config_" + pi,
176 src = "y2020_" + pi + ".json",
177 flatbuffers = [
178 "//aos/network:message_bridge_client_fbs",
179 "//aos/network:message_bridge_server_fbs",
180 "//aos/network:timestamp_fbs",
181 "//y2020/vision/sift:sift_fbs",
182 "//y2020/vision/sift:sift_training_fbs",
183 "//y2020/vision:vision_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800184 "//aos/network:remote_message_fbs",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700185 "//y2020/vision:galactic_search_path_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700186 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800187 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhce3a1912020-03-15 15:14:19 -0700188 visibility = ["//visibility:public"],
189 deps = [
190 "//aos/events:config",
Austin Schuhac17fba2020-03-28 15:55:33 -0700191 "//frc971/control_loops/drivetrain:config",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700192 "//frc971/input:config",
Austin Schuhce3a1912020-03-15 15:14:19 -0700193 ],
194 )
195 for pi in [
196 "pi1",
197 "pi2",
198 "pi3",
Austin Schuh196a4452020-03-15 23:12:03 -0700199 "pi4",
James Kuszmaul9c128122021-03-22 22:24:36 -0700200 "pi5",
Austin Schuhce3a1912020-03-15 15:14:19 -0700201 ]
202]
203
204aos_config(
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700205 name = "config_laptop",
206 src = "y2020_laptop.json",
207 flatbuffers = [
208 "//aos/network:message_bridge_client_fbs",
209 "//aos/network:message_bridge_server_fbs",
210 "//aos/network:timestamp_fbs",
211 "//y2020/vision/sift:sift_fbs",
212 "//y2020/vision/sift:sift_training_fbs",
213 "//y2020/vision:vision_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800214 "//aos/network:remote_message_fbs",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700215 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800216 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700217 visibility = ["//visibility:public"],
218 deps = [
219 "//aos/events:config",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700220 "//frc971/control_loops/drivetrain:config",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700221 "//frc971/input:config",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700222 ],
223)
224
225aos_config(
Austin Schuhce3a1912020-03-15 15:14:19 -0700226 name = "config_roborio",
227 src = "y2020_roborio.json",
228 flatbuffers = [
229 ":setpoint_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800230 "//aos/network:remote_message_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700231 "//aos/network:message_bridge_client_fbs",
232 "//aos/network:message_bridge_server_fbs",
233 "//aos/network:timestamp_fbs",
milind-u4b31c4d2021-09-18 16:08:23 -0700234 "//y2020/control_loops/superstructure/shooter:shooter_tuning_readings_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700235 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
236 "//y2019/control_loops/drivetrain:target_selector_fbs",
James Kuszmaul5ff8a862021-09-25 17:29:43 -0700237 "//y2020/control_loops/drivetrain:localizer_debug_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700238 "//y2020/control_loops/superstructure:superstructure_output_fbs",
239 "//y2020/control_loops/superstructure:superstructure_position_fbs",
240 "//y2020/control_loops/superstructure:superstructure_status_fbs",
241 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800242 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhce3a1912020-03-15 15:14:19 -0700243 deps = [
244 "//aos/events:config",
Stephan Massaltd021f972020-01-05 20:41:23 -0800245 "//frc971/autonomous:config",
246 "//frc971/control_loops/drivetrain:config",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700247 "//frc971/input:config",
Stephan Massaltd021f972020-01-05 20:41:23 -0800248 "//frc971/wpilib:config",
249 ],
250)
251
252py_library(
253 name = "python_init",
254 srcs = ["__init__.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800255 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800256 visibility = ["//visibility:public"],
257)
Alex Perry5f474f22020-02-01 12:14:24 -0800258
259sh_binary(
James Kuszmaul5e6aa252021-08-28 22:19:29 -0700260 name = "log_web_proxy",
261 srcs = ["log_web_proxy.sh"],
262 data = [
263 ":config",
264 "//aos/network:log_web_proxy_main",
265 "//y2020/www:camera_main_bundle.min.js",
266 "//y2020/www:field_main_bundle.min.js",
267 "//y2020/www:files",
268 ],
269 target_compatible_with = ["@platforms//os:linux"],
270)
271
272sh_binary(
Alex Perry5f474f22020-02-01 12:14:24 -0800273 name = "web_proxy",
274 srcs = ["web_proxy.sh"],
275 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700276 ":config",
Alex Perry5f474f22020-02-01 12:14:24 -0800277 "//aos/network:web_proxy_main",
Austin Schuhda9d0602019-09-15 17:29:38 -0700278 "//y2020/www:camera_main_bundle.min.js",
279 "//y2020/www:field_main_bundle.min.js",
Alex Perry5f474f22020-02-01 12:14:24 -0800280 "//y2020/www:files",
Alex Perry5f474f22020-02-01 12:14:24 -0800281 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800282 target_compatible_with = ["@platforms//os:linux"],
Alex Perry5f474f22020-02-01 12:14:24 -0800283)
Austin Schuhd58b2902020-03-01 19:28:04 -0800284
285load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
286
287flatbuffer_cc_library(
288 name = "setpoint_fbs",
289 srcs = [
290 "setpoint.fbs",
291 ],
292 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -0800293 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhd58b2902020-03-01 19:28:04 -0800294)
295
296cc_binary(
297 name = "setpoint_setter",
298 srcs = ["setpoint_setter.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800299 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhd58b2902020-03-01 19:28:04 -0800300 deps = [
301 ":setpoint_fbs",
302 "//aos:init",
303 "//aos/events:shm_event_loop",
304 ],
305)
James Kuszmaul55d9fc72020-05-10 18:58:08 -0700306
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700307[
308 jinja2_template(
309 name = "y2020_pi" + str(num) + ".json",
310 src = "y2020_pi_template.json",
311 parameters = {"NUM": str(num)},
Philipp Schraderdada1072020-11-24 11:34:46 -0800312 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700313 )
James Kuszmaul9c128122021-03-22 22:24:36 -0700314 for num in range(1, 6)
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700315]