blob: 4589c983ea23f3b6923d16ad6f3cde05e0170e6b [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 ],
milind-u6b6e1002022-01-22 13:26:42 -080045 start_binaries = [
46 "//aos/events/logging:logger_main",
47 "//aos/network:message_bridge_client",
48 "//aos/network:message_bridge_server",
49 "//aos/network:web_proxy_main",
50 "//y2022/vision:camera_reader",
51 ],
52 target_compatible_with = ["//tools/platforms/hardware:raspberry_pi"],
53 target_type = "pi",
54)
55
milind-uf2f59aa2022-01-23 21:06:12 -080056aos_config(
Austin Schuhc5fa6d92022-02-25 14:36:28 -080057 name = "aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -080058 src = "y2022.json",
59 flatbuffers = [
60 "//aos/network:message_bridge_client_fbs",
61 "//aos/network:message_bridge_server_fbs",
62 "//aos/network:timestamp_fbs",
63 "//frc971/input:robot_state_fbs",
64 "//frc971/vision:vision_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -080065 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -080066 ],
67 target_compatible_with = ["@platforms//os:linux"],
68 visibility = ["//visibility:public"],
69 deps = [
James Kuszmaulef35d732022-02-12 16:37:32 -080070 ":config_imu",
milind-uf2f59aa2022-01-23 21:06:12 -080071 ":config_logger",
72 ":config_pi1",
73 ":config_pi2",
74 ":config_pi3",
75 ":config_pi4",
milind-uf2f59aa2022-01-23 21:06:12 -080076 ":config_roborio",
77 ],
78)
79
80[
81 aos_config(
82 name = "config_" + pi,
83 src = "y2022_" + pi + ".json",
84 flatbuffers = [
85 "//aos/network:message_bridge_client_fbs",
86 "//aos/network:message_bridge_server_fbs",
87 "//aos/network:timestamp_fbs",
88 "//aos/network:remote_message_fbs",
89 "//frc971/vision:vision_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -080090 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -080091 "//y2022/vision:target_estimate_fbs",
92 ],
93 target_compatible_with = ["@platforms//os:linux"],
94 visibility = ["//visibility:public"],
95 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -080096 "//aos/events:aos_config",
97 "//frc971/control_loops/drivetrain:aos_config",
98 "//frc971/input:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -080099 ],
100 )
101 for pi in [
102 "pi1",
103 "pi2",
104 "pi3",
105 "pi4",
milind-uf2f59aa2022-01-23 21:06:12 -0800106 ]
107]
108
109aos_config(
James Kuszmaulef35d732022-02-12 16:37:32 -0800110 name = "config_imu",
111 src = "y2022_imu.json",
112 flatbuffers = [
113 "//aos/network:message_bridge_client_fbs",
114 "//aos/network:message_bridge_server_fbs",
115 "//aos/network:timestamp_fbs",
116 "//aos/network:remote_message_fbs",
James Kuszmaul51fa1ae2022-02-26 00:49:57 -0800117 "//y2022/localizer:localizer_status_fbs",
118 "//y2022/localizer:localizer_output_fbs",
James Kuszmaulef35d732022-02-12 16:37:32 -0800119 ],
120 target_compatible_with = ["@platforms//os:linux"],
121 visibility = ["//visibility:public"],
122 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800123 "//aos/events:aos_config",
124 "//frc971/control_loops/drivetrain:aos_config",
James Kuszmaulef35d732022-02-12 16:37:32 -0800125 ],
126)
127
128aos_config(
milind-uf2f59aa2022-01-23 21:06:12 -0800129 name = "config_logger",
130 src = "y2022_logger.json",
131 flatbuffers = [
132 "//aos/network:message_bridge_client_fbs",
133 "//aos/network:message_bridge_server_fbs",
134 "//aos/network:timestamp_fbs",
135 "//aos/network:remote_message_fbs",
136 "//frc971/vision:vision_fbs",
Jim Ostrowski007e2ea2022-01-30 13:13:26 -0800137 "//y2022/vision:calibration_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800138 ],
139 target_compatible_with = ["@platforms//os:linux"],
140 visibility = ["//visibility:public"],
141 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800142 "//aos/events:aos_config",
143 "//frc971/control_loops/drivetrain:aos_config",
144 "//frc971/input:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800145 ],
146)
147
148aos_config(
149 name = "config_roborio",
150 src = "y2022_roborio.json",
151 flatbuffers = [
Henry Speiser0b9b0052022-03-02 23:07:40 -0800152 ":setpoint_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800153 "//aos/network:remote_message_fbs",
154 "//aos/network:message_bridge_client_fbs",
155 "//aos/network:message_bridge_server_fbs",
156 "//aos/network:timestamp_fbs",
157 "//y2019/control_loops/drivetrain:target_selector_fbs",
158 "//y2022/control_loops/superstructure:superstructure_goal_fbs",
159 "//y2022/control_loops/superstructure:superstructure_output_fbs",
160 "//y2022/control_loops/superstructure:superstructure_position_fbs",
Milind Upadhyay482b0ba2022-02-26 21:51:59 -0800161 "//y2022/control_loops/superstructure:superstructure_can_position_fbs",
milind-uf2f59aa2022-01-23 21:06:12 -0800162 "//y2022/control_loops/superstructure:superstructure_status_fbs",
163 ],
164 target_compatible_with = ["@platforms//os:linux"],
165 deps = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800166 "//aos/events:aos_config",
167 "//frc971/autonomous:aos_config",
168 "//frc971/control_loops/drivetrain:aos_config",
169 "//frc971/input:aos_config",
170 "//frc971/wpilib:aos_config",
milind-uf2f59aa2022-01-23 21:06:12 -0800171 ],
172)
173
174[
175 jinja2_template(
176 name = "y2022_pi" + str(num) + ".json",
177 src = "y2022_pi_template.json",
178 parameters = {"NUM": str(num)},
179 target_compatible_with = ["@platforms//os:linux"],
180 )
181 for num in range(1, 6)
182]
183
milind-u086d7262022-01-19 20:44:18 -0800184cc_library(
185 name = "constants",
186 srcs = [
187 "constants.cc",
188 ],
189 hdrs = [
190 "constants.h",
191 ],
192 visibility = ["//visibility:public"],
193 deps = [
194 "//aos/mutex",
195 "//aos/network:team_number",
196 "//frc971:constants",
197 "//frc971/control_loops:pose",
198 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
199 "//y2022/control_loops/drivetrain:polydrivetrain_plants",
Austin Schuh39f26f62022-02-24 21:34:46 -0800200 "//y2022/control_loops/superstructure/catapult:catapult_plants",
Siddhant Kanwar0e37f592022-02-21 19:26:50 -0800201 "//y2022/control_loops/superstructure/climber:climber_plants",
Yash Chainani997a7492022-01-29 15:48:56 -0800202 "//y2022/control_loops/superstructure/intake:intake_plants",
Henry Speiser55aa3ba2022-02-21 23:21:12 -0800203 "//y2022/control_loops/superstructure/turret:turret_plants",
milind-u086d7262022-01-19 20:44:18 -0800204 "@com_github_google_glog//:glog",
205 "@com_google_absl//absl/base",
206 ],
207)
208
209cc_binary(
210 name = "wpilib_interface",
211 srcs = [
212 "wpilib_interface.cc",
213 ],
214 target_compatible_with = ["//tools/platforms/hardware:roborio"],
215 deps = [
216 ":constants",
217 "//aos:init",
218 "//aos:math",
219 "//aos/events:shm_event_loop",
220 "//aos/logging",
221 "//aos/stl_mutex",
222 "//aos/time",
223 "//aos/util:log_interval",
224 "//aos/util:phased_loop",
225 "//aos/util:wrapping_counter",
226 "//frc971/autonomous:auto_mode_fbs",
227 "//frc971/control_loops:control_loop",
228 "//frc971/control_loops:control_loops_fbs",
229 "//frc971/control_loops/drivetrain:drivetrain_position_fbs",
230 "//frc971/input:robot_state_fbs",
Ravago Jones0e86e242022-02-12 18:38:14 -0800231 "//frc971/queues:gyro_fbs",
milind-u086d7262022-01-19 20:44:18 -0800232 "//frc971/wpilib:ADIS16448",
233 "//frc971/wpilib:buffered_pcm",
234 "//frc971/wpilib:drivetrain_writer",
235 "//frc971/wpilib:encoder_and_potentiometer",
236 "//frc971/wpilib:interrupt_edge_counting",
237 "//frc971/wpilib:joystick_sender",
238 "//frc971/wpilib:logging_fbs",
239 "//frc971/wpilib:loop_output_handler",
240 "//frc971/wpilib:pdp_fetcher",
241 "//frc971/wpilib:sensor_reader",
242 "//frc971/wpilib:wpilib_interface",
243 "//frc971/wpilib:wpilib_robot_base",
244 "//third_party:phoenix",
245 "//third_party:wpilib",
Milind Upadhyay482b0ba2022-02-26 21:51:59 -0800246 "//y2022/control_loops/superstructure:superstructure_can_position_fbs",
milind-u086d7262022-01-19 20:44:18 -0800247 "//y2022/control_loops/superstructure:superstructure_output_fbs",
248 "//y2022/control_loops/superstructure:superstructure_position_fbs",
249 ],
250)
251
252cc_binary(
253 name = "joystick_reader",
254 srcs = [
255 ":joystick_reader.cc",
256 ],
257 deps = [
Henry Speiser0b9b0052022-03-02 23:07:40 -0800258 ":constants",
259 ":setpoint_fbs",
milind-u086d7262022-01-19 20:44:18 -0800260 "//aos:init",
261 "//aos/actions:action_lib",
262 "//aos/logging",
263 "//frc971/autonomous:auto_fbs",
264 "//frc971/autonomous:base_autonomous_actor",
265 "//frc971/control_loops:profiled_subsystem_fbs",
266 "//frc971/input:action_joystick_input",
267 "//frc971/input:drivetrain_input",
268 "//frc971/input:joystick_input",
269 "//y2022/control_loops/drivetrain:drivetrain_base",
270 "//y2022/control_loops/superstructure:superstructure_goal_fbs",
271 "//y2022/control_loops/superstructure:superstructure_status_fbs",
272 ],
273)
Milo Lin5d49af02022-02-05 12:50:32 -0800274
Henry Speiser0b9b0052022-03-02 23:07:40 -0800275flatbuffer_cc_library(
276 name = "setpoint_fbs",
277 srcs = [
278 "setpoint.fbs",
279 ],
280 gen_reflections = 1,
281 target_compatible_with = ["@platforms//os:linux"],
282)
283
284cc_binary(
285 name = "setpoint_setter",
286 srcs = ["setpoint_setter.cc"],
287 target_compatible_with = ["@platforms//os:linux"],
288 deps = [
289 ":constants",
290 ":setpoint_fbs",
291 "//aos:init",
292 "//aos/events:shm_event_loop",
293 ],
294)
295
Milo Lin5d49af02022-02-05 12:50:32 -0800296py_library(
297 name = "python_init",
298 srcs = ["__init__.py"],
299 target_compatible_with = ["@platforms//os:linux"],
300 visibility = ["//visibility:public"],
301)