blob: 2e2f26defc7fb90ef4465cfbd9739ef2cc2c09a7 [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 Schuh6b2edc62022-03-27 13:32:09 -070013 ":message_bridge_client.sh",
Austin Schuhde605f12022-02-23 23:08:19 -080014 "@ctre_phoenix_api_cpp_athena//:shared_libraries",
15 "@ctre_phoenix_cci_athena//:shared_libraries",
milind-u086d7262022-01-19 20:44:18 -080016 ],
Austin Schuh76f227c2022-02-23 16:34:08 -080017 dirs = [
Ravago Jones81e50632022-03-11 16:23:51 -080018 "//y2022/actors:splines",
Austin Schuh76f227c2022-02-23 16:34:08 -080019 "//y2022/www:www_files",
20 ],
milind-u086d7262022-01-19 20:44:18 -080021 start_binaries = [
milind-uf2f59aa2022-01-23 21:06:12 -080022 "//aos/events/logging:logger_main",
23 "//aos/network:web_proxy_main",
milind-u086d7262022-01-19 20:44:18 -080024 ":joystick_reader",
25 ":wpilib_interface",
milind-uf2f59aa2022-01-23 21:06:12 -080026 "//aos/network:message_bridge_client",
27 "//aos/network:message_bridge_server",
28 "//y2022/actors:binaries",
milind-u086d7262022-01-19 20:44:18 -080029 "//y2022/control_loops/drivetrain:drivetrain",
Milind Upadhyayb8abf022022-02-22 21:07:44 -080030 "//y2022/control_loops/drivetrain:trajectory_generator",
milind-u086d7262022-01-19 20:44:18 -080031 "//y2022/control_loops/superstructure:superstructure",
milind-u086d7262022-01-19 20:44:18 -080032 ],
milind-uf2f59aa2022-01-23 21:06:12 -080033 target_compatible_with = ["@platforms//os:linux"],
milind-u086d7262022-01-19 20:44:18 -080034)
35
milind-u6b6e1002022-01-22 13:26:42 -080036robot_downloader(
37 name = "pi_download",
38 binaries = [
Jim Ostrowskib9135a92022-02-06 22:49:11 -080039 "//y2020/vision:calibration",
milind-u6b6e1002022-01-22 13:26:42 -080040 "//y2022/vision:viewer",
Ravago Jonese12b7902022-02-04 22:50:44 -080041 "//y2022/localizer:imu_main",
James Kuszmaul51fa1ae2022-02-26 00:49:57 -080042 "//y2022/localizer:localizer_main",
James Kuszmaul3eb753d2022-03-12 15:21:12 -080043 "//y2022/vision:image_decimator",
Tyler Chatowb3850c12020-02-26 20:55:48 -080044 "//y2022/image_streamer:image_streamer",
Austin Schuh63f65162022-04-01 22:31:19 -070045 "//aos/events/logging:log_cat",
milind-u6b6e1002022-01-22 13:26:42 -080046 ],
47 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -080048 ":aos_config",
Tyler Chatowb3850c12020-02-26 20:55:48 -080049 "//y2022/image_streamer:image_streamer_start",
milind-u6b6e1002022-01-22 13:26:42 -080050 ],
James Kuszmaulb35e2342022-03-06 15:44:00 -080051 dirs = [
52 "//y2022/www:www_files",
Tyler Chatowb3850c12020-02-26 20:55:48 -080053 "//y2022/image_streamer/www:www_files",
James Kuszmaulb35e2342022-03-06 15:44:00 -080054 ],
milind-u6b6e1002022-01-22 13:26:42 -080055 start_binaries = [
56 "//aos/events/logging:logger_main",
57 "//aos/network:message_bridge_client",
58 "//aos/network:message_bridge_server",
59 "//aos/network:web_proxy_main",
60 "//y2022/vision:camera_reader",
61 ],
62 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
63 target_type = "pi",
64)
65
milind-uf2f59aa2022-01-23 21:06:12 -080066aos_config(
Austin Schuhc5fa6d92022-02-25 14:36:28 -080067 name = "aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -080068 src = "y2022.json",
69 flatbuffers = [
70 "//aos/network:message_bridge_client_fbs",
71 "//aos/network:message_bridge_server_fbs",
72 "//aos/network:timestamp_fbs",
73 "//frc971/input:robot_state_fbs",
74 "//frc971/vision:vision_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -080075 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -080076 ],
77 target_compatible_with = ["@platforms//os:linux"],
78 visibility = ["//visibility:public"],
79 deps = [
James Kuszmaulef35d732022-02-12 16:37:32 -080080 ":config_imu",
milind-uf2f59aa2022-01-23 21:06:12 -080081 ":config_logger",
82 ":config_pi1",
83 ":config_pi2",
84 ":config_pi3",
85 ":config_pi4",
milind-uf2f59aa2022-01-23 21:06:12 -080086 ":config_roborio",
87 ],
88)
89
90[
91 aos_config(
92 name = "config_" + pi,
93 src = "y2022_" + pi + ".json",
94 flatbuffers = [
95 "//aos/network:message_bridge_client_fbs",
96 "//aos/network:message_bridge_server_fbs",
97 "//aos/network:timestamp_fbs",
98 "//aos/network:remote_message_fbs",
99 "//frc971/vision:vision_fbs",
Milind Upadhyayd67e9cf2022-03-13 13:56:57 -0700100 "//y2022/localizer:localizer_output_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -0800101 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800102 "//y2022/vision:target_estimate_fbs",
103 ],
104 target_compatible_with = ["@platforms//os:linux"],
105 visibility = ["//visibility:public"],
106 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800107 "//aos/events:aos_config",
108 "//frc971/control_loops/drivetrain:aos_config",
109 "//frc971/input:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800110 ],
111 )
112 for pi in [
113 "pi1",
114 "pi2",
115 "pi3",
116 "pi4",
milind-uf2f59aa2022-01-23 21:06:12 -0800117 ]
118]
119
120aos_config(
James Kuszmaulef35d732022-02-12 16:37:32 -0800121 name = "config_imu",
122 src = "y2022_imu.json",
123 flatbuffers = [
124 "//aos/network:message_bridge_client_fbs",
125 "//aos/network:message_bridge_server_fbs",
126 "//aos/network:timestamp_fbs",
127 "//aos/network:remote_message_fbs",
James Kuszmaul51fa1ae2022-02-26 00:49:57 -0800128 "//y2022/localizer:localizer_status_fbs",
129 "//y2022/localizer:localizer_output_fbs",
James Kuszmaul0dedb5e2022-03-05 16:02:20 -0800130 "//y2022/localizer:localizer_visualization_fbs",
James Kuszmaulef35d732022-02-12 16:37:32 -0800131 ],
132 target_compatible_with = ["@platforms//os:linux"],
133 visibility = ["//visibility:public"],
134 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800135 "//aos/events:aos_config",
136 "//frc971/control_loops/drivetrain:aos_config",
James Kuszmaulef35d732022-02-12 16:37:32 -0800137 ],
138)
139
140aos_config(
milind-uf2f59aa2022-01-23 21:06:12 -0800141 name = "config_logger",
142 src = "y2022_logger.json",
143 flatbuffers = [
144 "//aos/network:message_bridge_client_fbs",
145 "//aos/network:message_bridge_server_fbs",
146 "//aos/network:timestamp_fbs",
147 "//aos/network:remote_message_fbs",
148 "//frc971/vision:vision_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -0800149 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800150 ],
151 target_compatible_with = ["@platforms//os:linux"],
152 visibility = ["//visibility:public"],
153 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800154 "//aos/events:aos_config",
155 "//frc971/control_loops/drivetrain:aos_config",
156 "//frc971/input:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800157 ],
158)
159
160aos_config(
161 name = "config_roborio",
162 src = "y2022_roborio.json",
163 flatbuffers = [
Henry Speiser0b9b0052022-03-02 23:07:40 -0800164 ":setpoint_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800165 "//aos/network:remote_message_fbs",
166 "//aos/network:message_bridge_client_fbs",
167 "//aos/network:message_bridge_server_fbs",
168 "//aos/network:timestamp_fbs",
169 "//y2019/control_loops/drivetrain:target_selector_fbs",
170 "//y2022/control_loops/superstructure:superstructure_goal_fbs",
171 "//y2022/control_loops/superstructure:superstructure_output_fbs",
172 "//y2022/control_loops/superstructure:superstructure_position_fbs",
Milind Upadhyay482b0ba2022-02-26 21:51:59 -0800173 "//y2022/control_loops/superstructure:superstructure_can_position_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800174 "//y2022/control_loops/superstructure:superstructure_status_fbs",
175 ],
176 target_compatible_with = ["@platforms//os:linux"],
177 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800178 "//aos/events:aos_config",
179 "//frc971/autonomous:aos_config",
180 "//frc971/control_loops/drivetrain:aos_config",
181 "//frc971/input:aos_config",
182 "//frc971/wpilib:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800183 ],
184)
185
186[
187 jinja2_template(
188 name = "y2022_pi" + str(num) + ".json",
189 src = "y2022_pi_template.json",
190 parameters = {"NUM": str(num)},
191 target_compatible_with = ["@platforms//os:linux"],
192 )
193 for num in range(1, 6)
194]
195
milind-u086d7262022-01-19 20:44:18 -0800196cc_library(
197 name = "constants",
198 srcs = [
199 "constants.cc",
200 ],
201 hdrs = [
202 "constants.h",
203 ],
204 visibility = ["//visibility:public"],
205 deps = [
206 "//aos/mutex",
207 "//aos/network:team_number",
208 "//frc971:constants",
209 "//frc971/control_loops:pose",
210 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
Ravago Jones3283ce02022-03-09 19:31:29 -0800211 "//frc971/shooter_interpolation:interpolation",
milind-u086d7262022-01-19 20:44:18 -0800212 "//y2022/control_loops/drivetrain:polydrivetrain_plants",
Austin Schuh39f26f62022-02-24 21:34:46 -0800213 "//y2022/control_loops/superstructure/catapult:catapult_plants",
Siddhant Kanwar0e37f592022-02-21 19:26:50 -0800214 "//y2022/control_loops/superstructure/climber:climber_plants",
Yash Chainani997a7492022-01-29 15:48:56 -0800215 "//y2022/control_loops/superstructure/intake:intake_plants",
Henry Speiser55aa3ba2022-02-21 23:21:12 -0800216 "//y2022/control_loops/superstructure/turret:turret_plants",
milind-u086d7262022-01-19 20:44:18 -0800217 "@com_github_google_glog//:glog",
218 "@com_google_absl//absl/base",
219 ],
220)
221
222cc_binary(
223 name = "wpilib_interface",
224 srcs = [
225 "wpilib_interface.cc",
226 ],
227 target_compatible_with = ["//tools/platforms/hardware:roborio"],
228 deps = [
229 ":constants",
230 "//aos:init",
231 "//aos:math",
232 "//aos/events:shm_event_loop",
233 "//aos/logging",
234 "//aos/stl_mutex",
235 "//aos/time",
236 "//aos/util:log_interval",
237 "//aos/util:phased_loop",
238 "//aos/util:wrapping_counter",
239 "//frc971/autonomous:auto_mode_fbs",
240 "//frc971/control_loops:control_loop",
241 "//frc971/control_loops:control_loops_fbs",
242 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
243 "//frc971/input:robot_state_fbs",
Ravago Jones0e86e242022-02-12 18:38:14 -0800244 "//frc971/queues:gyro_fbs",
milind-u086d7262022-01-19 20:44:18 -0800245 "//frc971/wpilib:ADIS16448",
246 "//frc971/wpilib:buffered_pcm",
247 "//frc971/wpilib:drivetrain_writer",
248 "//frc971/wpilib:encoder_and_potentiometer",
249 "//frc971/wpilib:interrupt_edge_counting",
250 "//frc971/wpilib:joystick_sender",
251 "//frc971/wpilib:logging_fbs",
252 "//frc971/wpilib:loop_output_handler",
253 "//frc971/wpilib:pdp_fetcher",
254 "//frc971/wpilib:sensor_reader",
255 "//frc971/wpilib:wpilib_interface",
256 "//frc971/wpilib:wpilib_robot_base",
257 "//third_party:phoenix",
258 "//third_party:wpilib",
Henry Speiser77747b72022-03-06 17:18:29 -0800259 "//y2022/control_loops/superstructure:led_indicator_lib",
Milind Upadhyay482b0ba2022-02-26 21:51:59 -0800260 "//y2022/control_loops/superstructure:superstructure_can_position_fbs",
milind-u086d7262022-01-19 20:44:18 -0800261 "//y2022/control_loops/superstructure:superstructure_output_fbs",
262 "//y2022/control_loops/superstructure:superstructure_position_fbs",
263 ],
264)
265
266cc_binary(
267 name = "joystick_reader",
268 srcs = [
269 ":joystick_reader.cc",
270 ],
271 deps = [
Henry Speiser0b9b0052022-03-02 23:07:40 -0800272 ":constants",
273 ":setpoint_fbs",
milind-u086d7262022-01-19 20:44:18 -0800274 "//aos:init",
275 "//aos/actions:action_lib",
276 "//aos/logging",
277 "//frc971/autonomous:auto_fbs",
278 "//frc971/autonomous:base_autonomous_actor",
279 "//frc971/control_loops:profiled_subsystem_fbs",
280 "//frc971/input:action_joystick_input",
281 "//frc971/input:drivetrain_input",
282 "//frc971/input:joystick_input",
283 "//y2022/control_loops/drivetrain:drivetrain_base",
284 "//y2022/control_loops/superstructure:superstructure_goal_fbs",
285 "//y2022/control_loops/superstructure:superstructure_status_fbs",
286 ],
287)
Milo Lin5d49af02022-02-05 12:50:32 -0800288
Henry Speiser0b9b0052022-03-02 23:07:40 -0800289flatbuffer_cc_library(
290 name = "setpoint_fbs",
291 srcs = [
292 "setpoint.fbs",
293 ],
294 gen_reflections = 1,
295 target_compatible_with = ["@platforms//os:linux"],
296)
297
298cc_binary(
299 name = "setpoint_setter",
300 srcs = ["setpoint_setter.cc"],
301 target_compatible_with = ["@platforms//os:linux"],
302 deps = [
303 ":constants",
304 ":setpoint_fbs",
305 "//aos:init",
306 "//aos/events:shm_event_loop",
307 ],
308)
309
Milo Lin5d49af02022-02-05 12:50:32 -0800310py_library(
311 name = "python_init",
312 srcs = ["__init__.py"],
313 target_compatible_with = ["@platforms//os:linux"],
314 visibility = ["//visibility:public"],
315)
James Kuszmaulf3ef9e12022-03-05 17:13:00 -0800316
317sh_binary(
318 name = "log_web_proxy",
319 srcs = ["log_web_proxy.sh"],
320 data = [
321 ":aos_config",
322 "//aos/network:log_web_proxy_main",
323 "//y2022/www:field_main_bundle.min.js",
324 "//y2022/www:files",
325 ],
326 target_compatible_with = ["@platforms//os:linux"],
327)