blob: 650fa9952ac7e4fc874b79b81cbc1cc67affe035 [file] [log] [blame]
Austin Schuh8f99c822024-05-05 22:43:40 -07001load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library")
James Kuszmaulf01da392023-12-14 11:22:14 -08002load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
Philipp Schrader3de4dfc2023-02-15 20:18:25 -08003load("//tools/build_rules:js.bzl", "ts_project")
milind-u086d7262022-01-19 20:44:18 -08004
5package(default_visibility = ["//visibility:public"])
6
James Kuszmaulf01da392023-12-14 11:22:14 -08007static_flatbuffer(
milind-u086d7262022-01-19 20:44:18 -08008 name = "superstructure_goal_fbs",
9 srcs = [
10 "superstructure_goal.fbs",
11 ],
James Kuszmaulf01da392023-12-14 11:22:14 -080012 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",
milind-u086d7262022-01-19 20:44:18 -080016 ],
17)
18
James Kuszmaulf01da392023-12-14 11:22:14 -080019static_flatbuffer(
milind-u086d7262022-01-19 20:44:18 -080020 name = "superstructure_output_fbs",
21 srcs = [
22 "superstructure_output.fbs",
23 ],
milind-u086d7262022-01-19 20:44:18 -080024)
25
James Kuszmaulf01da392023-12-14 11:22:14 -080026static_flatbuffer(
Milind Upadhyay482b0ba2022-02-26 21:51:59 -080027 name = "superstructure_can_position_fbs",
28 srcs = [
29 "superstructure_can_position.fbs",
30 ],
Milind Upadhyay482b0ba2022-02-26 21:51:59 -080031)
32
James Kuszmaulf01da392023-12-14 11:22:14 -080033static_flatbuffer(
milind-u086d7262022-01-19 20:44:18 -080034 name = "superstructure_status_fbs",
35 srcs = [
36 "superstructure_status.fbs",
37 ],
James Kuszmaulf01da392023-12-14 11:22:14 -080038 deps = [
39 "//frc971/control_loops:control_loops_fbs",
40 "//frc971/control_loops:profiled_subsystem_fbs",
milind-u086d7262022-01-19 20:44:18 -080041 ],
42)
43
Austin Schuh76f227c2022-02-23 16:34:08 -080044flatbuffer_ts_library(
45 name = "superstructure_status_ts_fbs",
46 srcs = [
47 "superstructure_status.fbs",
48 ],
James Kuszmauldac091f2022-03-22 09:35:06 -070049 deps = [
50 "//frc971/control_loops:control_loops_ts_fbs",
51 "//frc971/control_loops:profiled_subsystem_ts_fbs",
Austin Schuh76f227c2022-02-23 16:34:08 -080052 ],
Austin Schuh76f227c2022-02-23 16:34:08 -080053)
54
James Kuszmaulf01da392023-12-14 11:22:14 -080055static_flatbuffer(
milind-u086d7262022-01-19 20:44:18 -080056 name = "superstructure_position_fbs",
57 srcs = [
58 "superstructure_position.fbs",
59 ],
James Kuszmaulf01da392023-12-14 11:22:14 -080060 deps = [
61 "//frc971/control_loops:control_loops_fbs",
62 "//frc971/control_loops:profiled_subsystem_fbs",
milind-u086d7262022-01-19 20:44:18 -080063 ],
64)
65
66cc_library(
67 name = "superstructure_lib",
68 srcs = [
69 "superstructure.cc",
70 ],
71 hdrs = [
72 "superstructure.h",
73 ],
74 deps = [
Milind Upadhyay225156b2022-02-25 22:42:12 -080075 ":collision_avoidance_lib",
Ravago Jones5da06352022-03-04 20:26:24 -080076 ":superstructure_can_position_fbs",
milind-u086d7262022-01-19 20:44:18 -080077 ":superstructure_goal_fbs",
78 ":superstructure_output_fbs",
79 ":superstructure_position_fbs",
80 ":superstructure_status_fbs",
Ravago Jones3283ce02022-03-09 19:31:29 -080081 "//aos:flatbuffer_merge",
milind-u086d7262022-01-19 20:44:18 -080082 "//aos/events:event_loop",
83 "//frc971/control_loops:control_loop",
Nathan Leongdd728002024-02-03 15:26:53 -080084 "//frc971/control_loops/catapult",
Henry Speiser55aa3ba2022-02-21 23:21:12 -080085 "//frc971/control_loops/drivetrain:drivetrain_status_fbs",
James Kuszmaulec635d22023-08-12 18:39:24 -070086 "//frc971/zeroing:pot_and_absolute_encoder",
milind-u086d7262022-01-19 20:44:18 -080087 "//y2022:constants",
James Kuszmaul84083f42022-02-27 17:24:38 -080088 "//y2022/control_loops/superstructure/turret:aiming",
Ravago Jonesd51af7a2022-03-26 21:44:20 -070089 "//y2022/vision:ball_color_fbs",
milind-u086d7262022-01-19 20:44:18 -080090 ],
91)
92
93cc_binary(
94 name = "superstructure",
95 srcs = [
96 "superstructure_main.cc",
97 ],
98 deps = [
99 ":superstructure_lib",
100 "//aos:init",
101 "//aos/events:shm_event_loop",
102 ],
103)
104
105cc_test(
106 name = "superstructure_lib_test",
107 srcs = [
108 "superstructure_lib_test.cc",
109 ],
110 data = [
Austin Schuhc5fa6d92022-02-25 14:36:28 -0800111 "//y2022:aos_config",
milind-u086d7262022-01-19 20:44:18 -0800112 ],
113 deps = [
114 ":superstructure_goal_fbs",
115 ":superstructure_lib",
116 ":superstructure_output_fbs",
117 ":superstructure_position_fbs",
118 ":superstructure_status_fbs",
119 "//aos:math",
120 "//aos/events/logging:log_writer",
121 "//aos/testing:googletest",
122 "//aos/time",
123 "//frc971/control_loops:capped_test_plant",
124 "//frc971/control_loops:control_loop_test",
125 "//frc971/control_loops:position_sensor_sim",
Niko Sohmerse69ee2d2022-09-28 19:52:27 -0700126 "//frc971/control_loops:subsystem_simulator",
milind-u086d7262022-01-19 20:44:18 -0800127 "//frc971/control_loops:team_number_test_environment",
128 "//frc971/control_loops/drivetrain:drivetrain_status_fbs",
129 ],
130)
131
Milind Upadhyay9d68b132022-04-01 10:58:18 -0700132cc_binary(
133 name = "superstructure_replay",
134 srcs = ["superstructure_replay.cc"],
135 deps = [
136 ":superstructure_lib",
137 "//aos:configuration",
138 "//aos:init",
139 "//aos/events:simulated_event_loop",
140 "//aos/events/logging:log_reader",
141 "//aos/network:team_number",
142 ],
143)
144
Milind Upadhyay225156b2022-02-25 22:42:12 -0800145cc_library(
146 name = "collision_avoidance_lib",
147 srcs = ["collision_avoidance.cc"],
148 hdrs = ["collision_avoidance.h"],
149 target_compatible_with = ["@platforms//os:linux"],
150 deps = [
151 ":superstructure_goal_fbs",
152 ":superstructure_status_fbs",
153 "//frc971/control_loops:control_loops_fbs",
154 "//frc971/control_loops:profiled_subsystem_fbs",
Milind Upadhyay225156b2022-02-25 22:42:12 -0800155 "@com_google_absl//absl/functional:bind_front",
Austin Schuh99f7c6a2024-06-25 22:07:44 -0700156 "@com_google_absl//absl/log",
157 "@com_google_absl//absl/log:check",
Milind Upadhyay225156b2022-02-25 22:42:12 -0800158 ],
159)
160
161cc_test(
162 name = "collision_avoidance_test",
163 srcs = ["collision_avoidance_test.cc"],
164 target_compatible_with = ["@platforms//os:linux"],
165 deps = [
166 ":collision_avoidance_lib",
167 ":superstructure_goal_fbs",
168 ":superstructure_status_fbs",
169 "//aos:flatbuffers",
170 "//aos:math",
171 "//aos/testing:googletest",
172 ],
173)
174
Henry Speiser77747b72022-03-06 17:18:29 -0800175cc_library(
176 name = "led_indicator_lib",
177 srcs = ["led_indicator.cc"],
178 hdrs = ["led_indicator.h"],
179 data = [
180 "@ctre_phoenix_api_cpp_athena//:shared_libraries",
181 "@ctre_phoenix_cci_athena//:shared_libraries",
182 ],
183 target_compatible_with = ["//tools/platforms/hardware:roborio"],
184 deps = [
185 ":superstructure_output_fbs",
186 ":superstructure_status_fbs",
187 "//aos/events:event_loop",
Henry Speiser888c1962022-03-16 20:54:56 -0700188 "//aos/network:message_bridge_client_fbs",
Henry Speiser77747b72022-03-06 17:18:29 -0800189 "//aos/network:message_bridge_server_fbs",
190 "//frc971/control_loops:control_loop",
191 "//frc971/control_loops:control_loops_fbs",
192 "//frc971/control_loops:profiled_subsystem_fbs",
193 "//frc971/control_loops/drivetrain:drivetrain_output_fbs",
James Kuszmaule3df1ed2023-02-20 16:21:17 -0800194 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
Henry Speisere562e322022-04-01 16:09:32 -0700195 "//frc971/queues:gyro_fbs",
Henry Speiser77747b72022-03-06 17:18:29 -0800196 "//third_party:phoenix",
197 "//third_party:wpilib",
198 ],
199)
200
Philipp Schrader3de4dfc2023-02-15 20:18:25 -0800201ts_project(
milind-u086d7262022-01-19 20:44:18 -0800202 name = "superstructure_plotter",
203 srcs = ["superstructure_plotter.ts"],
204 target_compatible_with = ["@platforms//os:linux"],
205 deps = [
206 "//aos/network/www:aos_plotter",
207 "//aos/network/www:colors",
208 "//aos/network/www:proxy",
209 ],
210)
Austin Schuh76f227c2022-02-23 16:34:08 -0800211
Philipp Schrader3de4dfc2023-02-15 20:18:25 -0800212ts_project(
Austin Schuh76f227c2022-02-23 16:34:08 -0800213 name = "catapult_plotter",
214 srcs = ["catapult_plotter.ts"],
215 target_compatible_with = ["@platforms//os:linux"],
216 deps = [
217 "//aos/network/www:aos_plotter",
218 "//aos/network/www:colors",
219 "//aos/network/www:proxy",
220 ],
221)
Milind Upadhyayeb739bb2022-03-02 10:49:21 -0800222
Philipp Schrader3de4dfc2023-02-15 20:18:25 -0800223ts_project(
Milind Upadhyayeb739bb2022-03-02 10:49:21 -0800224 name = "intake_plotter",
225 srcs = ["intake_plotter.ts"],
226 target_compatible_with = ["@platforms//os:linux"],
227 deps = [
228 "//aos/network/www:aos_plotter",
229 "//aos/network/www:colors",
230 "//aos/network/www:proxy",
231 ],
232)
233
Philipp Schrader3de4dfc2023-02-15 20:18:25 -0800234ts_project(
Milind Upadhyayeb739bb2022-03-02 10:49:21 -0800235 name = "turret_plotter",
236 srcs = ["turret_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)
244
Philipp Schrader3de4dfc2023-02-15 20:18:25 -0800245ts_project(
Milind Upadhyayeb739bb2022-03-02 10:49:21 -0800246 name = "climber_plotter",
247 srcs = ["climber_plotter.ts"],
248 target_compatible_with = ["@platforms//os:linux"],
249 deps = [
250 "//aos/network/www:aos_plotter",
251 "//aos/network/www:colors",
252 "//aos/network/www:proxy",
253 ],
254)