blob: a7596816d96cccb045b79f16839aa5f0b4cd4b3f [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 ],
14 start_binaries = [
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080015 "//aos/events/logging:logger_main",
Stephan Massaltd021f972020-01-05 20:41:23 -080016 ":joystick_reader",
17 ":wpilib_interface",
Austin Schuh6aa77be2020-02-22 21:06:40 -080018 "//aos/network:message_bridge_client",
19 "//aos/network:message_bridge_server",
20 "//y2020/actors:binaries",
Stephan Massaltd021f972020-01-05 20:41:23 -080021 "//y2020/control_loops/drivetrain:drivetrain",
22 "//y2020/control_loops/superstructure:superstructure",
Stephan Massaltd021f972020-01-05 20:41:23 -080023 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080024 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -080025)
26
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080027robot_downloader(
28 name = "pi_download",
Jim Ostrowskibaa43692020-03-08 16:25:10 -070029 binaries = [
30 "//y2020/vision:viewer",
31 ],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080032 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -070033 ":config",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080034 ],
35 dirs = [
36 "//y2020/www:www_files",
37 ],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080038 start_binaries = [
39 "//aos/network:message_bridge_client",
40 "//aos/network:message_bridge_server",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080041 "//aos/network:web_proxy_main",
Austin Schuh393015b2020-04-20 17:24:39 -070042 "//y2020/vision:camera_reader",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080043 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080044 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080045 target_type = "pi",
46)
47
Stephan Massaltd021f972020-01-05 20:41:23 -080048cc_library(
49 name = "constants",
50 srcs = [
51 "constants.cc",
52 ],
53 hdrs = [
54 "constants.h",
55 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080056 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -080057 visibility = ["//visibility:public"],
58 deps = [
59 "//aos/logging",
Stephan Massaltd021f972020-01-05 20:41:23 -080060 "//aos/network:team_number",
Brian Silverman1463c092020-10-30 17:28:24 -070061 "//aos/stl_mutex",
Stephan Massaltd021f972020-01-05 20:41:23 -080062 "//frc971:constants",
Stephan Massaltd021f972020-01-05 20:41:23 -080063 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
64 "//y2020/control_loops/drivetrain:polydrivetrain_plants",
Austin Schuh9dcd5202020-02-20 20:06:04 -080065 "//y2020/control_loops/superstructure/accelerator:accelerator_plants",
66 "//y2020/control_loops/superstructure/control_panel:control_panel_plants",
67 "//y2020/control_loops/superstructure/finisher:finisher_plants",
Sabina Davisa587fbd2020-01-31 22:11:15 -080068 "//y2020/control_loops/superstructure/hood:hood_plants",
Sabina Davise8d38992020-02-02 15:00:31 -080069 "//y2020/control_loops/superstructure/intake:intake_plants",
Kai Tinkess10943cf2020-02-01 15:49:57 -080070 "//y2020/control_loops/superstructure/turret:turret_plants",
Stephan Massaltd021f972020-01-05 20:41:23 -080071 "@com_google_absl//absl/base",
72 ],
73)
74
75cc_binary(
76 name = "wpilib_interface",
77 srcs = [
78 "wpilib_interface.cc",
79 ],
Philipp Schraderdada1072020-11-24 11:34:46 -080080 target_compatible_with = ["//tools/platforms/hardware:roborio"],
Stephan Massaltd021f972020-01-05 20:41:23 -080081 deps = [
82 ":constants",
83 "//aos:init",
84 "//aos:make_unique",
85 "//aos:math",
86 "//aos/controls:control_loop",
87 "//aos/events:shm_event_loop",
88 "//aos/logging",
89 "//aos/robot_state:robot_state_fbs",
90 "//aos/stl_mutex",
91 "//aos/time",
92 "//aos/util:log_interval",
93 "//aos/util:phased_loop",
94 "//aos/util:wrapping_counter",
95 "//frc971/autonomous:auto_mode_fbs",
96 "//frc971/control_loops:control_loops_fbs",
97 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
James Kuszmaula244a912020-01-18 13:50:50 -080098 "//frc971/wpilib:ADIS16470",
Stephan Massaltd021f972020-01-05 20:41:23 -080099 "//frc971/wpilib:buffered_pcm",
100 "//frc971/wpilib:drivetrain_writer",
101 "//frc971/wpilib:encoder_and_potentiometer",
102 "//frc971/wpilib:interrupt_edge_counting",
103 "//frc971/wpilib:joystick_sender",
104 "//frc971/wpilib:logging_fbs",
105 "//frc971/wpilib:loop_output_handler",
106 "//frc971/wpilib:pdp_fetcher",
107 "//frc971/wpilib:sensor_reader",
108 "//frc971/wpilib:wpilib_interface",
109 "//frc971/wpilib:wpilib_robot_base",
Alex Perryc4691f52020-02-17 19:20:01 -0800110 "//third_party:phoenix",
Stephan Massaltd021f972020-01-05 20:41:23 -0800111 "//third_party:wpilib",
112 "//y2020/control_loops/superstructure:superstructure_output_fbs",
113 "//y2020/control_loops/superstructure:superstructure_position_fbs",
114 ],
115)
116
117cc_binary(
118 name = "joystick_reader",
119 srcs = [
120 ":joystick_reader.cc",
121 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800122 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800123 deps = [
Austin Schuhd58b2902020-03-01 19:28:04 -0800124 ":setpoint_fbs",
Stephan Massaltd021f972020-01-05 20:41:23 -0800125 "//aos:init",
126 "//aos/actions:action_lib",
127 "//aos/input:action_joystick_input",
128 "//aos/input:drivetrain_input",
129 "//aos/input:joystick_input",
130 "//aos/logging",
131 "//frc971/autonomous:auto_fbs",
132 "//frc971/autonomous:base_autonomous_actor",
133 "//frc971/control_loops:profiled_subsystem_fbs",
Sabina Davisa8fed3d2020-02-22 21:44:57 -0800134 "//y2020:constants",
Stephan Massaltd021f972020-01-05 20:41:23 -0800135 "//y2020/control_loops/drivetrain:drivetrain_base",
136 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
137 "//y2020/control_loops/superstructure:superstructure_status_fbs",
138 ],
139)
140
141aos_config(
142 name = "config",
143 src = "y2020.json",
144 flatbuffers = [
Austin Schuh6aa77be2020-02-22 21:06:40 -0800145 "//aos/network:message_bridge_client_fbs",
146 "//aos/network:message_bridge_server_fbs",
147 "//aos/network:timestamp_fbs",
Brian Silverman967e5df2020-02-09 16:43:34 -0800148 "//y2020/vision/sift:sift_fbs",
Brian Silverman62956e72020-02-26 21:04:05 -0800149 "//y2020/vision/sift:sift_training_fbs",
Austin Schuh6aa77be2020-02-22 21:06:40 -0800150 "//y2020/vision:vision_fbs",
Stephan Massaltd021f972020-01-05 20:41:23 -0800151 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800152 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800153 visibility = ["//visibility:public"],
154 deps = [
Austin Schuh196a4452020-03-15 23:12:03 -0700155 ":config_laptop",
Austin Schuhce3a1912020-03-15 15:14:19 -0700156 ":config_pi1",
157 ":config_pi2",
158 ":config_pi3",
Austin Schuh196a4452020-03-15 23:12:03 -0700159 ":config_pi4",
Austin Schuhce3a1912020-03-15 15:14:19 -0700160 ":config_roborio",
161 ],
162)
163
164[
165 aos_config(
166 name = "config_" + pi,
167 src = "y2020_" + pi + ".json",
168 flatbuffers = [
169 "//aos/network:message_bridge_client_fbs",
170 "//aos/network:message_bridge_server_fbs",
171 "//aos/network:timestamp_fbs",
172 "//y2020/vision/sift:sift_fbs",
173 "//y2020/vision/sift:sift_training_fbs",
174 "//y2020/vision:vision_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800175 "//aos/network:remote_message_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700176 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800177 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhce3a1912020-03-15 15:14:19 -0700178 visibility = ["//visibility:public"],
179 deps = [
180 "//aos/events:config",
Austin Schuh196a4452020-03-15 23:12:03 -0700181 "//aos/robot_state:config",
Austin Schuhac17fba2020-03-28 15:55:33 -0700182 "//frc971/control_loops/drivetrain:config",
Austin Schuhce3a1912020-03-15 15:14:19 -0700183 ],
184 )
185 for pi in [
186 "pi1",
187 "pi2",
188 "pi3",
Austin Schuh196a4452020-03-15 23:12:03 -0700189 "pi4",
Austin Schuhce3a1912020-03-15 15:14:19 -0700190 ]
191]
192
193aos_config(
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700194 name = "config_laptop",
195 src = "y2020_laptop.json",
196 flatbuffers = [
197 "//aos/network:message_bridge_client_fbs",
198 "//aos/network:message_bridge_server_fbs",
199 "//aos/network:timestamp_fbs",
200 "//y2020/vision/sift:sift_fbs",
201 "//y2020/vision/sift:sift_training_fbs",
202 "//y2020/vision:vision_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800203 "//aos/network:remote_message_fbs",
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700204 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800205 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700206 visibility = ["//visibility:public"],
207 deps = [
208 "//aos/events:config",
209 "//aos/robot_state:config",
210 "//frc971/control_loops/drivetrain:config",
211 ],
212)
213
214aos_config(
Austin Schuhce3a1912020-03-15 15:14:19 -0700215 name = "config_roborio",
216 src = "y2020_roborio.json",
217 flatbuffers = [
218 ":setpoint_fbs",
Austin Schuh0de30f32020-12-06 12:44:28 -0800219 "//aos/network:remote_message_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700220 "//aos/network:message_bridge_client_fbs",
221 "//aos/network:message_bridge_server_fbs",
222 "//aos/network:timestamp_fbs",
223 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
224 "//y2019/control_loops/drivetrain:target_selector_fbs",
225 "//y2020/control_loops/superstructure:superstructure_output_fbs",
226 "//y2020/control_loops/superstructure:superstructure_position_fbs",
227 "//y2020/control_loops/superstructure:superstructure_status_fbs",
228 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800229 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhce3a1912020-03-15 15:14:19 -0700230 deps = [
231 "//aos/events:config",
Stephan Massaltd021f972020-01-05 20:41:23 -0800232 "//aos/robot_state:config",
233 "//frc971/autonomous:config",
234 "//frc971/control_loops/drivetrain:config",
235 "//frc971/wpilib:config",
236 ],
237)
238
239py_library(
240 name = "python_init",
241 srcs = ["__init__.py"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800242 target_compatible_with = ["@platforms//os:linux"],
Stephan Massaltd021f972020-01-05 20:41:23 -0800243 visibility = ["//visibility:public"],
244)
Alex Perry5f474f22020-02-01 12:14:24 -0800245
246sh_binary(
247 name = "web_proxy",
248 srcs = ["web_proxy.sh"],
249 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700250 ":config",
Alex Perry5f474f22020-02-01 12:14:24 -0800251 "//aos/network:web_proxy_main",
Austin Schuhda9d0602019-09-15 17:29:38 -0700252 "//y2020/www:camera_main_bundle.min.js",
253 "//y2020/www:field_main_bundle.min.js",
Alex Perry5f474f22020-02-01 12:14:24 -0800254 "//y2020/www:files",
Alex Perry5f474f22020-02-01 12:14:24 -0800255 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800256 target_compatible_with = ["@platforms//os:linux"],
Alex Perry5f474f22020-02-01 12:14:24 -0800257)
Austin Schuhd58b2902020-03-01 19:28:04 -0800258
259load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
260
261flatbuffer_cc_library(
262 name = "setpoint_fbs",
263 srcs = [
264 "setpoint.fbs",
265 ],
266 gen_reflections = 1,
Philipp Schraderdada1072020-11-24 11:34:46 -0800267 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhd58b2902020-03-01 19:28:04 -0800268)
269
270cc_binary(
271 name = "setpoint_setter",
272 srcs = ["setpoint_setter.cc"],
Philipp Schraderdada1072020-11-24 11:34:46 -0800273 target_compatible_with = ["@platforms//os:linux"],
Austin Schuhd58b2902020-03-01 19:28:04 -0800274 deps = [
275 ":setpoint_fbs",
276 "//aos:init",
277 "//aos/events:shm_event_loop",
278 ],
279)
James Kuszmaul55d9fc72020-05-10 18:58:08 -0700280
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700281[
282 jinja2_template(
283 name = "y2020_pi" + str(num) + ".json",
284 src = "y2020_pi_template.json",
285 parameters = {"NUM": str(num)},
Philipp Schraderdada1072020-11-24 11:34:46 -0800286 target_compatible_with = ["@platforms//os:linux"],
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700287 )
288 for num in range(1, 5)
289]