blob: 946579ba06438a639d140712aabfbcee9880714d [file] [log] [blame]
Niko Sohmers3860f8a2024-01-12 21:05:19 -08001load("//tools/build_rules:js.bzl", "ts_project")
2load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
3load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library")
4
5package(default_visibility = ["//visibility:public"])
6
7static_flatbuffer(
8 name = "superstructure_goal_fbs",
9 srcs = [
10 "superstructure_goal.fbs",
11 ],
12 deps = [
13 "//frc971/control_loops:control_loops_fbs",
14 "//frc971/control_loops:profiled_subsystem_fbs",
Nathan Leongdd728002024-02-03 15:26:53 -080015 "//frc971/control_loops/catapult:catapult_goal_fbs",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080016 ],
17)
18
19static_flatbuffer(
20 name = "superstructure_output_fbs",
21 srcs = [
22 "superstructure_output.fbs",
23 ],
24)
25
26static_flatbuffer(
27 name = "superstructure_status_fbs",
28 srcs = [
29 "superstructure_status.fbs",
30 ],
31 deps = [
32 "//frc971/control_loops:control_loops_fbs",
33 "//frc971/control_loops:profiled_subsystem_fbs",
34 ],
35)
36
37flatbuffer_ts_library(
38 name = "superstructure_status_ts_fbs",
39 srcs = [
40 "superstructure_status.fbs",
41 ],
42 deps = [
43 "//frc971/control_loops:control_loops_ts_fbs",
44 "//frc971/control_loops:profiled_subsystem_ts_fbs",
45 ],
46)
47
48static_flatbuffer(
49 name = "superstructure_position_fbs",
50 srcs = [
51 "superstructure_position.fbs",
52 ],
53 deps = [
54 "//frc971/control_loops:control_loops_fbs",
55 "//frc971/control_loops:profiled_subsystem_fbs",
56 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
57 ],
58)
59
Niko Sohmers58e64c82024-01-14 12:49:54 -080060static_flatbuffer(
61 name = "superstructure_can_position_fbs",
62 srcs = ["superstructure_can_position.fbs"],
63 deps = ["//frc971/control_loops:can_talonfx_fbs"],
64)
65
66flatbuffer_ts_library(
67 name = "superstructure_can_position_ts_fbs",
68 srcs = ["superstructure_can_position.fbs"],
69 target_compatible_with = ["@platforms//os:linux"],
70 deps = ["//frc971/control_loops:can_talonfx_ts_fbs"],
71)
72
Niko Sohmers3860f8a2024-01-12 21:05:19 -080073cc_library(
74 name = "superstructure_lib",
75 srcs = [
76 "superstructure.cc",
77 ],
78 hdrs = [
79 "superstructure.h",
80 ],
Filip Kujawa9cf6c0f2024-03-02 15:05:59 -080081 data = [],
Niko Sohmers3860f8a2024-01-12 21:05:19 -080082 deps = [
Niko Sohmersac4d8872024-02-23 13:55:47 -080083 ":collision_avoidance_lib",
Niko Sohmersc4d2c502024-02-19 19:35:35 -080084 ":shooter",
Niko Sohmers3860f8a2024-01-12 21:05:19 -080085 ":superstructure_goal_fbs",
86 ":superstructure_output_fbs",
87 ":superstructure_position_fbs",
88 ":superstructure_status_fbs",
89 "//aos:flatbuffer_merge",
90 "//aos/events:event_loop",
91 "//frc971/constants:constants_sender_lib",
92 "//frc971/control_loops:control_loop",
93 "//frc971/control_loops/drivetrain:drivetrain_can_position_fbs",
94 "//frc971/control_loops/drivetrain:drivetrain_status_fbs",
95 "//frc971/shooter_interpolation:interpolation",
96 "//frc971/zeroing:absolute_encoder",
97 "//frc971/zeroing:pot_and_absolute_encoder",
98 "//y2024:constants",
99 "//y2024/constants:constants_fbs",
100 "//y2024/constants:simulated_constants_sender",
101 ],
102)
103
104cc_binary(
105 name = "superstructure",
106 srcs = [
107 "superstructure_main.cc",
108 ],
109 deps = [
110 ":superstructure_lib",
111 "//aos:init",
112 "//aos/events:shm_event_loop",
113 ],
114)
115
Niko Sohmersac4d8872024-02-23 13:55:47 -0800116cc_library(
117 name = "collision_avoidance_lib",
118 srcs = ["collision_avoidance.cc"],
119 hdrs = ["collision_avoidance.h"],
120 target_compatible_with = ["@platforms//os:linux"],
121 deps = [
122 ":superstructure_goal_fbs",
123 ":superstructure_status_fbs",
124 "//frc971/control_loops:control_loops_fbs",
125 "//frc971/control_loops:profiled_subsystem_fbs",
126 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
127 "@com_github_google_glog//:glog",
128 "@com_google_absl//absl/functional:bind_front",
129 ],
130)
131
132cc_test(
133 name = "collision_avoidance_test",
134 srcs = ["collision_avoidance_test.cc"],
135 target_compatible_with = ["@platforms//os:linux"],
136 deps = [
137 ":collision_avoidance_lib",
138 ":superstructure_goal_fbs",
139 ":superstructure_status_fbs",
140 "//aos:flatbuffers",
141 "//aos:math",
142 "//aos/testing:googletest",
143 ],
144)
145
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800146cc_test(
147 name = "superstructure_lib_test",
148 srcs = [
149 "superstructure_lib_test.cc",
150 ],
151 data = [
152 "//y2024:aos_config",
153 ],
154 deps = [
155 ":superstructure_goal_fbs",
156 ":superstructure_lib",
157 ":superstructure_output_fbs",
158 ":superstructure_position_fbs",
159 ":superstructure_status_fbs",
160 "//aos:json_to_flatbuffer",
161 "//aos:math",
162 "//aos/events/logging:log_writer",
163 "//aos/testing:googletest",
164 "//aos/time",
165 "//frc971/control_loops:capped_test_plant",
166 "//frc971/control_loops:control_loop_test",
167 "//frc971/control_loops:position_sensor_sim",
168 "//frc971/control_loops:subsystem_simulator",
169 "//frc971/control_loops:team_number_test_environment",
170 "//frc971/control_loops/drivetrain:drivetrain_status_fbs",
171 ],
172)
173
Niko Sohmersc4d2c502024-02-19 19:35:35 -0800174cc_library(
175 name = "shooter",
176 srcs = [
177 "shooter.cc",
178 ],
179 hdrs = [
180 "shooter.h",
181 ],
182 deps = [
183 ":aiming",
Niko Sohmersac4d8872024-02-23 13:55:47 -0800184 ":collision_avoidance_lib",
Niko Sohmersc4d2c502024-02-19 19:35:35 -0800185 ":superstructure_can_position_fbs",
186 ":superstructure_goal_fbs",
187 ":superstructure_position_fbs",
188 ":superstructure_status_fbs",
189 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
190 "//frc971/control_loops/catapult",
191 "//frc971/control_loops/catapult:catapult_goal_fbs",
192 "//frc971/shooter_interpolation:interpolation",
193 "//frc971/zeroing:pot_and_absolute_encoder",
194 "//y2024:constants",
195 "//y2024/constants:constants_fbs",
196 "//y2024/control_loops/superstructure/altitude:altitude_plants",
197 "//y2024/control_loops/superstructure/catapult:catapult_plants",
198 "//y2024/control_loops/superstructure/turret:turret_plants",
199 ],
200)
201
202cc_library(
203 name = "aiming",
204 srcs = [
205 "aiming.cc",
206 ],
207 hdrs = [
208 "aiming.h",
209 ],
210 deps = [
211 ":superstructure_status_fbs",
212 "//frc971/control_loops:static_zeroing_single_dof_profiled_subsystem",
213 "//frc971/control_loops/aiming",
214 "//frc971/control_loops/drivetrain:drivetrain_status_fbs",
215 "//y2024:constants",
216 "//y2024/constants:constants_fbs",
217 "//y2024/control_loops/drivetrain:drivetrain_base",
218 ],
219)
220
Niko Sohmers3860f8a2024-01-12 21:05:19 -0800221cc_binary(
222 name = "superstructure_replay",
223 srcs = ["superstructure_replay.cc"],
224 deps = [
225 ":superstructure_lib",
226 "//aos:configuration",
227 "//aos:init",
228 "//aos/events:simulated_event_loop",
229 "//aos/events/logging:log_reader",
230 "//aos/network:team_number",
231 ],
232)
233
234ts_project(
235 name = "superstructure_plotter",
236 srcs = ["superstructure_plotter.ts"],
237 target_compatible_with = ["@platforms//os:linux"],
238 deps = [
239 "//aos/network/www:aos_plotter",
240 "//aos/network/www:colors",
241 "//aos/network/www:proxy",
242 ],
243)
Filip Kujawa9cf6c0f2024-03-02 15:05:59 -0800244
245cc_library(
246 name = "led_indicator_lib",
247 srcs = ["led_indicator.cc"],
248 hdrs = ["led_indicator.h"],
249 data = [
250 "@ctre_phoenix_api_cpp_athena//:shared_libraries",
251 "@ctre_phoenix_cci_athena//:shared_libraries",
252 ],
253 target_compatible_with = ["//tools/platforms/hardware:roborio"],
254 deps = [
255 ":superstructure_output_fbs",
256 ":superstructure_position_fbs",
257 ":superstructure_status_fbs",
258 "//aos/events:event_loop",
259 "//aos/network:message_bridge_client_fbs",
260 "//aos/network:message_bridge_server_fbs",
261 "//frc971/control_loops:control_loop",
262 "//frc971/control_loops:control_loops_fbs",
263 "//frc971/control_loops:profiled_subsystem_fbs",
264 "//frc971/control_loops/drivetrain:drivetrain_output_fbs",
265 "//frc971/control_loops/drivetrain:drivetrain_status_fbs",
266 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
267 "//frc971/queues:gyro_fbs",
268 "//third_party:phoenix",
269 "//third_party:wpilib",
270 ],
271)