blob: ab1aa8e24d84e1f4fefc943bb7136dfe755125ad [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",
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 = [
36 "//y2020/vision:viewer",
37 ],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080038 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -070039 ":config",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080040 ],
41 dirs = [
42 "//y2020/www:www_files",
43 ],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080044 start_binaries = [
45 "//aos/network:message_bridge_client",
46 "//aos/network:message_bridge_server",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080047 "//aos/network:web_proxy_main",
Austin Schuh393015b2020-04-20 17:24:39 -070048 "//y2020/vision:camera_reader",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080049 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080050 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080051 target_type = "pi",
52)
53
Stephan Massaltd021f972020-01-05 20:41:23 -080054cc_library(
55 name = "constants",
56 srcs = [
57 "constants.cc",
58 ],
59 hdrs = [
60 "constants.h",
61 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080062 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -080063 visibility = ["//visibility:public"],
64 deps = [
65 "//aos/logging",
Stephan Massaltd021f972020-01-05 20:41:23 -080066 "//aos/network:team_number",
Brian Silverman1463c092020-10-30 17:28:24 -070067 "//aos/stl_mutex",
Stephan Massaltd021f972020-01-05 20:41:23 -080068 "//frc971:constants",
Stephan Massaltd021f972020-01-05 20:41:23 -080069 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
James Kuszmaul98154a22021-04-03 16:09:29 -070070 "//frc971/shooter_interpolation:interpolation",
Stephan Massaltd021f972020-01-05 20:41:23 -080071 "//y2020/control_loops/drivetrain:polydrivetrain_plants",
Austin Schuh9dcd5202020-02-20 20:06:04 -080072 "//y2020/control_loops/superstructure/accelerator:accelerator_plants",
73 "//y2020/control_loops/superstructure/control_panel:control_panel_plants",
74 "//y2020/control_loops/superstructure/finisher:finisher_plants",
Sabina Davisa587fbd2020-01-31 22:11:15 -080075 "//y2020/control_loops/superstructure/hood:hood_plants",
Sabina Davise8d38992020-02-02 15:00:31 -080076 "//y2020/control_loops/superstructure/intake:intake_plants",
Kai Tinkess10943cf2020-02-01 15:49:57 -080077 "//y2020/control_loops/superstructure/turret:turret_plants",
Stephan Massaltd021f972020-01-05 20:41:23 -080078 "@com_google_absl//absl/base",
79 ],
80)
81
82cc_binary(
83 name = "wpilib_interface",
84 srcs = [
85 "wpilib_interface.cc",
86 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080087 target_compatible_with = ["//tools/platforms/hardware:roborio"],
Stephan Massaltd021f972020-01-05 20:41:23 -080088 deps = [
89 ":constants",
90 "//aos:init",
Stephan Massaltd021f972020-01-05 20:41:23 -080091 "//aos:math",
Stephan Massaltd021f972020-01-05 20:41:23 -080092 "//aos/events:shm_event_loop",
93 "//aos/logging",
Stephan Massaltd021f972020-01-05 20:41:23 -080094 "//aos/stl_mutex",
95 "//aos/time",
96 "//aos/util:log_interval",
97 "//aos/util:phased_loop",
98 "//aos/util:wrapping_counter",
99 "//frc971/autonomous:auto_mode_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700100 "//frc971/control_loops:control_loop",
Stephan Massaltd021f972020-01-05 20:41:23 -0800101 "//frc971/control_loops:control_loops_fbs",
102 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700103 "//frc971/input:robot_state_fbs",
James Kuszmaula244a912020-01-18 13:50:50 -0800104 "//frc971/wpilib:ADIS16470",
Stephan Massaltd021f972020-01-05 20:41:23 -0800105 "//frc971/wpilib:buffered_pcm",
106 "//frc971/wpilib:drivetrain_writer",
107 "//frc971/wpilib:encoder_and_potentiometer",
108 "//frc971/wpilib:interrupt_edge_counting",
109 "//frc971/wpilib:joystick_sender",
110 "//frc971/wpilib:logging_fbs",
111 "//frc971/wpilib:loop_output_handler",
112 "//frc971/wpilib:pdp_fetcher",
113 "//frc971/wpilib:sensor_reader",
114 "//frc971/wpilib:wpilib_interface",
115 "//frc971/wpilib:wpilib_robot_base",
Alex Perryc4691f52020-02-17 19:20:01 -0800116 "//third_party:phoenix",
Stephan Massaltd021f972020-01-05 20:41:23 -0800117 "//third_party:wpilib",
118 "//y2020/control_loops/superstructure:superstructure_output_fbs",
119 "//y2020/control_loops/superstructure:superstructure_position_fbs",
120 ],
121)
122
123cc_binary(
124 name = "joystick_reader",
125 srcs = [
126 ":joystick_reader.cc",
127 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800128 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800129 deps = [
Austin Schuhd58b2902020-03-01 19:28:04 -0800130 ":setpoint_fbs",
Stephan Massaltd021f972020-01-05 20:41:23 -0800131 "//aos:init",
132 "//aos/actions:action_lib",
Stephan Massaltd021f972020-01-05 20:41:23 -0800133 "//aos/logging",
134 "//frc971/autonomous:auto_fbs",
135 "//frc971/autonomous:base_autonomous_actor",
136 "//frc971/control_loops:profiled_subsystem_fbs",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700137 "//frc971/input:action_joystick_input",
138 "//frc971/input:drivetrain_input",
139 "//frc971/input:joystick_input",
Sabina Davisa8fed3d2020-02-22 21:44:57 -0800140 "//y2020:constants",
Stephan Massaltd021f972020-01-05 20:41:23 -0800141 "//y2020/control_loops/drivetrain:drivetrain_base",
142 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
143 "//y2020/control_loops/superstructure:superstructure_status_fbs",
144 ],
145)
146
147aos_config(
148 name = "config",
149 src = "y2020.json",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700150 flatbuffers = [
151 "//aos/network:message_bridge_client_fbs",
152 "//aos/network:message_bridge_server_fbs",
153 "//aos/network:timestamp_fbs",
154 "//y2020/vision/sift:sift_fbs",
155 "//y2020/vision/sift:sift_training_fbs",
156 "//y2020/vision:vision_fbs",
157 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800158 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800159 visibility = ["//visibility:public"],
160 deps = [
Austin Schuh196a4452020-03-15 23:12:03 -0700161 ":config_laptop",
Austin Schuhce3a1912020-03-15 15:14:19 -0700162 ":config_pi1",
163 ":config_pi2",
164 ":config_pi3",
Austin Schuh196a4452020-03-15 23:12:03 -0700165 ":config_pi4",
James Kuszmaul9c128122021-03-22 22:24:36 -0700166 ":config_pi5",
Austin Schuhce3a1912020-03-15 15:14:19 -0700167 ":config_roborio",
168 ],
169)
170
171[
172 aos_config(
173 name = "config_" + pi,
174 src = "y2020_" + pi + ".json",
175 flatbuffers = [
176 "//aos/network:message_bridge_client_fbs",
177 "//aos/network:message_bridge_server_fbs",
178 "//aos/network:timestamp_fbs",
179 "//y2020/vision/sift:sift_fbs",
180 "//y2020/vision/sift:sift_training_fbs",
181 "//y2020/vision:vision_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800182 "//aos/network:remote_message_fbs",
Austin Schuhc61e9c02021-04-26 12:10:40 -0700183 "//y2020/vision:galactic_search_path_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700184 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800185 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhce3a1912020-03-15 15:14:19 -0700186 visibility = ["//visibility:public"],
187 deps = [
188 "//aos/events:config",
Austin Schuhac17fba2020-03-28 15:55:33 -0700189 "//frc971/control_loops/drivetrain:config",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700190 "//frc971/input:config",
Austin Schuhce3a1912020-03-15 15:14:19 -0700191 ],
192 )
193 for pi in [
194 "pi1",
195 "pi2",
196 "pi3",
Austin Schuh196a4452020-03-15 23:12:03 -0700197 "pi4",
James Kuszmaul9c128122021-03-22 22:24:36 -0700198 "pi5",
Austin Schuhce3a1912020-03-15 15:14:19 -0700199 ]
200]
201
202aos_config(
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700203 name = "config_laptop",
204 src = "y2020_laptop.json",
205 flatbuffers = [
206 "//aos/network:message_bridge_client_fbs",
207 "//aos/network:message_bridge_server_fbs",
208 "//aos/network:timestamp_fbs",
209 "//y2020/vision/sift:sift_fbs",
210 "//y2020/vision/sift:sift_training_fbs",
211 "//y2020/vision:vision_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800212 "//aos/network:remote_message_fbs",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700213 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800214 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700215 visibility = ["//visibility:public"],
216 deps = [
217 "//aos/events:config",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700218 "//frc971/control_loops/drivetrain:config",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700219 "//frc971/input:config",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700220 ],
221)
222
223aos_config(
Austin Schuhce3a1912020-03-15 15:14:19 -0700224 name = "config_roborio",
225 src = "y2020_roborio.json",
226 flatbuffers = [
227 ":setpoint_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800228 "//aos/network:remote_message_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700229 "//aos/network:message_bridge_client_fbs",
230 "//aos/network:message_bridge_server_fbs",
231 "//aos/network:timestamp_fbs",
232 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
233 "//y2019/control_loops/drivetrain:target_selector_fbs",
234 "//y2020/control_loops/superstructure:superstructure_output_fbs",
235 "//y2020/control_loops/superstructure:superstructure_position_fbs",
236 "//y2020/control_loops/superstructure:superstructure_status_fbs",
237 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800238 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhce3a1912020-03-15 15:14:19 -0700239 deps = [
240 "//aos/events:config",
Stephan Massaltd021f972020-01-05 20:41:23 -0800241 "//frc971/autonomous:config",
242 "//frc971/control_loops/drivetrain:config",
Austin Schuh0a3c9d42021-07-15 22:36:24 -0700243 "//frc971/input:config",
Stephan Massaltd021f972020-01-05 20:41:23 -0800244 "//frc971/wpilib:config",
245 ],
246)
247
248py_library(
249 name = "python_init",
250 srcs = ["__init__.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800251 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800252 visibility = ["//visibility:public"],
253)
Alex Perry5f474f22020-02-01 12:14:24 -0800254
255sh_binary(
256 name = "web_proxy",
257 srcs = ["web_proxy.sh"],
258 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700259 ":config",
Alex Perry5f474f22020-02-01 12:14:24 -0800260 "//aos/network:web_proxy_main",
Austin Schuhda9d0602019-09-15 17:29:38 -0700261 "//y2020/www:camera_main_bundle.min.js",
262 "//y2020/www:field_main_bundle.min.js",
Alex Perry5f474f22020-02-01 12:14:24 -0800263 "//y2020/www:files",
Alex Perry5f474f22020-02-01 12:14:24 -0800264 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800265 target_compatible_with = ["@platforms//os:linux"],
Alex Perry5f474f22020-02-01 12:14:24 -0800266)
Austin Schuhd58b2902020-03-01 19:28:04 -0800267
268load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
269
270flatbuffer_cc_library(
271 name = "setpoint_fbs",
272 srcs = [
273 "setpoint.fbs",
274 ],
275 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -0800276 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhd58b2902020-03-01 19:28:04 -0800277)
278
279cc_binary(
280 name = "setpoint_setter",
281 srcs = ["setpoint_setter.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800282 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhd58b2902020-03-01 19:28:04 -0800283 deps = [
284 ":setpoint_fbs",
285 "//aos:init",
286 "//aos/events:shm_event_loop",
287 ],
288)
James Kuszmaul55d9fc72020-05-10 18:58:08 -0700289
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700290[
291 jinja2_template(
292 name = "y2020_pi" + str(num) + ".json",
293 src = "y2020_pi_template.json",
294 parameters = {"NUM": str(num)},
Philipp Schraderdada1072020-11-24 11:34:46 -0800295 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700296 )
James Kuszmaul9c128122021-03-22 22:24:36 -0700297 for num in range(1, 6)
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700298]