blob: 024b6ac28adca19ef9c6ff6dc88ce27c38df7e5a [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 = [
15 "//y2020/actors:splines"
16 ],
Stephan Massaltd021f972020-01-05 20:41:23 -080017 start_binaries = [
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080018 "//aos/events/logging:logger_main",
Stephan Massaltd021f972020-01-05 20:41:23 -080019 ":joystick_reader",
20 ":wpilib_interface",
Austin Schuh6aa77be2020-02-22 21:06:40 -080021 "//aos/network:message_bridge_client",
22 "//aos/network:message_bridge_server",
23 "//y2020/actors:binaries",
Stephan Massaltd021f972020-01-05 20:41:23 -080024 "//y2020/control_loops/drivetrain:drivetrain",
25 "//y2020/control_loops/superstructure:superstructure",
Stephan Massaltd021f972020-01-05 20:41:23 -080026 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080027 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -080028)
29
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080030robot_downloader(
31 name = "pi_download",
Jim Ostrowskibaa43692020-03-08 16:25:10 -070032 binaries = [
33 "//y2020/vision:viewer",
34 ],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080035 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -070036 ":config",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080037 ],
38 dirs = [
39 "//y2020/www:www_files",
40 ],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080041 start_binaries = [
42 "//aos/network:message_bridge_client",
43 "//aos/network:message_bridge_server",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080044 "//aos/network:web_proxy_main",
Austin Schuh393015b2020-04-20 17:24:39 -070045 "//y2020/vision:camera_reader",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080046 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080047 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080048 target_type = "pi",
49)
50
Stephan Massaltd021f972020-01-05 20:41:23 -080051cc_library(
52 name = "constants",
53 srcs = [
54 "constants.cc",
55 ],
56 hdrs = [
57 "constants.h",
58 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080059 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -080060 visibility = ["//visibility:public"],
61 deps = [
62 "//aos/logging",
Stephan Massaltd021f972020-01-05 20:41:23 -080063 "//aos/network:team_number",
Brian Silverman1463c092020-10-30 17:28:24 -070064 "//aos/stl_mutex",
Stephan Massaltd021f972020-01-05 20:41:23 -080065 "//frc971:constants",
Stephan Massaltd021f972020-01-05 20:41:23 -080066 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
67 "//y2020/control_loops/drivetrain:polydrivetrain_plants",
Austin Schuh9dcd5202020-02-20 20:06:04 -080068 "//y2020/control_loops/superstructure/accelerator:accelerator_plants",
69 "//y2020/control_loops/superstructure/control_panel:control_panel_plants",
70 "//y2020/control_loops/superstructure/finisher:finisher_plants",
Sabina Davisa587fbd2020-01-31 22:11:15 -080071 "//y2020/control_loops/superstructure/hood:hood_plants",
Sabina Davise8d38992020-02-02 15:00:31 -080072 "//y2020/control_loops/superstructure/intake:intake_plants",
Kai Tinkess10943cf2020-02-01 15:49:57 -080073 "//y2020/control_loops/superstructure/turret:turret_plants",
Stephan Massaltd021f972020-01-05 20:41:23 -080074 "@com_google_absl//absl/base",
75 ],
76)
77
78cc_binary(
79 name = "wpilib_interface",
80 srcs = [
81 "wpilib_interface.cc",
82 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080083 target_compatible_with = ["//tools/platforms/hardware:roborio"],
Stephan Massaltd021f972020-01-05 20:41:23 -080084 deps = [
85 ":constants",
86 "//aos:init",
87 "//aos:make_unique",
88 "//aos:math",
89 "//aos/controls:control_loop",
90 "//aos/events:shm_event_loop",
91 "//aos/logging",
92 "//aos/robot_state:robot_state_fbs",
93 "//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",
99 "//frc971/control_loops:control_loops_fbs",
100 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
James Kuszmaula244a912020-01-18 13:50:50 -0800101 "//frc971/wpilib:ADIS16470",
Stephan Massaltd021f972020-01-05 20:41:23 -0800102 "//frc971/wpilib:buffered_pcm",
103 "//frc971/wpilib:drivetrain_writer",
104 "//frc971/wpilib:encoder_and_potentiometer",
105 "//frc971/wpilib:interrupt_edge_counting",
106 "//frc971/wpilib:joystick_sender",
107 "//frc971/wpilib:logging_fbs",
108 "//frc971/wpilib:loop_output_handler",
109 "//frc971/wpilib:pdp_fetcher",
110 "//frc971/wpilib:sensor_reader",
111 "//frc971/wpilib:wpilib_interface",
112 "//frc971/wpilib:wpilib_robot_base",
Alex Perryc4691f52020-02-17 19:20:01 -0800113 "//third_party:phoenix",
Stephan Massaltd021f972020-01-05 20:41:23 -0800114 "//third_party:wpilib",
115 "//y2020/control_loops/superstructure:superstructure_output_fbs",
116 "//y2020/control_loops/superstructure:superstructure_position_fbs",
117 ],
118)
119
120cc_binary(
121 name = "joystick_reader",
122 srcs = [
123 ":joystick_reader.cc",
124 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800125 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800126 deps = [
Austin Schuhd58b2902020-03-01 19:28:04 -0800127 ":setpoint_fbs",
Stephan Massaltd021f972020-01-05 20:41:23 -0800128 "//aos:init",
129 "//aos/actions:action_lib",
130 "//aos/input:action_joystick_input",
131 "//aos/input:drivetrain_input",
132 "//aos/input:joystick_input",
133 "//aos/logging",
134 "//frc971/autonomous:auto_fbs",
135 "//frc971/autonomous:base_autonomous_actor",
136 "//frc971/control_loops:profiled_subsystem_fbs",
Sabina Davisa8fed3d2020-02-22 21:44:57 -0800137 "//y2020:constants",
Stephan Massaltd021f972020-01-05 20:41:23 -0800138 "//y2020/control_loops/drivetrain:drivetrain_base",
139 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
140 "//y2020/control_loops/superstructure:superstructure_status_fbs",
141 ],
142)
143
144aos_config(
145 name = "config",
146 src = "y2020.json",
Philipp Schraderdada1072020-11-24 11:34:46 -0800147 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800148 visibility = ["//visibility:public"],
149 deps = [
Austin Schuh196a4452020-03-15 23:12:03 -0700150 ":config_laptop",
Austin Schuhce3a1912020-03-15 15:14:19 -0700151 ":config_pi1",
152 ":config_pi2",
153 ":config_pi3",
Austin Schuh196a4452020-03-15 23:12:03 -0700154 ":config_pi4",
James Kuszmaul9c128122021-03-22 22:24:36 -0700155 ":config_pi5",
Austin Schuhce3a1912020-03-15 15:14:19 -0700156 ":config_roborio",
157 ],
milind upadhyay96016ca2021-02-20 15:28:50 -0800158 flatbuffers = [
159 "//aos/network:message_bridge_client_fbs",
160 "//aos/network:message_bridge_server_fbs",
161 "//aos/network:timestamp_fbs",
162 "//y2020/vision/sift:sift_fbs",
163 "//y2020/vision/sift:sift_training_fbs",
164 "//y2020/vision:vision_fbs",
165 ]
Austin Schuhce3a1912020-03-15 15:14:19 -0700166)
167
168[
169 aos_config(
170 name = "config_" + pi,
171 src = "y2020_" + pi + ".json",
172 flatbuffers = [
173 "//aos/network:message_bridge_client_fbs",
174 "//aos/network:message_bridge_server_fbs",
175 "//aos/network:timestamp_fbs",
176 "//y2020/vision/sift:sift_fbs",
177 "//y2020/vision/sift:sift_training_fbs",
178 "//y2020/vision:vision_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800179 "//aos/network:remote_message_fbs",
milind upadhyay96016ca2021-02-20 15:28:50 -0800180 "//y2020/vision:galactic_search_path_fbs"
Austin Schuhce3a1912020-03-15 15:14:19 -0700181 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800182 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhce3a1912020-03-15 15:14:19 -0700183 visibility = ["//visibility:public"],
184 deps = [
185 "//aos/events:config",
Austin Schuh196a4452020-03-15 23:12:03 -0700186 "//aos/robot_state:config",
Austin Schuhac17fba2020-03-28 15:55:33 -0700187 "//frc971/control_loops/drivetrain:config",
Austin Schuhce3a1912020-03-15 15:14:19 -0700188 ],
189 )
190 for pi in [
191 "pi1",
192 "pi2",
193 "pi3",
Austin Schuh196a4452020-03-15 23:12:03 -0700194 "pi4",
James Kuszmaul9c128122021-03-22 22:24:36 -0700195 "pi5",
Austin Schuhce3a1912020-03-15 15:14:19 -0700196 ]
197]
198
199aos_config(
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700200 name = "config_laptop",
201 src = "y2020_laptop.json",
202 flatbuffers = [
203 "//aos/network:message_bridge_client_fbs",
204 "//aos/network:message_bridge_server_fbs",
205 "//aos/network:timestamp_fbs",
206 "//y2020/vision/sift:sift_fbs",
207 "//y2020/vision/sift:sift_training_fbs",
208 "//y2020/vision:vision_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800209 "//aos/network:remote_message_fbs",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700210 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800211 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700212 visibility = ["//visibility:public"],
213 deps = [
214 "//aos/events:config",
215 "//aos/robot_state:config",
216 "//frc971/control_loops/drivetrain:config",
217 ],
218)
219
220aos_config(
Austin Schuhce3a1912020-03-15 15:14:19 -0700221 name = "config_roborio",
222 src = "y2020_roborio.json",
223 flatbuffers = [
224 ":setpoint_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800225 "//aos/network:remote_message_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700226 "//aos/network:message_bridge_client_fbs",
227 "//aos/network:message_bridge_server_fbs",
228 "//aos/network:timestamp_fbs",
229 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
230 "//y2019/control_loops/drivetrain:target_selector_fbs",
231 "//y2020/control_loops/superstructure:superstructure_output_fbs",
232 "//y2020/control_loops/superstructure:superstructure_position_fbs",
233 "//y2020/control_loops/superstructure:superstructure_status_fbs",
234 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800235 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhce3a1912020-03-15 15:14:19 -0700236 deps = [
237 "//aos/events:config",
Stephan Massaltd021f972020-01-05 20:41:23 -0800238 "//aos/robot_state:config",
239 "//frc971/autonomous:config",
240 "//frc971/control_loops/drivetrain:config",
241 "//frc971/wpilib:config",
242 ],
243)
244
245py_library(
246 name = "python_init",
247 srcs = ["__init__.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800248 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800249 visibility = ["//visibility:public"],
250)
Alex Perry5f474f22020-02-01 12:14:24 -0800251
252sh_binary(
253 name = "web_proxy",
254 srcs = ["web_proxy.sh"],
255 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700256 ":config",
Alex Perry5f474f22020-02-01 12:14:24 -0800257 "//aos/network:web_proxy_main",
Austin Schuhda9d0602019-09-15 17:29:38 -0700258 "//y2020/www:camera_main_bundle.min.js",
259 "//y2020/www:field_main_bundle.min.js",
Alex Perry5f474f22020-02-01 12:14:24 -0800260 "//y2020/www:files",
Alex Perry5f474f22020-02-01 12:14:24 -0800261 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800262 target_compatible_with = ["@platforms//os:linux"],
Alex Perry5f474f22020-02-01 12:14:24 -0800263)
Austin Schuhd58b2902020-03-01 19:28:04 -0800264
265load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
266
267flatbuffer_cc_library(
268 name = "setpoint_fbs",
269 srcs = [
270 "setpoint.fbs",
271 ],
272 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -0800273 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhd58b2902020-03-01 19:28:04 -0800274)
275
276cc_binary(
277 name = "setpoint_setter",
278 srcs = ["setpoint_setter.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800279 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhd58b2902020-03-01 19:28:04 -0800280 deps = [
281 ":setpoint_fbs",
282 "//aos:init",
283 "//aos/events:shm_event_loop",
284 ],
285)
James Kuszmaul55d9fc72020-05-10 18:58:08 -0700286
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700287[
288 jinja2_template(
289 name = "y2020_pi" + str(num) + ".json",
290 src = "y2020_pi_template.json",
291 parameters = {"NUM": str(num)},
Philipp Schraderdada1072020-11-24 11:34:46 -0800292 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700293 )
James Kuszmaul9c128122021-03-22 22:24:36 -0700294 for num in range(1, 6)
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700295]