blob: 2d3f0e5ffb1ad40f8edb8cbde9fc55f3364a3e97 [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")
James Kuszmaul55d9fc72020-05-10 18:58:08 -07005load("//y2020:config_gen.bzl", "generate_pi_config")
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",
58 "//aos/mutex",
59 "//aos/network:team_number",
60 "//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",
171 ],
172 visibility = ["//visibility:public"],
173 deps = [
174 "//aos/events:config",
Austin Schuh196a4452020-03-15 23:12:03 -0700175 "//aos/robot_state:config",
Austin Schuhac17fba2020-03-28 15:55:33 -0700176 "//frc971/control_loops/drivetrain:config",
Austin Schuhce3a1912020-03-15 15:14:19 -0700177 ],
178 )
179 for pi in [
180 "pi1",
181 "pi2",
182 "pi3",
Austin Schuh196a4452020-03-15 23:12:03 -0700183 "pi4",
184 "laptop",
Austin Schuhce3a1912020-03-15 15:14:19 -0700185 ]
186]
187
188aos_config(
189 name = "config_roborio",
190 src = "y2020_roborio.json",
191 flatbuffers = [
192 ":setpoint_fbs",
193 "//aos/network:message_bridge_client_fbs",
194 "//aos/network:message_bridge_server_fbs",
195 "//aos/network:timestamp_fbs",
196 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
197 "//y2019/control_loops/drivetrain:target_selector_fbs",
198 "//y2020/control_loops/superstructure:superstructure_output_fbs",
199 "//y2020/control_loops/superstructure:superstructure_position_fbs",
200 "//y2020/control_loops/superstructure:superstructure_status_fbs",
201 ],
202 deps = [
203 "//aos/events:config",
Stephan Massaltd021f972020-01-05 20:41:23 -0800204 "//aos/robot_state:config",
205 "//frc971/autonomous:config",
206 "//frc971/control_loops/drivetrain:config",
207 "//frc971/wpilib:config",
208 ],
209)
210
211py_library(
212 name = "python_init",
213 srcs = ["__init__.py"],
214 visibility = ["//visibility:public"],
215)
Alex Perry5f474f22020-02-01 12:14:24 -0800216
217sh_binary(
218 name = "web_proxy",
219 srcs = ["web_proxy.sh"],
220 data = [
Austin Schuh14d7d3d2020-09-10 18:14:36 -0700221 ":config",
Alex Perry5f474f22020-02-01 12:14:24 -0800222 "//aos/network:web_proxy_main",
Austin Schuhce3a1912020-03-15 15:14:19 -0700223 "//y2020/www:camera_main_bundle",
224 "//y2020/www:field_main_bundle",
Alex Perry5f474f22020-02-01 12:14:24 -0800225 "//y2020/www:files",
226 "//y2020/www:flatbuffers",
227 ],
228)
Austin Schuhd58b2902020-03-01 19:28:04 -0800229
230load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
231
232flatbuffer_cc_library(
233 name = "setpoint_fbs",
234 srcs = [
235 "setpoint.fbs",
236 ],
237 gen_reflections = 1,
238)
239
240cc_binary(
241 name = "setpoint_setter",
242 srcs = ["setpoint_setter.cc"],
243 deps = [
244 ":setpoint_fbs",
245 "//aos:init",
246 "//aos/events:shm_event_loop",
247 ],
248)
James Kuszmaul55d9fc72020-05-10 18:58:08 -0700249
250py_binary(
251 name = "generate_pi_config",
252 srcs = ["generate_pi_config.py"],
253 deps = ["@python_jinja2"],
254)
255
256[generate_pi_config(num) for num in range(1, 5)]