blob: f54ec84222721caebae03715044b05e1c14d4071 [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 ],
24)
25
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080026robot_downloader(
27 name = "pi_download",
Jim Ostrowskibaa43692020-03-08 16:25:10 -070028 binaries = [
29 "//y2020/vision:viewer",
30 ],
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080031 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -070032 ":config",
James Kuszmaul2d8fa2a2020-03-01 13:51:50 -080033 ],
34 dirs = [
35 "//y2020/www:www_files",
36 ],
37 restricted_to = ["//tools:armhf-debian"],
38 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 ],
44 target_type = "pi",
45)
46
Stephan Massaltd021f972020-01-05 20:41:23 -080047cc_library(
48 name = "constants",
49 srcs = [
50 "constants.cc",
51 ],
52 hdrs = [
53 "constants.h",
54 ],
55 visibility = ["//visibility:public"],
56 deps = [
57 "//aos/logging",
Stephan Massaltd021f972020-01-05 20:41:23 -080058 "//aos/network:team_number",
Brian Silverman1463c092020-10-30 17:28:24 -070059 "//aos/stl_mutex",
Stephan Massaltd021f972020-01-05 20:41:23 -080060 "//frc971:constants",
Stephan Massaltd021f972020-01-05 20:41:23 -080061 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
62 "//y2020/control_loops/drivetrain:polydrivetrain_plants",
Austin Schuh9dcd5202020-02-20 20:06:04 -080063 "//y2020/control_loops/superstructure/accelerator:accelerator_plants",
64 "//y2020/control_loops/superstructure/control_panel:control_panel_plants",
65 "//y2020/control_loops/superstructure/finisher:finisher_plants",
Sabina Davisa587fbd2020-01-31 22:11:15 -080066 "//y2020/control_loops/superstructure/hood:hood_plants",
Sabina Davise8d38992020-02-02 15:00:31 -080067 "//y2020/control_loops/superstructure/intake:intake_plants",
Kai Tinkess10943cf2020-02-01 15:49:57 -080068 "//y2020/control_loops/superstructure/turret:turret_plants",
Stephan Massaltd021f972020-01-05 20:41:23 -080069 "@com_google_absl//absl/base",
70 ],
71)
72
73cc_binary(
74 name = "wpilib_interface",
75 srcs = [
76 "wpilib_interface.cc",
77 ],
78 restricted_to = ["//tools:roborio"],
79 deps = [
80 ":constants",
81 "//aos:init",
82 "//aos:make_unique",
83 "//aos:math",
84 "//aos/controls:control_loop",
85 "//aos/events:shm_event_loop",
86 "//aos/logging",
87 "//aos/robot_state:robot_state_fbs",
88 "//aos/stl_mutex",
89 "//aos/time",
90 "//aos/util:log_interval",
91 "//aos/util:phased_loop",
92 "//aos/util:wrapping_counter",
93 "//frc971/autonomous:auto_mode_fbs",
94 "//frc971/control_loops:control_loops_fbs",
95 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
James Kuszmaula244a912020-01-18 13:50:50 -080096 "//frc971/wpilib:ADIS16470",
Stephan Massaltd021f972020-01-05 20:41:23 -080097 "//frc971/wpilib:buffered_pcm",
98 "//frc971/wpilib:drivetrain_writer",
99 "//frc971/wpilib:encoder_and_potentiometer",
100 "//frc971/wpilib:interrupt_edge_counting",
101 "//frc971/wpilib:joystick_sender",
102 "//frc971/wpilib:logging_fbs",
103 "//frc971/wpilib:loop_output_handler",
104 "//frc971/wpilib:pdp_fetcher",
105 "//frc971/wpilib:sensor_reader",
106 "//frc971/wpilib:wpilib_interface",
107 "//frc971/wpilib:wpilib_robot_base",
Alex Perryc4691f52020-02-17 19:20:01 -0800108 "//third_party:phoenix",
Stephan Massaltd021f972020-01-05 20:41:23 -0800109 "//third_party:wpilib",
110 "//y2020/control_loops/superstructure:superstructure_output_fbs",
111 "//y2020/control_loops/superstructure:superstructure_position_fbs",
112 ],
113)
114
115cc_binary(
116 name = "joystick_reader",
117 srcs = [
118 ":joystick_reader.cc",
119 ],
120 deps = [
Austin Schuhd58b2902020-03-01 19:28:04 -0800121 ":setpoint_fbs",
Stephan Massaltd021f972020-01-05 20:41:23 -0800122 "//aos:init",
123 "//aos/actions:action_lib",
124 "//aos/input:action_joystick_input",
125 "//aos/input:drivetrain_input",
126 "//aos/input:joystick_input",
127 "//aos/logging",
128 "//frc971/autonomous:auto_fbs",
129 "//frc971/autonomous:base_autonomous_actor",
130 "//frc971/control_loops:profiled_subsystem_fbs",
Sabina Davisa8fed3d2020-02-22 21:44:57 -0800131 "//y2020:constants",
Stephan Massaltd021f972020-01-05 20:41:23 -0800132 "//y2020/control_loops/drivetrain:drivetrain_base",
133 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
134 "//y2020/control_loops/superstructure:superstructure_status_fbs",
135 ],
136)
137
138aos_config(
139 name = "config",
140 src = "y2020.json",
141 flatbuffers = [
Austin Schuh6aa77be2020-02-22 21:06:40 -0800142 "//aos/network:message_bridge_client_fbs",
143 "//aos/network:message_bridge_server_fbs",
144 "//aos/network:timestamp_fbs",
Brian Silverman967e5df2020-02-09 16:43:34 -0800145 "//y2020/vision/sift:sift_fbs",
Brian Silverman62956e72020-02-26 21:04:05 -0800146 "//y2020/vision/sift:sift_training_fbs",
Austin Schuh6aa77be2020-02-22 21:06:40 -0800147 "//y2020/vision:vision_fbs",
Stephan Massaltd021f972020-01-05 20:41:23 -0800148 ],
149 visibility = ["//visibility:public"],
150 deps = [
Austin Schuh196a4452020-03-15 23:12:03 -0700151 ":config_laptop",
Austin Schuhce3a1912020-03-15 15:14:19 -0700152 ":config_pi1",
153 ":config_pi2",
154 ":config_pi3",
Austin Schuh196a4452020-03-15 23:12:03 -0700155 ":config_pi4",
Austin Schuhce3a1912020-03-15 15:14:19 -0700156 ":config_roborio",
157 ],
158)
159
160[
161 aos_config(
162 name = "config_" + pi,
163 src = "y2020_" + pi + ".json",
164 flatbuffers = [
165 "//aos/network:message_bridge_client_fbs",
166 "//aos/network:message_bridge_server_fbs",
167 "//aos/network:timestamp_fbs",
168 "//y2020/vision/sift:sift_fbs",
169 "//y2020/vision/sift:sift_training_fbs",
170 "//y2020/vision:vision_fbs",
Austin Schuh2f8fd752020-09-01 22:38:28 -0700171 "//aos/events/logging:logger_fbs",
Austin Schuhce3a1912020-03-15 15:14:19 -0700172 ],
173 visibility = ["//visibility:public"],
174 deps = [
175 "//aos/events:config",
Austin Schuh196a4452020-03-15 23:12:03 -0700176 "//aos/robot_state:config",
Austin Schuhac17fba2020-03-28 15:55:33 -0700177 "//frc971/control_loops/drivetrain:config",
Austin Schuhce3a1912020-03-15 15:14:19 -0700178 ],
179 )
180 for pi in [
181 "pi1",
182 "pi2",
183 "pi3",
Austin Schuh196a4452020-03-15 23:12:03 -0700184 "pi4",
Austin Schuhce3a1912020-03-15 15:14:19 -0700185 ]
186]
187
188aos_config(
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700189 name = "config_laptop",
190 src = "y2020_laptop.json",
191 flatbuffers = [
192 "//aos/network:message_bridge_client_fbs",
193 "//aos/network:message_bridge_server_fbs",
194 "//aos/network:timestamp_fbs",
195 "//y2020/vision/sift:sift_fbs",
196 "//y2020/vision/sift:sift_training_fbs",
197 "//y2020/vision:vision_fbs",
198 "//aos/events/logging:logger_fbs",
199 ],
200 visibility = ["//visibility:public"],
201 deps = [
202 "//aos/events:config",
203 "//aos/robot_state:config",
204 "//frc971/control_loops/drivetrain:config",
205 ],
206)
207
208aos_config(
Austin Schuhce3a1912020-03-15 15:14:19 -0700209 name = "config_roborio",
210 src = "y2020_roborio.json",
211 flatbuffers = [
212 ":setpoint_fbs",
213 "//aos/network:message_bridge_client_fbs",
214 "//aos/network:message_bridge_server_fbs",
215 "//aos/network:timestamp_fbs",
216 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
217 "//y2019/control_loops/drivetrain:target_selector_fbs",
218 "//y2020/control_loops/superstructure:superstructure_output_fbs",
219 "//y2020/control_loops/superstructure:superstructure_position_fbs",
220 "//y2020/control_loops/superstructure:superstructure_status_fbs",
221 ],
222 deps = [
223 "//aos/events:config",
Stephan Massaltd021f972020-01-05 20:41:23 -0800224 "//aos/robot_state:config",
225 "//frc971/autonomous:config",
226 "//frc971/control_loops/drivetrain:config",
227 "//frc971/wpilib:config",
228 ],
229)
230
231py_library(
232 name = "python_init",
233 srcs = ["__init__.py"],
234 visibility = ["//visibility:public"],
235)
Alex Perry5f474f22020-02-01 12:14:24 -0800236
237sh_binary(
238 name = "web_proxy",
239 srcs = ["web_proxy.sh"],
240 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700241 ":config",
Alex Perry5f474f22020-02-01 12:14:24 -0800242 "//aos/network:web_proxy_main",
Austin Schuhce3a1912020-03-15 15:14:19 -0700243 "//y2020/www:camera_main_bundle",
244 "//y2020/www:field_main_bundle",
Alex Perry5f474f22020-02-01 12:14:24 -0800245 "//y2020/www:files",
Alex Perry5f474f22020-02-01 12:14:24 -0800246 ],
247)
Austin Schuhd58b2902020-03-01 19:28:04 -0800248
249load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
250
251flatbuffer_cc_library(
252 name = "setpoint_fbs",
253 srcs = [
254 "setpoint.fbs",
255 ],
256 gen_reflections = 1,
257)
258
259cc_binary(
260 name = "setpoint_setter",
261 srcs = ["setpoint_setter.cc"],
262 deps = [
263 ":setpoint_fbs",
264 "//aos:init",
265 "//aos/events:shm_event_loop",
266 ],
267)
James Kuszmaul55d9fc72020-05-10 18:58:08 -0700268
Austin Schuh3a2f4a42020-09-16 14:10:39 -0700269[
270 jinja2_template(
271 name = "y2020_pi" + str(num) + ".json",
272 src = "y2020_pi_template.json",
273 parameters = {"NUM": str(num)},
274 )
275 for num in range(1, 5)
276]