blob: ef300e3be7d9da2ba46a306dda745a121e7bdd87 [file] [log] [blame]
Filip Kujawa3004f202023-02-12 16:41:40 -08001load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
Maxwell Hendersonbf1bcec2023-03-05 18:00:20 -08002load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library")
Filip Kujawadc7d47c2023-04-08 16:16:51 -07003load("//tools/build_rules:select.bzl", "cpu_select")
Filip Kujawa3004f202023-02-12 16:41:40 -08004
Austin Schuhdb2ed9d2022-12-26 14:02:26 -08005cc_binary(
6 name = "camera_reader",
7 srcs = [
8 "camera_reader.cc",
Ravago Jonese8700072023-01-14 19:41:56 -08009 "rkisp1-config.h",
Austin Schuhdb2ed9d2022-12-26 14:02:26 -080010 ],
Ravago Jonese8700072023-01-14 19:41:56 -080011 target_compatible_with = [
12 "@platforms//os:linux",
13 "//tools/platforms/hardware:raspberry_pi",
14 ],
Austin Schuhdb2ed9d2022-12-26 14:02:26 -080015 visibility = ["//y2023:__subpackages__"],
16 deps = [
17 "//aos:init",
18 "//aos/events:shm_event_loop",
19 "//frc971/vision:media_device",
20 "//frc971/vision:v4l2_reader",
21 ],
22)
23
24cc_binary(
25 name = "viewer",
26 srcs = [
27 "viewer.cc",
28 ],
29 target_compatible_with = ["@platforms//os:linux"],
30 visibility = ["//y2023:__subpackages__"],
31 deps = [
32 "//aos:init",
Ravago Jones17e13a22023-01-28 17:12:11 -080033 "//aos:json_to_flatbuffer",
Austin Schuhdb2ed9d2022-12-26 14:02:26 -080034 "//aos/events:shm_event_loop",
milind-uc3cf9752023-02-20 23:07:30 -080035 "//frc971/constants:constants_sender_lib",
Austin Schuhdb2ed9d2022-12-26 14:02:26 -080036 "//frc971/vision:vision_fbs",
37 "//third_party:opencv",
milind-uc3cf9752023-02-20 23:07:30 -080038 "//y2023/vision:vision_util",
Ravago Jones17e13a22023-01-28 17:12:11 -080039 "@com_google_absl//absl/strings",
Austin Schuhdb2ed9d2022-12-26 14:02:26 -080040 ],
41)
milind-u16e3a082023-01-21 13:53:43 -080042
43cc_binary(
milind-ud4051fe2023-02-25 18:00:05 -080044 name = "localization_verifier",
45 srcs = [
46 "localization_verifier.cc",
47 ],
48 target_compatible_with = ["@platforms//os:linux"],
49 visibility = ["//y2023:__subpackages__"],
50 deps = [
51 "//aos:init",
52 "//aos/events:shm_event_loop",
53 "//frc971/constants:constants_sender_lib",
54 "//frc971/control_loops/drivetrain/localization:localizer_output_fbs",
55 "//frc971/vision:vision_fbs",
56 "//y2023/localizer",
milind-u607f3232023-02-26 15:22:40 -080057 "//y2023/localizer:utils",
milind-ud4051fe2023-02-25 18:00:05 -080058 "//y2023/vision:vision_util",
59 "@com_google_absl//absl/strings",
60 ],
61)
62
63cc_binary(
milind-u16e3a082023-01-21 13:53:43 -080064 name = "target_mapping",
65 srcs = [
66 "target_mapping.cc",
67 ],
68 data = [
69 "//y2023:aos_config",
milind-uc5a494f2023-02-24 15:39:22 -080070 "//y2023/constants:constants.json",
71 "//y2023/vision:maps",
milind-u16e3a082023-01-21 13:53:43 -080072 ],
73 target_compatible_with = ["@platforms//os:linux"],
74 visibility = ["//y2023:__subpackages__"],
75 deps = [
milind-u09fb1252023-01-28 19:21:41 -080076 ":aprilrobotics_lib",
milind-u16e3a082023-01-21 13:53:43 -080077 "//aos:init",
78 "//aos/events:simulated_event_loop",
79 "//aos/events/logging:log_reader",
Jim Ostrowski68965cd2023-03-01 20:32:51 -080080 "//aos/util:mcap_logger",
James Kuszmauld67f6d22023-02-05 17:37:25 -080081 "//frc971/constants:constants_sender_lib",
milind-u16e3a082023-01-21 13:53:43 -080082 "//frc971/control_loops:pose",
83 "//frc971/vision:calibration_fbs",
84 "//frc971/vision:charuco_lib",
85 "//frc971/vision:target_mapper",
Jim Ostrowski2f2685f2023-03-25 11:57:54 -070086 "//frc971/vision:visualize_robot",
milind-u16e3a082023-01-21 13:53:43 -080087 "//third_party:opencv",
James Kuszmauld67f6d22023-02-05 17:37:25 -080088 "//y2023/constants:constants_fbs",
milind-uc5a494f2023-02-24 15:39:22 -080089 "//y2023/constants:simulated_constants_sender",
James Kuszmauld67f6d22023-02-05 17:37:25 -080090 ],
91)
92
93cc_library(
94 name = "vision_util",
95 srcs = ["vision_util.cc"],
96 hdrs = ["vision_util.h"],
97 deps = [
milind-uf2a4e322023-02-01 19:33:10 -080098 "//third_party:opencv",
James Kuszmauld67f6d22023-02-05 17:37:25 -080099 "//y2023/constants:constants_fbs",
100 "@com_github_google_glog//:glog",
milind-u16e3a082023-01-21 13:53:43 -0800101 ],
102)
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800103
Ravago Jonesb84f2062023-01-29 13:46:59 -0800104cc_library(
105 name = "aprilrobotics_lib",
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800106 srcs = [
107 "aprilrobotics.cc",
108 "aprilrobotics.h",
109 ],
110 target_compatible_with = ["@platforms//os:linux"],
111 visibility = ["//y2023:__subpackages__"],
112 deps = [
James Kuszmauld67f6d22023-02-05 17:37:25 -0800113 ":vision_util",
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800114 "//aos:init",
115 "//aos/events:shm_event_loop",
James Kuszmauld67f6d22023-02-05 17:37:25 -0800116 "//frc971/constants:constants_sender_lib",
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800117 "//frc971/vision:calibration_fbs",
118 "//frc971/vision:charuco_lib",
119 "//frc971/vision:target_map_fbs",
120 "//frc971/vision:target_mapper",
121 "//frc971/vision:vision_fbs",
Jim Ostrowski49be8232023-03-23 01:00:14 -0700122 "//frc971/vision:visualize_robot",
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800123 "//third_party:opencv",
124 "//third_party/apriltag",
James Kuszmauld67f6d22023-02-05 17:37:25 -0800125 "//y2023/constants:constants_fbs",
Philipp Schrader790cb542023-07-05 21:06:52 -0700126 "@org_tuxfamily_eigen//:eigen",
Maxwell Hendersonfebee252023-01-28 16:53:52 -0800127 ],
128)
Ravago Jonesb84f2062023-01-29 13:46:59 -0800129
130cc_binary(
131 name = "aprilrobotics",
132 srcs = [
133 "aprilrobotics_main.cc",
134 ],
135 target_compatible_with = ["@platforms//os:linux"],
136 visibility = ["//y2023:__subpackages__"],
137 deps = [
138 ":aprilrobotics_lib",
139 "//aos:init",
140 "//aos/events:shm_event_loop",
141 ],
142)
James Kuszmaul77d536c2023-02-11 17:30:59 -0800143
Yash Chainani10b7b022023-02-22 14:34:04 -0800144cc_test(
145 name = "april_detection_test",
146 srcs = [
147 "april_detection_test.cc",
148 ],
149 data = [
150 "//y2023:aos_config",
151 "//y2023/constants:constants.json",
152 "@apriltag_test_bfbs_images",
153 ],
154 deps = [
155 ":aprilrobotics_lib",
156 "//aos:flatbuffer_merge",
157 "//aos:json_to_flatbuffer",
158 "//aos/events:simulated_event_loop",
159 "//aos/testing:googletest",
160 "//aos/testing:path",
161 "//aos/testing:test_logging",
162 "//frc971/constants:constants_sender_lib",
163 "//frc971/vision:target_mapper",
164 "//frc971/vision:vision_fbs",
165 "//y2023/constants:constants_fbs",
166 "//y2023/constants:constants_list_fbs",
167 ],
168)
169
milind-u8e98cb92023-02-05 16:07:10 -0800170filegroup(
171 name = "image_streamer_start",
172 srcs = ["image_streamer_start.sh"],
173 visibility = ["//visibility:public"],
174)
175
James Kuszmaul77d536c2023-02-11 17:30:59 -0800176cc_binary(
177 name = "foxglove_image_converter",
178 srcs = ["foxglove_image_converter.cc"],
179 visibility = ["//y2023:__subpackages__"],
180 deps = [
181 "//aos:init",
182 "//aos/events:shm_event_loop",
183 "//frc971/vision:foxglove_image_converter_lib",
184 ],
185)
James Kuszmauld6199be2023-02-11 19:56:28 -0800186
187cc_binary(
188 name = "calibrate_extrinsics",
189 srcs = [
190 "calibrate_extrinsics.cc",
191 ],
192 target_compatible_with = ["@platforms//os:linux"],
193 deps = [
194 "//aos:init",
195 "//aos/events/logging:log_reader",
196 "//frc971/constants:constants_sender_lib",
197 "//frc971/control_loops:profiled_subsystem_fbs",
198 "//frc971/vision:extrinsics_calibration",
199 "//third_party:opencv",
200 "//y2023/constants:constants_fbs",
201 "//y2023/vision:vision_util",
202 ],
203)
Filip Kujawa3004f202023-02-12 16:41:40 -0800204
205cc_binary(
Jim Ostrowski2f2685f2023-03-25 11:57:54 -0700206 name = "calibrate_multi_cameras",
207 srcs = [
208 "calibrate_multi_cameras.cc",
209 ],
210 data = [
211 "//y2023:aos_config",
212 "//y2023/constants:constants.json",
213 "//y2023/vision:maps",
214 ],
215 target_compatible_with = ["@platforms//os:linux"],
216 visibility = ["//y2023:__subpackages__"],
217 deps = [
218 ":aprilrobotics_lib",
219 "//aos:init",
220 "//aos/events:simulated_event_loop",
221 "//aos/events/logging:log_reader",
222 "//aos/util:mcap_logger",
223 "//frc971/constants:constants_sender_lib",
224 "//frc971/control_loops:pose",
225 "//frc971/vision:calibration_fbs",
226 "//frc971/vision:charuco_lib",
227 "//frc971/vision:target_mapper",
228 "//third_party:opencv",
229 "//y2023/constants:constants_fbs",
230 "//y2023/constants:simulated_constants_sender",
231 "@org_tuxfamily_eigen//:eigen",
232 ],
233)
234
235cc_binary(
Filip Kujawa3004f202023-02-12 16:41:40 -0800236 name = "game_pieces_detector",
237 srcs = [
238 "game_pieces_main.cc",
239 ],
240 target_compatible_with = ["@platforms//os:linux"],
241 visibility = ["//y2023:__subpackages__"],
242 deps = [
243 ":game_pieces_lib",
244 "//aos:init",
245 "//aos/events:shm_event_loop",
246 ],
247)
248
249cc_library(
250 name = "game_pieces_lib",
251 srcs = [
252 "game_pieces.cc",
253 ],
254 hdrs = [
255 "game_pieces.h",
256 ],
257 data = [
258 "//y2023:aos_config",
Filip Kujawa8c76e5d2023-04-08 16:20:27 -0700259 "@game_pieces_edgetpu_model//file",
Filip Kujawa3004f202023-02-12 16:41:40 -0800260 ],
261 target_compatible_with = ["@platforms//os:linux"],
262 visibility = ["//y2023:__subpackages__"],
263 deps = [
264 ":game_pieces_fbs",
Filip Kujawa8c76e5d2023-04-08 16:20:27 -0700265 ":yolov5_lib",
Filip Kujawa3004f202023-02-12 16:41:40 -0800266 "//aos/events:event_loop",
267 "//aos/events:shm_event_loop",
268 "//frc971/vision:vision_fbs",
269 ],
270)
271
272flatbuffer_cc_library(
273 name = "game_pieces_fbs",
274 srcs = ["game_pieces.fbs"],
275 gen_reflections = 1,
276 target_compatible_with = ["@platforms//os:linux"],
277 visibility = ["//visibility:public"],
278)
Maxwell Hendersonbf1bcec2023-03-05 18:00:20 -0800279
280flatbuffer_ts_library(
281 name = "game_pieces_ts_fbs",
282 srcs = ["game_pieces.fbs"],
283 target_compatible_with = ["@platforms//os:linux"],
284 visibility = ["//visibility:public"],
285)
milind-ua96c5182023-03-10 23:31:11 -0800286
287cc_binary(
288 name = "image_logger",
289 srcs = [
290 "image_logger.cc",
291 ],
292 target_compatible_with = ["@platforms//os:linux"],
293 visibility = ["//visibility:public"],
294 deps = [
295 "//aos:configuration",
296 "//aos:init",
297 "//aos/events:shm_event_loop",
298 "//aos/events/logging:log_writer",
299 "//aos/logging:log_namer",
300 "//frc971/input:joystick_state_fbs",
301 "@com_github_gflags_gflags//:gflags",
302 "@com_github_google_glog//:glog",
303 ],
304)
Filip Kujawadc7d47c2023-04-08 16:16:51 -0700305
306cc_library(
307 name = "yolov5_lib",
308 srcs = ["yolov5.cc"],
309 hdrs = ["yolov5.h"],
Filip Kujawa8c76e5d2023-04-08 16:20:27 -0700310 copts = ["-Wno-unused-parameter"],
Filip Kujawadc7d47c2023-04-08 16:16:51 -0700311 deps = [
312 "//third_party:opencv",
313 "@com_github_gflags_gflags//:gflags",
314 "@com_github_google_glog//:glog",
Filip Kujawaf3b8adb2023-04-07 21:00:49 -0700315 "@com_google_absl//absl/types:span",
Filip Kujawadc7d47c2023-04-08 16:16:51 -0700316 ] + cpu_select({
317 "amd64": [
318 "@libtensorflowlite//:tensorflow-k8",
319 "@libedgetpu//:libedgetpu-k8",
320 ],
321 "arm": [
322 "@libtensorflowlite//:tensorflow-arm",
323 "@libedgetpu//:libedgetpu-arm",
324 ],
325 }),
326)
Filip Kujawaec433e12023-04-09 19:58:59 -0700327
328filegroup(
329 name = "game_pieces_detector_starter",
330 srcs = ["game_pieces_detector_starter.sh"],
331 visibility = ["//visibility:public"],
332)
James Kuszmaul910fbe42023-04-09 16:18:40 -0700333
334cc_library(
335 name = "camera_monitor_lib",
336 srcs = ["camera_monitor_lib.cc"],
337 hdrs = ["camera_monitor_lib.h"],
338 deps = [
339 "//aos/events:event_loop",
340 "//aos/starter:starter_rpc_lib",
341 "//frc971/vision:vision_fbs",
342 ],
343)
344
345cc_binary(
346 name = "camera_monitor",
347 srcs = ["camera_monitor.cc"],
348 visibility = ["//visibility:public"],
349 deps = [
350 ":camera_monitor_lib",
351 "//aos:init",
352 "//aos/events:shm_event_loop",
353 ],
354)