blob: 1623ec9c0b27fa4ee6c1a4034548a74bd269ce51 [file] [log] [blame]
milind-u086d7262022-01-19 20:44:18 -08001load("//frc971:downloader.bzl", "robot_downloader")
2load("//aos:config.bzl", "aos_config")
Henry Speiser0b9b0052022-03-02 23:07:40 -08003load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
milind-uf2f59aa2022-01-23 21:06:12 -08004load("//tools/build_rules:template.bzl", "jinja2_template")
milind-u086d7262022-01-19 20:44:18 -08005
6robot_downloader(
milind-uf2f59aa2022-01-23 21:06:12 -08007 binaries = [
Henry Speiser0b9b0052022-03-02 23:07:40 -08008 ":setpoint_setter",
milind-uf2f59aa2022-01-23 21:06:12 -08009 "//aos/network:web_proxy_main",
10 ],
milind-u086d7262022-01-19 20:44:18 -080011 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -080012 ":aos_config",
Austin Schuhde605f12022-02-23 23:08:19 -080013 "@ctre_phoenix_api_cpp_athena//:shared_libraries",
14 "@ctre_phoenix_cci_athena//:shared_libraries",
milind-u086d7262022-01-19 20:44:18 -080015 ],
Austin Schuh76f227c2022-02-23 16:34:08 -080016 dirs = [
17 "//y2022/www:www_files",
18 ],
milind-u086d7262022-01-19 20:44:18 -080019 start_binaries = [
milind-uf2f59aa2022-01-23 21:06:12 -080020 "//aos/events/logging:logger_main",
21 "//aos/network:web_proxy_main",
milind-u086d7262022-01-19 20:44:18 -080022 ":joystick_reader",
23 ":wpilib_interface",
milind-uf2f59aa2022-01-23 21:06:12 -080024 "//aos/network:message_bridge_client",
25 "//aos/network:message_bridge_server",
26 "//y2022/actors:binaries",
milind-u086d7262022-01-19 20:44:18 -080027 "//y2022/control_loops/drivetrain:drivetrain",
Milind Upadhyayb8abf022022-02-22 21:07:44 -080028 "//y2022/control_loops/drivetrain:trajectory_generator",
milind-u086d7262022-01-19 20:44:18 -080029 "//y2022/control_loops/superstructure:superstructure",
milind-u086d7262022-01-19 20:44:18 -080030 ],
milind-uf2f59aa2022-01-23 21:06:12 -080031 target_compatible_with = ["@platforms//os:linux"],
milind-u086d7262022-01-19 20:44:18 -080032)
33
milind-u6b6e1002022-01-22 13:26:42 -080034robot_downloader(
35 name = "pi_download",
36 binaries = [
Jim Ostrowskib9135a92022-02-06 22:49:11 -080037 "//y2020/vision:calibration",
milind-u6b6e1002022-01-22 13:26:42 -080038 "//y2022/vision:viewer",
Ravago Jonese12b7902022-02-04 22:50:44 -080039 "//y2022/localizer:imu_main",
James Kuszmaul51fa1ae2022-02-26 00:49:57 -080040 "//y2022/localizer:localizer_main",
milind-u6b6e1002022-01-22 13:26:42 -080041 ],
42 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -080043 ":aos_config",
milind-u6b6e1002022-01-22 13:26:42 -080044 ],
James Kuszmaulb35e2342022-03-06 15:44:00 -080045 dirs = [
46 "//y2022/www:www_files",
47 ],
milind-u6b6e1002022-01-22 13:26:42 -080048 start_binaries = [
49 "//aos/events/logging:logger_main",
50 "//aos/network:message_bridge_client",
51 "//aos/network:message_bridge_server",
52 "//aos/network:web_proxy_main",
53 "//y2022/vision:camera_reader",
54 ],
55 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
56 target_type = "pi",
57)
58
milind-uf2f59aa2022-01-23 21:06:12 -080059aos_config(
Austin Schuhc5fa6d92022-02-25 14:36:28 -080060 name = "aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -080061 src = "y2022.json",
62 flatbuffers = [
63 "//aos/network:message_bridge_client_fbs",
64 "//aos/network:message_bridge_server_fbs",
65 "//aos/network:timestamp_fbs",
66 "//frc971/input:robot_state_fbs",
67 "//frc971/vision:vision_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -080068 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -080069 ],
70 target_compatible_with = ["@platforms//os:linux"],
71 visibility = ["//visibility:public"],
72 deps = [
James Kuszmaulef35d732022-02-12 16:37:32 -080073 ":config_imu",
milind-uf2f59aa2022-01-23 21:06:12 -080074 ":config_logger",
75 ":config_pi1",
76 ":config_pi2",
77 ":config_pi3",
78 ":config_pi4",
milind-uf2f59aa2022-01-23 21:06:12 -080079 ":config_roborio",
80 ],
81)
82
83[
84 aos_config(
85 name = "config_" + pi,
86 src = "y2022_" + pi + ".json",
87 flatbuffers = [
88 "//aos/network:message_bridge_client_fbs",
89 "//aos/network:message_bridge_server_fbs",
90 "//aos/network:timestamp_fbs",
91 "//aos/network:remote_message_fbs",
92 "//frc971/vision:vision_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -080093 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -080094 "//y2022/vision:target_estimate_fbs",
95 ],
96 target_compatible_with = ["@platforms//os:linux"],
97 visibility = ["//visibility:public"],
98 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -080099 "//aos/events:aos_config",
100 "//frc971/control_loops/drivetrain:aos_config",
101 "//frc971/input:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800102 ],
103 )
104 for pi in [
105 "pi1",
106 "pi2",
107 "pi3",
108 "pi4",
milind-uf2f59aa2022-01-23 21:06:12 -0800109 ]
110]
111
112aos_config(
James Kuszmaulef35d732022-02-12 16:37:32 -0800113 name = "config_imu",
114 src = "y2022_imu.json",
115 flatbuffers = [
116 "//aos/network:message_bridge_client_fbs",
117 "//aos/network:message_bridge_server_fbs",
118 "//aos/network:timestamp_fbs",
119 "//aos/network:remote_message_fbs",
James Kuszmaul51fa1ae2022-02-26 00:49:57 -0800120 "//y2022/localizer:localizer_status_fbs",
121 "//y2022/localizer:localizer_output_fbs",
James Kuszmaul0dedb5e2022-03-05 16:02:20 -0800122 "//y2022/localizer:localizer_visualization_fbs",
James Kuszmaulef35d732022-02-12 16:37:32 -0800123 ],
124 target_compatible_with = ["@platforms//os:linux"],
125 visibility = ["//visibility:public"],
126 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800127 "//aos/events:aos_config",
128 "//frc971/control_loops/drivetrain:aos_config",
James Kuszmaulef35d732022-02-12 16:37:32 -0800129 ],
130)
131
132aos_config(
milind-uf2f59aa2022-01-23 21:06:12 -0800133 name = "config_logger",
134 src = "y2022_logger.json",
135 flatbuffers = [
136 "//aos/network:message_bridge_client_fbs",
137 "//aos/network:message_bridge_server_fbs",
138 "//aos/network:timestamp_fbs",
139 "//aos/network:remote_message_fbs",
140 "//frc971/vision:vision_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -0800141 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800142 ],
143 target_compatible_with = ["@platforms//os:linux"],
144 visibility = ["//visibility:public"],
145 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800146 "//aos/events:aos_config",
147 "//frc971/control_loops/drivetrain:aos_config",
148 "//frc971/input:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800149 ],
150)
151
152aos_config(
153 name = "config_roborio",
154 src = "y2022_roborio.json",
155 flatbuffers = [
Henry Speiser0b9b0052022-03-02 23:07:40 -0800156 ":setpoint_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800157 "//aos/network:remote_message_fbs",
158 "//aos/network:message_bridge_client_fbs",
159 "//aos/network:message_bridge_server_fbs",
160 "//aos/network:timestamp_fbs",
161 "//y2019/control_loops/drivetrain:target_selector_fbs",
162 "//y2022/control_loops/superstructure:superstructure_goal_fbs",
163 "//y2022/control_loops/superstructure:superstructure_output_fbs",
164 "//y2022/control_loops/superstructure:superstructure_position_fbs",
Milind Upadhyay482b0ba2022-02-26 21:51:59 -0800165 "//y2022/control_loops/superstructure:superstructure_can_position_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800166 "//y2022/control_loops/superstructure:superstructure_status_fbs",
167 ],
168 target_compatible_with = ["@platforms//os:linux"],
169 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800170 "//aos/events:aos_config",
171 "//frc971/autonomous:aos_config",
172 "//frc971/control_loops/drivetrain:aos_config",
173 "//frc971/input:aos_config",
174 "//frc971/wpilib:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800175 ],
176)
177
178[
179 jinja2_template(
180 name = "y2022_pi" + str(num) + ".json",
181 src = "y2022_pi_template.json",
182 parameters = {"NUM": str(num)},
183 target_compatible_with = ["@platforms//os:linux"],
184 )
185 for num in range(1, 6)
186]
187
milind-u086d7262022-01-19 20:44:18 -0800188cc_library(
189 name = "constants",
190 srcs = [
191 "constants.cc",
192 ],
193 hdrs = [
194 "constants.h",
195 ],
196 visibility = ["//visibility:public"],
197 deps = [
198 "//aos/mutex",
199 "//aos/network:team_number",
200 "//frc971:constants",
201 "//frc971/control_loops:pose",
202 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
203 "//y2022/control_loops/drivetrain:polydrivetrain_plants",
Austin Schuh39f26f62022-02-24 21:34:46 -0800204 "//y2022/control_loops/superstructure/catapult:catapult_plants",
Siddhant Kanwar0e37f592022-02-21 19:26:50 -0800205 "//y2022/control_loops/superstructure/climber:climber_plants",
Yash Chainani997a7492022-01-29 15:48:56 -0800206 "//y2022/control_loops/superstructure/intake:intake_plants",
Henry Speiser55aa3ba2022-02-21 23:21:12 -0800207 "//y2022/control_loops/superstructure/turret:turret_plants",
milind-u086d7262022-01-19 20:44:18 -0800208 "@com_github_google_glog//:glog",
209 "@com_google_absl//absl/base",
210 ],
211)
212
213cc_binary(
214 name = "wpilib_interface",
215 srcs = [
216 "wpilib_interface.cc",
217 ],
218 target_compatible_with = ["//tools/platforms/hardware:roborio"],
219 deps = [
220 ":constants",
221 "//aos:init",
222 "//aos:math",
223 "//aos/events:shm_event_loop",
224 "//aos/logging",
225 "//aos/stl_mutex",
226 "//aos/time",
227 "//aos/util:log_interval",
228 "//aos/util:phased_loop",
229 "//aos/util:wrapping_counter",
230 "//frc971/autonomous:auto_mode_fbs",
231 "//frc971/control_loops:control_loop",
232 "//frc971/control_loops:control_loops_fbs",
233 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
234 "//frc971/input:robot_state_fbs",
Ravago Jones0e86e242022-02-12 18:38:14 -0800235 "//frc971/queues:gyro_fbs",
milind-u086d7262022-01-19 20:44:18 -0800236 "//frc971/wpilib:ADIS16448",
237 "//frc971/wpilib:buffered_pcm",
238 "//frc971/wpilib:drivetrain_writer",
239 "//frc971/wpilib:encoder_and_potentiometer",
240 "//frc971/wpilib:interrupt_edge_counting",
241 "//frc971/wpilib:joystick_sender",
242 "//frc971/wpilib:logging_fbs",
243 "//frc971/wpilib:loop_output_handler",
244 "//frc971/wpilib:pdp_fetcher",
245 "//frc971/wpilib:sensor_reader",
246 "//frc971/wpilib:wpilib_interface",
247 "//frc971/wpilib:wpilib_robot_base",
248 "//third_party:phoenix",
249 "//third_party:wpilib",
Milind Upadhyay482b0ba2022-02-26 21:51:59 -0800250 "//y2022/control_loops/superstructure:superstructure_can_position_fbs",
milind-u086d7262022-01-19 20:44:18 -0800251 "//y2022/control_loops/superstructure:superstructure_output_fbs",
252 "//y2022/control_loops/superstructure:superstructure_position_fbs",
253 ],
254)
255
256cc_binary(
257 name = "joystick_reader",
258 srcs = [
259 ":joystick_reader.cc",
260 ],
261 deps = [
Henry Speiser0b9b0052022-03-02 23:07:40 -0800262 ":constants",
263 ":setpoint_fbs",
milind-u086d7262022-01-19 20:44:18 -0800264 "//aos:init",
265 "//aos/actions:action_lib",
266 "//aos/logging",
267 "//frc971/autonomous:auto_fbs",
268 "//frc971/autonomous:base_autonomous_actor",
269 "//frc971/control_loops:profiled_subsystem_fbs",
270 "//frc971/input:action_joystick_input",
271 "//frc971/input:drivetrain_input",
272 "//frc971/input:joystick_input",
273 "//y2022/control_loops/drivetrain:drivetrain_base",
274 "//y2022/control_loops/superstructure:superstructure_goal_fbs",
275 "//y2022/control_loops/superstructure:superstructure_status_fbs",
276 ],
277)
Milo Lin5d49af02022-02-05 12:50:32 -0800278
Henry Speiser0b9b0052022-03-02 23:07:40 -0800279flatbuffer_cc_library(
280 name = "setpoint_fbs",
281 srcs = [
282 "setpoint.fbs",
283 ],
284 gen_reflections = 1,
285 target_compatible_with = ["@platforms//os:linux"],
286)
287
288cc_binary(
289 name = "setpoint_setter",
290 srcs = ["setpoint_setter.cc"],
291 target_compatible_with = ["@platforms//os:linux"],
292 deps = [
293 ":constants",
294 ":setpoint_fbs",
295 "//aos:init",
296 "//aos/events:shm_event_loop",
297 ],
298)
299
Milo Lin5d49af02022-02-05 12:50:32 -0800300py_library(
301 name = "python_init",
302 srcs = ["__init__.py"],
303 target_compatible_with = ["@platforms//os:linux"],
304 visibility = ["//visibility:public"],
305)
James Kuszmaulf3ef9e12022-03-05 17:13:00 -0800306
307sh_binary(
308 name = "log_web_proxy",
309 srcs = ["log_web_proxy.sh"],
310 data = [
311 ":aos_config",
312 "//aos/network:log_web_proxy_main",
313 "//y2022/www:field_main_bundle.min.js",
314 "//y2022/www:files",
315 ],
316 target_compatible_with = ["@platforms//os:linux"],
317)