blob: 918ae1d11fc6718e90b9f32e611768b8d4f13a37 [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 = [
12 ":config.json",
13 ],
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 = [
32 ":config.json",
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",
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",
185 "laptop",
Austin Schuhce3a1912020-03-15 15:14:19 -0700186 ]
187]
188
189aos_config(
190 name = "config_roborio",
191 src = "y2020_roborio.json",
192 flatbuffers = [
193 ":setpoint_fbs",
194 "//aos/network:message_bridge_client_fbs",
195 "//aos/network:message_bridge_server_fbs",
196 "//aos/network:timestamp_fbs",
197 "//y2020/control_loops/superstructure:superstructure_goal_fbs",
198 "//y2019/control_loops/drivetrain:target_selector_fbs",
199 "//y2020/control_loops/superstructure:superstructure_output_fbs",
200 "//y2020/control_loops/superstructure:superstructure_position_fbs",
201 "//y2020/control_loops/superstructure:superstructure_status_fbs",
202 ],
203 deps = [
204 "//aos/events:config",
Stephan Massaltd021f972020-01-05 20:41:23 -0800205 "//aos/robot_state:config",
206 "//frc971/autonomous:config",
207 "//frc971/control_loops/drivetrain:config",
208 "//frc971/wpilib:config",
209 ],
210)
211
212py_library(
213 name = "python_init",
214 srcs = ["__init__.py"],
215 visibility = ["//visibility:public"],
216)
Alex Perry5f474f22020-02-01 12:14:24 -0800217
218sh_binary(
219 name = "web_proxy",
220 srcs = ["web_proxy.sh"],
221 data = [
222 ":config.json",
223 "//aos/network:web_proxy_main",
Austin Schuhce3a1912020-03-15 15:14:19 -0700224 "//y2020/www:camera_main_bundle",
225 "//y2020/www:field_main_bundle",
Alex Perry5f474f22020-02-01 12:14:24 -0800226 "//y2020/www:files",
227 "//y2020/www:flatbuffers",
228 ],
229)
Austin Schuhd58b2902020-03-01 19:28:04 -0800230
231load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
232
233flatbuffer_cc_library(
234 name = "setpoint_fbs",
235 srcs = [
236 "setpoint.fbs",
237 ],
238 gen_reflections = 1,
239)
240
241cc_binary(
242 name = "setpoint_setter",
243 srcs = ["setpoint_setter.cc"],
244 deps = [
245 ":setpoint_fbs",
246 "//aos:init",
247 "//aos/events:shm_event_loop",
248 ],
249)
James Kuszmaul55d9fc72020-05-10 18:58:08 -0700250
251py_binary(
252 name = "generate_pi_config",
253 srcs = ["generate_pi_config.py"],
254 deps = ["@python_jinja2"],
255)
256
257[generate_pi_config(num) for num in range(1, 5)]