blob: a67ac0fb9cc6ca0d6d4508f4aa0b678a9c6916c5 [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",
10 ],
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",
Ravago Jonesc2a08022021-02-06 17:40:54 -080016 ],
Stephan Massaltd021f972020-01-05 20:41:23 -080017 start_binaries = [
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080018 "//aos/events/logging:logger_main",
James Kuszmaul5e6aa252021-08-28 22:19:29 -070019 "//aos/network:web_proxy_main",
Stephan Massaltd021f972020-01-05 20:41:23 -080020 ":joystick_reader",
21 ":wpilib_interface",
Austin Schuh6aa77be2020-02-22 21:06:40 -080022 "//aos/network:message_bridge_client",
23 "//aos/network:message_bridge_server",
24 "//y2020/actors:binaries",
Stephan Massaltd021f972020-01-05 20:41:23 -080025 "//y2020/control_loops/drivetrain:drivetrain",
James Kuszmaul75a18c52021-03-10 22:02:07 -080026 "//y2020/control_loops/drivetrain:trajectory_generator",
Stephan Massaltd021f972020-01-05 20:41:23 -080027 "//y2020/control_loops/superstructure:superstructure",
Stephan Massaltd021f972020-01-05 20:41:23 -080028 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080029 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -080030)
31
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080032robot_downloader(
33 name = "pi_download",
Jim Ostrowskibaa43692020-03-08 16:25:10 -070034 binaries = [
35 "//y2020/vision:viewer",
36 ],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080037 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -070038 ":config",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080039 ],
40 dirs = [
41 "//y2020/www:www_files",
42 ],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080043 start_binaries = [
44 "//aos/network:message_bridge_client",
45 "//aos/network:message_bridge_server",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080046 "//aos/network:web_proxy_main",
Austin Schuh393015b2020-04-20 17:24:39 -070047 "//y2020/vision:camera_reader",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080048 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080049 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080050 target_type = "pi",
51)
52
Stephan Massaltd021f972020-01-05 20:41:23 -080053cc_library(
54 name = "constants",
55 srcs = [
56 "constants.cc",
57 ],
58 hdrs = [
59 "constants.h",
60 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080061 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -080062 visibility = ["//visibility:public"],
63 deps = [
64 "//aos/logging",
Stephan Massaltd021f972020-01-05 20:41:23 -080065 "//aos/network:team_number",
Brian Silverman1463c092020-10-30 17:28:24 -070066 "//aos/stl_mutex",
Stephan Massaltd021f972020-01-05 20:41:23 -080067 "//frc971:constants",
Stephan Massaltd021f972020-01-05 20:41:23 -080068 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
James Kuszmaul98154a22021-04-03 16:09:29 -070069 "//frc971/shooter_interpolation:interpolation",
Stephan Massaltd021f972020-01-05 20:41:23 -080070 "//y2020/control_loops/drivetrain:polydrivetrain_plants",
Austin Schuh9dcd5202020-02-20 20:06:04 -080071 "//y2020/control_loops/superstructure/accelerator:accelerator_plants",
72 "//y2020/control_loops/superstructure/control_panel:control_panel_plants",
73 "//y2020/control_loops/superstructure/finisher:finisher_plants",
Sabina Davisa587fbd2020-01-31 22:11:15 -080074 "//y2020/control_loops/superstructure/hood:hood_plants",
Sabina Davise8d38992020-02-02 15:00:31 -080075 "//y2020/control_loops/superstructure/intake:intake_plants",
Kai Tinkess10943cf2020-02-01 15:49:57 -080076 "//y2020/control_loops/superstructure/turret:turret_plants",
Stephan Massaltd021f972020-01-05 20:41:23 -080077 "@com_google_absl//absl/base",
78 ],
79)
80
81cc_binary(
82 name = "wpilib_interface",
83 srcs = [
84 "wpilib_interface.cc",
85 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080086 target_compatible_with = ["//tools/platforms/hardware:roborio"],
Stephan Massaltd021f972020-01-05 20:41:23 -080087 deps = [
88 ":constants",
89 "//aos:init",
Stephan Massaltd021f972020-01-05 20:41:23 -080090 "//aos:math",
Stephan Massaltd021f972020-01-05 20:41:23 -080091 "//aos/events:shm_event_loop",
92 "//aos/logging",
Stephan Massaltd021f972020-01-05 20:41:23 -080093 "//aos/stl_mutex",
94 "//aos/time",
95 "//aos/util:log_interval",
96 "//aos/util:phased_loop",
97 "//aos/util:wrapping_counter",
98 "//frc971/autonomous:auto_mode_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -070099 "//frc971/control_loops:control_loop",
Stephan Massaltd021f972020-01-05 20:41:23 -0800100 "//frc971/control_loops:control_loops_fbs",
101 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700102 "//frc971/input:robot_state_fbs",
James Kuszmaula244a912020-01-18 13:50:50 -0800103 "//frc971/wpilib:ADIS16470",
Stephan Massaltd021f972020-01-05 20:41:23 -0800104 "//frc971/wpilib:buffered_pcm",
105 "//frc971/wpilib:drivetrain_writer",
106 "//frc971/wpilib:encoder_and_potentiometer",
107 "//frc971/wpilib:interrupt_edge_counting",
108 "//frc971/wpilib:joystick_sender",
109 "//frc971/wpilib:logging_fbs",
110 "//frc971/wpilib:loop_output_handler",
111 "//frc971/wpilib:pdp_fetcher",
112 "//frc971/wpilib:sensor_reader",
113 "//frc971/wpilib:wpilib_interface",
114 "//frc971/wpilib:wpilib_robot_base",
Alex Perryc4691f52020-02-17 19:20:01 -0800115 "//third_party:phoenix",
Stephan Massaltd021f972020-01-05 20:41:23 -0800116 "//third_party:wpilib",
117 "//y2020/control_loops/superstructure:superstructure_output_fbs",
118 "//y2020/control_loops/superstructure:superstructure_position_fbs",
119 ],
120)
121
122cc_binary(
123 name = "joystick_reader",
124 srcs = [
125 ":joystick_reader.cc",
126 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800127 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800128 deps = [
Austin Schuhd58b2902020-03-01 19:28:04 -0800129 ":setpoint_fbs",
Stephan Massaltd021f972020-01-05 20:41:23 -0800130 "//aos:init",
131 "//aos/actions:action_lib",
Stephan Massaltd021f972020-01-05 20:41:23 -0800132 "//aos/logging",
133 "//frc971/autonomous:auto_fbs",
134 "//frc971/autonomous:base_autonomous_actor",
135 "//frc971/control_loops:profiled_subsystem_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700136 "//frc971/input:action_joystick_input",
137 "//frc971/input:drivetrain_input",
138 "//frc971/input:joystick_input",
Sabina Davisa8fed3d2020-02-22 21:44:57 -0800139 "//y2020:constants",
Stephan Massaltd021f972020-01-05 20:41:23 -0800140 "//y2020/control_loops/drivetrain:drivetrain_base",
141 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
142 "//y2020/control_loops/superstructure:superstructure_status_fbs",
143 ],
144)
145
146aos_config(
147 name = "config",
148 src = "y2020.json",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700149 flatbuffers = [
150 "//aos/network:message_bridge_client_fbs",
151 "//aos/network:message_bridge_server_fbs",
152 "//aos/network:timestamp_fbs",
153 "//y2020/vision/sift:sift_fbs",
154 "//y2020/vision/sift:sift_training_fbs",
155 "//y2020/vision:vision_fbs",
156 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800157 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800158 visibility = ["//visibility:public"],
159 deps = [
Austin Schuh196a4452020-03-15 23:12:03 -0700160 ":config_laptop",
Austin Schuhce3a1912020-03-15 15:14:19 -0700161 ":config_pi1",
162 ":config_pi2",
163 ":config_pi3",
Austin Schuh196a4452020-03-15 23:12:03 -0700164 ":config_pi4",
James Kuszmaul9c128122021-03-22 22:24:36 -0700165 ":config_pi5",
Austin Schuhce3a1912020-03-15 15:14:19 -0700166 ":config_roborio",
167 ],
168)
169
170[
171 aos_config(
172 name = "config_" + pi,
173 src = "y2020_" + pi + ".json",
174 flatbuffers = [
175 "//aos/network:message_bridge_client_fbs",
176 "//aos/network:message_bridge_server_fbs",
177 "//aos/network:timestamp_fbs",
178 "//y2020/vision/sift:sift_fbs",
179 "//y2020/vision/sift:sift_training_fbs",
180 "//y2020/vision:vision_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800181 "//aos/network:remote_message_fbs",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700182 "//y2020/vision:galactic_search_path_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700183 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800184 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhce3a1912020-03-15 15:14:19 -0700185 visibility = ["//visibility:public"],
186 deps = [
187 "//aos/events:config",
Austin Schuhac17fba2020-03-28 15:55:33 -0700188 "//frc971/control_loops/drivetrain:config",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700189 "//frc971/input:config",
Austin Schuhce3a1912020-03-15 15:14:19 -0700190 ],
191 )
192 for pi in [
193 "pi1",
194 "pi2",
195 "pi3",
Austin Schuh196a4452020-03-15 23:12:03 -0700196 "pi4",
James Kuszmaul9c128122021-03-22 22:24:36 -0700197 "pi5",
Austin Schuhce3a1912020-03-15 15:14:19 -0700198 ]
199]
200
201aos_config(
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700202 name = "config_laptop",
203 src = "y2020_laptop.json",
204 flatbuffers = [
205 "//aos/network:message_bridge_client_fbs",
206 "//aos/network:message_bridge_server_fbs",
207 "//aos/network:timestamp_fbs",
208 "//y2020/vision/sift:sift_fbs",
209 "//y2020/vision/sift:sift_training_fbs",
210 "//y2020/vision:vision_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800211 "//aos/network:remote_message_fbs",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700212 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800213 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700214 visibility = ["//visibility:public"],
215 deps = [
216 "//aos/events:config",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700217 "//frc971/control_loops/drivetrain:config",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700218 "//frc971/input:config",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700219 ],
220)
221
222aos_config(
Austin Schuhce3a1912020-03-15 15:14:19 -0700223 name = "config_roborio",
224 src = "y2020_roborio.json",
225 flatbuffers = [
226 ":setpoint_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800227 "//aos/network:remote_message_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700228 "//aos/network:message_bridge_client_fbs",
229 "//aos/network:message_bridge_server_fbs",
230 "//aos/network:timestamp_fbs",
231 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
232 "//y2019/control_loops/drivetrain:target_selector_fbs",
233 "//y2020/control_loops/superstructure:superstructure_output_fbs",
234 "//y2020/control_loops/superstructure:superstructure_position_fbs",
235 "//y2020/control_loops/superstructure:superstructure_status_fbs",
236 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800237 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhce3a1912020-03-15 15:14:19 -0700238 deps = [
239 "//aos/events:config",
Stephan Massaltd021f972020-01-05 20:41:23 -0800240 "//frc971/autonomous:config",
241 "//frc971/control_loops/drivetrain:config",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700242 "//frc971/input:config",
Stephan Massaltd021f972020-01-05 20:41:23 -0800243 "//frc971/wpilib:config",
244 ],
245)
246
247py_library(
248 name = "python_init",
249 srcs = ["__init__.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800250 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800251 visibility = ["//visibility:public"],
252)
Alex Perry5f474f22020-02-01 12:14:24 -0800253
254sh_binary(
James Kuszmaul5e6aa252021-08-28 22:19:29 -0700255 name = "log_web_proxy",
256 srcs = ["log_web_proxy.sh"],
257 data = [
258 ":config",
259 "//aos/network:log_web_proxy_main",
260 "//y2020/www:camera_main_bundle.min.js",
261 "//y2020/www:field_main_bundle.min.js",
262 "//y2020/www:files",
263 ],
264 target_compatible_with = ["@platforms//os:linux"],
265)
266
267sh_binary(
Alex Perry5f474f22020-02-01 12:14:24 -0800268 name = "web_proxy",
269 srcs = ["web_proxy.sh"],
270 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700271 ":config",
Alex Perry5f474f22020-02-01 12:14:24 -0800272 "//aos/network:web_proxy_main",
Austin Schuhda9d0602019-09-15 17:29:38 -0700273 "//y2020/www:camera_main_bundle.min.js",
274 "//y2020/www:field_main_bundle.min.js",
Alex Perry5f474f22020-02-01 12:14:24 -0800275 "//y2020/www:files",
Alex Perry5f474f22020-02-01 12:14:24 -0800276 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800277 target_compatible_with = ["@platforms//os:linux"],
Alex Perry5f474f22020-02-01 12:14:24 -0800278)
Austin Schuhd58b2902020-03-01 19:28:04 -0800279
280load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
281
282flatbuffer_cc_library(
283 name = "setpoint_fbs",
284 srcs = [
285 "setpoint.fbs",
286 ],
287 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -0800288 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhd58b2902020-03-01 19:28:04 -0800289)
290
291cc_binary(
292 name = "setpoint_setter",
293 srcs = ["setpoint_setter.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800294 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhd58b2902020-03-01 19:28:04 -0800295 deps = [
296 ":setpoint_fbs",
297 "//aos:init",
298 "//aos/events:shm_event_loop",
299 ],
300)
James Kuszmaul55d9fc72020-05-10 18:58:08 -0700301
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700302[
303 jinja2_template(
304 name = "y2020_pi" + str(num) + ".json",
305 src = "y2020_pi_template.json",
306 parameters = {"NUM": str(num)},
Philipp Schraderdada1072020-11-24 11:34:46 -0800307 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700308 )
James Kuszmaul9c128122021-03-22 22:24:36 -0700309 for num in range(1, 6)
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700310]