blob: 488026e2674d60386f290667f92923a86a40f669 [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 = [
Ravago Jones81e50632022-03-11 16:23:51 -080017 "//y2022/actors:splines",
Austin Schuh76f227c2022-02-23 16:34:08 -080018 "//y2022/www:www_files",
19 ],
milind-u086d7262022-01-19 20:44:18 -080020 start_binaries = [
milind-uf2f59aa2022-01-23 21:06:12 -080021 "//aos/events/logging:logger_main",
22 "//aos/network:web_proxy_main",
milind-u086d7262022-01-19 20:44:18 -080023 ":joystick_reader",
24 ":wpilib_interface",
milind-uf2f59aa2022-01-23 21:06:12 -080025 "//aos/network:message_bridge_client",
26 "//aos/network:message_bridge_server",
27 "//y2022/actors:binaries",
milind-u086d7262022-01-19 20:44:18 -080028 "//y2022/control_loops/drivetrain:drivetrain",
Milind Upadhyayb8abf022022-02-22 21:07:44 -080029 "//y2022/control_loops/drivetrain:trajectory_generator",
milind-u086d7262022-01-19 20:44:18 -080030 "//y2022/control_loops/superstructure:superstructure",
milind-u086d7262022-01-19 20:44:18 -080031 ],
milind-uf2f59aa2022-01-23 21:06:12 -080032 target_compatible_with = ["@platforms//os:linux"],
milind-u086d7262022-01-19 20:44:18 -080033)
34
milind-u6b6e1002022-01-22 13:26:42 -080035robot_downloader(
36 name = "pi_download",
37 binaries = [
Jim Ostrowskib9135a92022-02-06 22:49:11 -080038 "//y2020/vision:calibration",
milind-u6b6e1002022-01-22 13:26:42 -080039 "//y2022/vision:viewer",
Ravago Jonese12b7902022-02-04 22:50:44 -080040 "//y2022/localizer:imu_main",
James Kuszmaul51fa1ae2022-02-26 00:49:57 -080041 "//y2022/localizer:localizer_main",
milind-u6b6e1002022-01-22 13:26:42 -080042 ],
43 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -080044 ":aos_config",
milind-u6b6e1002022-01-22 13:26:42 -080045 ],
James Kuszmaulb35e2342022-03-06 15:44:00 -080046 dirs = [
47 "//y2022/www:www_files",
48 ],
milind-u6b6e1002022-01-22 13:26:42 -080049 start_binaries = [
50 "//aos/events/logging:logger_main",
51 "//aos/network:message_bridge_client",
52 "//aos/network:message_bridge_server",
53 "//aos/network:web_proxy_main",
54 "//y2022/vision:camera_reader",
55 ],
56 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
57 target_type = "pi",
58)
59
milind-uf2f59aa2022-01-23 21:06:12 -080060aos_config(
Austin Schuhc5fa6d92022-02-25 14:36:28 -080061 name = "aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -080062 src = "y2022.json",
63 flatbuffers = [
64 "//aos/network:message_bridge_client_fbs",
65 "//aos/network:message_bridge_server_fbs",
66 "//aos/network:timestamp_fbs",
67 "//frc971/input:robot_state_fbs",
68 "//frc971/vision:vision_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -080069 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -080070 ],
71 target_compatible_with = ["@platforms//os:linux"],
72 visibility = ["//visibility:public"],
73 deps = [
James Kuszmaulef35d732022-02-12 16:37:32 -080074 ":config_imu",
milind-uf2f59aa2022-01-23 21:06:12 -080075 ":config_logger",
76 ":config_pi1",
77 ":config_pi2",
78 ":config_pi3",
79 ":config_pi4",
milind-uf2f59aa2022-01-23 21:06:12 -080080 ":config_roborio",
81 ],
82)
83
84[
85 aos_config(
86 name = "config_" + pi,
87 src = "y2022_" + pi + ".json",
88 flatbuffers = [
89 "//aos/network:message_bridge_client_fbs",
90 "//aos/network:message_bridge_server_fbs",
91 "//aos/network:timestamp_fbs",
92 "//aos/network:remote_message_fbs",
93 "//frc971/vision:vision_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -080094 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -080095 "//y2022/vision:target_estimate_fbs",
96 ],
97 target_compatible_with = ["@platforms//os:linux"],
98 visibility = ["//visibility:public"],
99 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800100 "//aos/events:aos_config",
101 "//frc971/control_loops/drivetrain:aos_config",
102 "//frc971/input:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800103 ],
104 )
105 for pi in [
106 "pi1",
107 "pi2",
108 "pi3",
109 "pi4",
milind-uf2f59aa2022-01-23 21:06:12 -0800110 ]
111]
112
113aos_config(
James Kuszmaulef35d732022-02-12 16:37:32 -0800114 name = "config_imu",
115 src = "y2022_imu.json",
116 flatbuffers = [
117 "//aos/network:message_bridge_client_fbs",
118 "//aos/network:message_bridge_server_fbs",
119 "//aos/network:timestamp_fbs",
120 "//aos/network:remote_message_fbs",
James Kuszmaul51fa1ae2022-02-26 00:49:57 -0800121 "//y2022/localizer:localizer_status_fbs",
122 "//y2022/localizer:localizer_output_fbs",
James Kuszmaul0dedb5e2022-03-05 16:02:20 -0800123 "//y2022/localizer:localizer_visualization_fbs",
James Kuszmaulef35d732022-02-12 16:37:32 -0800124 ],
125 target_compatible_with = ["@platforms//os:linux"],
126 visibility = ["//visibility:public"],
127 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800128 "//aos/events:aos_config",
129 "//frc971/control_loops/drivetrain:aos_config",
James Kuszmaulef35d732022-02-12 16:37:32 -0800130 ],
131)
132
133aos_config(
milind-uf2f59aa2022-01-23 21:06:12 -0800134 name = "config_logger",
135 src = "y2022_logger.json",
136 flatbuffers = [
137 "//aos/network:message_bridge_client_fbs",
138 "//aos/network:message_bridge_server_fbs",
139 "//aos/network:timestamp_fbs",
140 "//aos/network:remote_message_fbs",
141 "//frc971/vision:vision_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -0800142 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800143 ],
144 target_compatible_with = ["@platforms//os:linux"],
145 visibility = ["//visibility:public"],
146 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800147 "//aos/events:aos_config",
148 "//frc971/control_loops/drivetrain:aos_config",
149 "//frc971/input:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800150 ],
151)
152
153aos_config(
154 name = "config_roborio",
155 src = "y2022_roborio.json",
156 flatbuffers = [
Henry Speiser0b9b0052022-03-02 23:07:40 -0800157 ":setpoint_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800158 "//aos/network:remote_message_fbs",
159 "//aos/network:message_bridge_client_fbs",
160 "//aos/network:message_bridge_server_fbs",
161 "//aos/network:timestamp_fbs",
162 "//y2019/control_loops/drivetrain:target_selector_fbs",
163 "//y2022/control_loops/superstructure:superstructure_goal_fbs",
164 "//y2022/control_loops/superstructure:superstructure_output_fbs",
165 "//y2022/control_loops/superstructure:superstructure_position_fbs",
Milind Upadhyay482b0ba2022-02-26 21:51:59 -0800166 "//y2022/control_loops/superstructure:superstructure_can_position_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800167 "//y2022/control_loops/superstructure:superstructure_status_fbs",
168 ],
169 target_compatible_with = ["@platforms//os:linux"],
170 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800171 "//aos/events:aos_config",
172 "//frc971/autonomous:aos_config",
173 "//frc971/control_loops/drivetrain:aos_config",
174 "//frc971/input:aos_config",
175 "//frc971/wpilib:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800176 ],
177)
178
179[
180 jinja2_template(
181 name = "y2022_pi" + str(num) + ".json",
182 src = "y2022_pi_template.json",
183 parameters = {"NUM": str(num)},
184 target_compatible_with = ["@platforms//os:linux"],
185 )
186 for num in range(1, 6)
187]
188
milind-u086d7262022-01-19 20:44:18 -0800189cc_library(
190 name = "constants",
191 srcs = [
192 "constants.cc",
193 ],
194 hdrs = [
195 "constants.h",
196 ],
197 visibility = ["//visibility:public"],
198 deps = [
199 "//aos/mutex",
200 "//aos/network:team_number",
201 "//frc971:constants",
202 "//frc971/control_loops:pose",
203 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
204 "//y2022/control_loops/drivetrain:polydrivetrain_plants",
Austin Schuh39f26f62022-02-24 21:34:46 -0800205 "//y2022/control_loops/superstructure/catapult:catapult_plants",
Siddhant Kanwar0e37f592022-02-21 19:26:50 -0800206 "//y2022/control_loops/superstructure/climber:climber_plants",
Yash Chainani997a7492022-01-29 15:48:56 -0800207 "//y2022/control_loops/superstructure/intake:intake_plants",
Henry Speiser55aa3ba2022-02-21 23:21:12 -0800208 "//y2022/control_loops/superstructure/turret:turret_plants",
milind-u086d7262022-01-19 20:44:18 -0800209 "@com_github_google_glog//:glog",
210 "@com_google_absl//absl/base",
211 ],
212)
213
214cc_binary(
215 name = "wpilib_interface",
216 srcs = [
217 "wpilib_interface.cc",
218 ],
219 target_compatible_with = ["//tools/platforms/hardware:roborio"],
220 deps = [
221 ":constants",
222 "//aos:init",
223 "//aos:math",
224 "//aos/events:shm_event_loop",
225 "//aos/logging",
226 "//aos/stl_mutex",
227 "//aos/time",
228 "//aos/util:log_interval",
229 "//aos/util:phased_loop",
230 "//aos/util:wrapping_counter",
231 "//frc971/autonomous:auto_mode_fbs",
232 "//frc971/control_loops:control_loop",
233 "//frc971/control_loops:control_loops_fbs",
234 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
235 "//frc971/input:robot_state_fbs",
Ravago Jones0e86e242022-02-12 18:38:14 -0800236 "//frc971/queues:gyro_fbs",
milind-u086d7262022-01-19 20:44:18 -0800237 "//frc971/wpilib:ADIS16448",
238 "//frc971/wpilib:buffered_pcm",
239 "//frc971/wpilib:drivetrain_writer",
240 "//frc971/wpilib:encoder_and_potentiometer",
241 "//frc971/wpilib:interrupt_edge_counting",
242 "//frc971/wpilib:joystick_sender",
243 "//frc971/wpilib:logging_fbs",
244 "//frc971/wpilib:loop_output_handler",
245 "//frc971/wpilib:pdp_fetcher",
246 "//frc971/wpilib:sensor_reader",
247 "//frc971/wpilib:wpilib_interface",
248 "//frc971/wpilib:wpilib_robot_base",
249 "//third_party:phoenix",
250 "//third_party:wpilib",
Milind Upadhyay482b0ba2022-02-26 21:51:59 -0800251 "//y2022/control_loops/superstructure:superstructure_can_position_fbs",
milind-u086d7262022-01-19 20:44:18 -0800252 "//y2022/control_loops/superstructure:superstructure_output_fbs",
253 "//y2022/control_loops/superstructure:superstructure_position_fbs",
254 ],
255)
256
257cc_binary(
258 name = "joystick_reader",
259 srcs = [
260 ":joystick_reader.cc",
261 ],
262 deps = [
Henry Speiser0b9b0052022-03-02 23:07:40 -0800263 ":constants",
264 ":setpoint_fbs",
milind-u086d7262022-01-19 20:44:18 -0800265 "//aos:init",
266 "//aos/actions:action_lib",
267 "//aos/logging",
268 "//frc971/autonomous:auto_fbs",
269 "//frc971/autonomous:base_autonomous_actor",
270 "//frc971/control_loops:profiled_subsystem_fbs",
271 "//frc971/input:action_joystick_input",
272 "//frc971/input:drivetrain_input",
273 "//frc971/input:joystick_input",
274 "//y2022/control_loops/drivetrain:drivetrain_base",
275 "//y2022/control_loops/superstructure:superstructure_goal_fbs",
276 "//y2022/control_loops/superstructure:superstructure_status_fbs",
277 ],
278)
Milo Lin5d49af02022-02-05 12:50:32 -0800279
Henry Speiser0b9b0052022-03-02 23:07:40 -0800280flatbuffer_cc_library(
281 name = "setpoint_fbs",
282 srcs = [
283 "setpoint.fbs",
284 ],
285 gen_reflections = 1,
286 target_compatible_with = ["@platforms//os:linux"],
287)
288
289cc_binary(
290 name = "setpoint_setter",
291 srcs = ["setpoint_setter.cc"],
292 target_compatible_with = ["@platforms//os:linux"],
293 deps = [
294 ":constants",
295 ":setpoint_fbs",
296 "//aos:init",
297 "//aos/events:shm_event_loop",
298 ],
299)
300
Milo Lin5d49af02022-02-05 12:50:32 -0800301py_library(
302 name = "python_init",
303 srcs = ["__init__.py"],
304 target_compatible_with = ["@platforms//os:linux"],
305 visibility = ["//visibility:public"],
306)
James Kuszmaulf3ef9e12022-03-05 17:13:00 -0800307
308sh_binary(
309 name = "log_web_proxy",
310 srcs = ["log_web_proxy.sh"],
311 data = [
312 ":aos_config",
313 "//aos/network:log_web_proxy_main",
314 "//y2022/www:field_main_bundle.min.js",
315 "//y2022/www:files",
316 ],
317 target_compatible_with = ["@platforms//os:linux"],
318)