Maxwell Henderson | 5e7696f | 2023-01-29 12:14:27 -0800 | [diff] [blame^] | 1 | load("//frc971:halide.bzl", "halide_library") |
| 2 | load("//tools/build_rules:select.bzl", "cpu_select") |
Filip Kujawa | 3004f20 | 2023-02-12 16:41:40 -0800 | [diff] [blame] | 3 | load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library") |
Maxwell Henderson | bf1bcec | 2023-03-05 18:00:20 -0800 | [diff] [blame] | 4 | load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library") |
Filip Kujawa | 3004f20 | 2023-02-12 16:41:40 -0800 | [diff] [blame] | 5 | |
Austin Schuh | db2ed9d | 2022-12-26 14:02:26 -0800 | [diff] [blame] | 6 | cc_binary( |
| 7 | name = "camera_reader", |
| 8 | srcs = [ |
| 9 | "camera_reader.cc", |
Ravago Jones | e870007 | 2023-01-14 19:41:56 -0800 | [diff] [blame] | 10 | "rkisp1-config.h", |
Austin Schuh | db2ed9d | 2022-12-26 14:02:26 -0800 | [diff] [blame] | 11 | ], |
Ravago Jones | e870007 | 2023-01-14 19:41:56 -0800 | [diff] [blame] | 12 | target_compatible_with = [ |
| 13 | "@platforms//os:linux", |
| 14 | "//tools/platforms/hardware:raspberry_pi", |
| 15 | ], |
Austin Schuh | db2ed9d | 2022-12-26 14:02:26 -0800 | [diff] [blame] | 16 | visibility = ["//y2023:__subpackages__"], |
| 17 | deps = [ |
| 18 | "//aos:init", |
| 19 | "//aos/events:shm_event_loop", |
| 20 | "//frc971/vision:media_device", |
| 21 | "//frc971/vision:v4l2_reader", |
| 22 | ], |
| 23 | ) |
| 24 | |
| 25 | cc_binary( |
| 26 | name = "viewer", |
| 27 | srcs = [ |
| 28 | "viewer.cc", |
| 29 | ], |
| 30 | target_compatible_with = ["@platforms//os:linux"], |
| 31 | visibility = ["//y2023:__subpackages__"], |
| 32 | deps = [ |
| 33 | "//aos:init", |
Ravago Jones | 17e13a2 | 2023-01-28 17:12:11 -0800 | [diff] [blame] | 34 | "//aos:json_to_flatbuffer", |
Austin Schuh | db2ed9d | 2022-12-26 14:02:26 -0800 | [diff] [blame] | 35 | "//aos/events:shm_event_loop", |
milind-u | c3cf975 | 2023-02-20 23:07:30 -0800 | [diff] [blame] | 36 | "//frc971/constants:constants_sender_lib", |
Austin Schuh | db2ed9d | 2022-12-26 14:02:26 -0800 | [diff] [blame] | 37 | "//frc971/vision:vision_fbs", |
| 38 | "//third_party:opencv", |
milind-u | c3cf975 | 2023-02-20 23:07:30 -0800 | [diff] [blame] | 39 | "//y2023/vision:vision_util", |
Ravago Jones | 17e13a2 | 2023-01-28 17:12:11 -0800 | [diff] [blame] | 40 | "@com_google_absl//absl/strings", |
Austin Schuh | db2ed9d | 2022-12-26 14:02:26 -0800 | [diff] [blame] | 41 | ], |
| 42 | ) |
milind-u | 16e3a08 | 2023-01-21 13:53:43 -0800 | [diff] [blame] | 43 | |
| 44 | cc_binary( |
milind-u | d4051fe | 2023-02-25 18:00:05 -0800 | [diff] [blame] | 45 | name = "localization_verifier", |
| 46 | srcs = [ |
| 47 | "localization_verifier.cc", |
| 48 | ], |
| 49 | target_compatible_with = ["@platforms//os:linux"], |
| 50 | visibility = ["//y2023:__subpackages__"], |
| 51 | deps = [ |
| 52 | "//aos:init", |
| 53 | "//aos/events:shm_event_loop", |
| 54 | "//frc971/constants:constants_sender_lib", |
| 55 | "//frc971/control_loops/drivetrain/localization:localizer_output_fbs", |
| 56 | "//frc971/vision:vision_fbs", |
| 57 | "//y2023/localizer", |
milind-u | 607f323 | 2023-02-26 15:22:40 -0800 | [diff] [blame] | 58 | "//y2023/localizer:utils", |
milind-u | d4051fe | 2023-02-25 18:00:05 -0800 | [diff] [blame] | 59 | "//y2023/vision:vision_util", |
| 60 | "@com_google_absl//absl/strings", |
| 61 | ], |
| 62 | ) |
| 63 | |
| 64 | cc_binary( |
milind-u | 16e3a08 | 2023-01-21 13:53:43 -0800 | [diff] [blame] | 65 | name = "target_mapping", |
| 66 | srcs = [ |
| 67 | "target_mapping.cc", |
| 68 | ], |
| 69 | data = [ |
| 70 | "//y2023:aos_config", |
milind-u | c5a494f | 2023-02-24 15:39:22 -0800 | [diff] [blame] | 71 | "//y2023/constants:constants.json", |
| 72 | "//y2023/vision:maps", |
milind-u | 16e3a08 | 2023-01-21 13:53:43 -0800 | [diff] [blame] | 73 | ], |
| 74 | target_compatible_with = ["@platforms//os:linux"], |
| 75 | visibility = ["//y2023:__subpackages__"], |
| 76 | deps = [ |
milind-u | 09fb125 | 2023-01-28 19:21:41 -0800 | [diff] [blame] | 77 | ":aprilrobotics_lib", |
milind-u | 16e3a08 | 2023-01-21 13:53:43 -0800 | [diff] [blame] | 78 | "//aos:init", |
| 79 | "//aos/events:simulated_event_loop", |
| 80 | "//aos/events/logging:log_reader", |
Jim Ostrowski | 68965cd | 2023-03-01 20:32:51 -0800 | [diff] [blame] | 81 | "//aos/util:mcap_logger", |
James Kuszmaul | d67f6d2 | 2023-02-05 17:37:25 -0800 | [diff] [blame] | 82 | "//frc971/constants:constants_sender_lib", |
milind-u | 16e3a08 | 2023-01-21 13:53:43 -0800 | [diff] [blame] | 83 | "//frc971/control_loops:pose", |
| 84 | "//frc971/vision:calibration_fbs", |
| 85 | "//frc971/vision:charuco_lib", |
| 86 | "//frc971/vision:target_mapper", |
Jim Ostrowski | 2f2685f | 2023-03-25 11:57:54 -0700 | [diff] [blame] | 87 | "//frc971/vision:visualize_robot", |
milind-u | 16e3a08 | 2023-01-21 13:53:43 -0800 | [diff] [blame] | 88 | "//third_party:opencv", |
James Kuszmaul | d67f6d2 | 2023-02-05 17:37:25 -0800 | [diff] [blame] | 89 | "//y2023/constants:constants_fbs", |
milind-u | c5a494f | 2023-02-24 15:39:22 -0800 | [diff] [blame] | 90 | "//y2023/constants:simulated_constants_sender", |
James Kuszmaul | d67f6d2 | 2023-02-05 17:37:25 -0800 | [diff] [blame] | 91 | ], |
| 92 | ) |
| 93 | |
| 94 | cc_library( |
| 95 | name = "vision_util", |
| 96 | srcs = ["vision_util.cc"], |
| 97 | hdrs = ["vision_util.h"], |
| 98 | deps = [ |
milind-u | f2a4e32 | 2023-02-01 19:33:10 -0800 | [diff] [blame] | 99 | "//third_party:opencv", |
James Kuszmaul | d67f6d2 | 2023-02-05 17:37:25 -0800 | [diff] [blame] | 100 | "//y2023/constants:constants_fbs", |
| 101 | "@com_github_google_glog//:glog", |
milind-u | 16e3a08 | 2023-01-21 13:53:43 -0800 | [diff] [blame] | 102 | ], |
| 103 | ) |
Maxwell Henderson | febee25 | 2023-01-28 16:53:52 -0800 | [diff] [blame] | 104 | |
Maxwell Henderson | 5e7696f | 2023-01-29 12:14:27 -0800 | [diff] [blame^] | 105 | halide_library( |
| 106 | name = "ToGreyscaleAndDecimateHalide", |
| 107 | src = "april_generator.cc", |
| 108 | args = "rows=720 cols=1280", |
| 109 | function = "decimate_generator", |
| 110 | visibility = ["//visibility:public"], |
| 111 | ) |
| 112 | |
| 113 | halide_library( |
| 114 | name = "ThresholdHalide", |
| 115 | src = "april_generator.cc", |
| 116 | args = "rows=360 cols=640", |
| 117 | function = "threshold_generator", |
| 118 | visibility = ["//visibility:public"], |
| 119 | ) |
| 120 | |
Ravago Jones | b84f206 | 2023-01-29 13:46:59 -0800 | [diff] [blame] | 121 | cc_library( |
| 122 | name = "aprilrobotics_lib", |
Maxwell Henderson | febee25 | 2023-01-28 16:53:52 -0800 | [diff] [blame] | 123 | srcs = [ |
| 124 | "aprilrobotics.cc", |
| 125 | "aprilrobotics.h", |
| 126 | ], |
| 127 | target_compatible_with = ["@platforms//os:linux"], |
| 128 | visibility = ["//y2023:__subpackages__"], |
| 129 | deps = [ |
James Kuszmaul | d67f6d2 | 2023-02-05 17:37:25 -0800 | [diff] [blame] | 130 | ":vision_util", |
Maxwell Henderson | febee25 | 2023-01-28 16:53:52 -0800 | [diff] [blame] | 131 | "//aos:init", |
| 132 | "//aos/events:shm_event_loop", |
James Kuszmaul | d67f6d2 | 2023-02-05 17:37:25 -0800 | [diff] [blame] | 133 | "//frc971/constants:constants_sender_lib", |
Maxwell Henderson | febee25 | 2023-01-28 16:53:52 -0800 | [diff] [blame] | 134 | "//frc971/vision:calibration_fbs", |
| 135 | "//frc971/vision:charuco_lib", |
| 136 | "//frc971/vision:target_map_fbs", |
| 137 | "//frc971/vision:target_mapper", |
| 138 | "//frc971/vision:vision_fbs", |
Jim Ostrowski | 49be823 | 2023-03-23 01:00:14 -0700 | [diff] [blame] | 139 | "//frc971/vision:visualize_robot", |
Maxwell Henderson | febee25 | 2023-01-28 16:53:52 -0800 | [diff] [blame] | 140 | "//third_party:opencv", |
| 141 | "//third_party/apriltag", |
James Kuszmaul | d67f6d2 | 2023-02-05 17:37:25 -0800 | [diff] [blame] | 142 | "//y2023/constants:constants_fbs", |
Philipp Schrader | 790cb54 | 2023-07-05 21:06:52 -0700 | [diff] [blame] | 143 | "@org_tuxfamily_eigen//:eigen", |
Maxwell Henderson | febee25 | 2023-01-28 16:53:52 -0800 | [diff] [blame] | 144 | ], |
| 145 | ) |
Ravago Jones | b84f206 | 2023-01-29 13:46:59 -0800 | [diff] [blame] | 146 | |
| 147 | cc_binary( |
| 148 | name = "aprilrobotics", |
| 149 | srcs = [ |
| 150 | "aprilrobotics_main.cc", |
| 151 | ], |
| 152 | target_compatible_with = ["@platforms//os:linux"], |
| 153 | visibility = ["//y2023:__subpackages__"], |
| 154 | deps = [ |
| 155 | ":aprilrobotics_lib", |
| 156 | "//aos:init", |
| 157 | "//aos/events:shm_event_loop", |
| 158 | ], |
| 159 | ) |
James Kuszmaul | 77d536c | 2023-02-11 17:30:59 -0800 | [diff] [blame] | 160 | |
Yash Chainani | 10b7b02 | 2023-02-22 14:34:04 -0800 | [diff] [blame] | 161 | cc_test( |
| 162 | name = "april_detection_test", |
| 163 | srcs = [ |
| 164 | "april_detection_test.cc", |
| 165 | ], |
| 166 | data = [ |
| 167 | "//y2023:aos_config", |
| 168 | "//y2023/constants:constants.json", |
| 169 | "@apriltag_test_bfbs_images", |
| 170 | ], |
| 171 | deps = [ |
| 172 | ":aprilrobotics_lib", |
| 173 | "//aos:flatbuffer_merge", |
| 174 | "//aos:json_to_flatbuffer", |
| 175 | "//aos/events:simulated_event_loop", |
| 176 | "//aos/testing:googletest", |
| 177 | "//aos/testing:path", |
| 178 | "//aos/testing:test_logging", |
| 179 | "//frc971/constants:constants_sender_lib", |
| 180 | "//frc971/vision:target_mapper", |
| 181 | "//frc971/vision:vision_fbs", |
| 182 | "//y2023/constants:constants_fbs", |
| 183 | "//y2023/constants:constants_list_fbs", |
| 184 | ], |
| 185 | ) |
| 186 | |
milind-u | 8e98cb9 | 2023-02-05 16:07:10 -0800 | [diff] [blame] | 187 | filegroup( |
| 188 | name = "image_streamer_start", |
| 189 | srcs = ["image_streamer_start.sh"], |
| 190 | visibility = ["//visibility:public"], |
| 191 | ) |
| 192 | |
James Kuszmaul | 77d536c | 2023-02-11 17:30:59 -0800 | [diff] [blame] | 193 | cc_binary( |
| 194 | name = "foxglove_image_converter", |
| 195 | srcs = ["foxglove_image_converter.cc"], |
| 196 | visibility = ["//y2023:__subpackages__"], |
| 197 | deps = [ |
| 198 | "//aos:init", |
| 199 | "//aos/events:shm_event_loop", |
| 200 | "//frc971/vision:foxglove_image_converter_lib", |
| 201 | ], |
| 202 | ) |
James Kuszmaul | d6199be | 2023-02-11 19:56:28 -0800 | [diff] [blame] | 203 | |
| 204 | cc_binary( |
| 205 | name = "calibrate_extrinsics", |
| 206 | srcs = [ |
| 207 | "calibrate_extrinsics.cc", |
| 208 | ], |
| 209 | target_compatible_with = ["@platforms//os:linux"], |
| 210 | deps = [ |
| 211 | "//aos:init", |
| 212 | "//aos/events/logging:log_reader", |
| 213 | "//frc971/constants:constants_sender_lib", |
| 214 | "//frc971/control_loops:profiled_subsystem_fbs", |
| 215 | "//frc971/vision:extrinsics_calibration", |
| 216 | "//third_party:opencv", |
| 217 | "//y2023/constants:constants_fbs", |
| 218 | "//y2023/vision:vision_util", |
| 219 | ], |
| 220 | ) |
Filip Kujawa | 3004f20 | 2023-02-12 16:41:40 -0800 | [diff] [blame] | 221 | |
| 222 | cc_binary( |
Jim Ostrowski | 2f2685f | 2023-03-25 11:57:54 -0700 | [diff] [blame] | 223 | name = "calibrate_multi_cameras", |
| 224 | srcs = [ |
| 225 | "calibrate_multi_cameras.cc", |
| 226 | ], |
| 227 | data = [ |
| 228 | "//y2023:aos_config", |
| 229 | "//y2023/constants:constants.json", |
| 230 | "//y2023/vision:maps", |
| 231 | ], |
| 232 | target_compatible_with = ["@platforms//os:linux"], |
| 233 | visibility = ["//y2023:__subpackages__"], |
| 234 | deps = [ |
| 235 | ":aprilrobotics_lib", |
| 236 | "//aos:init", |
| 237 | "//aos/events:simulated_event_loop", |
| 238 | "//aos/events/logging:log_reader", |
| 239 | "//aos/util:mcap_logger", |
| 240 | "//frc971/constants:constants_sender_lib", |
| 241 | "//frc971/control_loops:pose", |
| 242 | "//frc971/vision:calibration_fbs", |
| 243 | "//frc971/vision:charuco_lib", |
| 244 | "//frc971/vision:target_mapper", |
| 245 | "//third_party:opencv", |
| 246 | "//y2023/constants:constants_fbs", |
| 247 | "//y2023/constants:simulated_constants_sender", |
| 248 | "@org_tuxfamily_eigen//:eigen", |
| 249 | ], |
| 250 | ) |
| 251 | |
| 252 | cc_binary( |
Filip Kujawa | 3004f20 | 2023-02-12 16:41:40 -0800 | [diff] [blame] | 253 | name = "game_pieces_detector", |
| 254 | srcs = [ |
| 255 | "game_pieces_main.cc", |
| 256 | ], |
| 257 | target_compatible_with = ["@platforms//os:linux"], |
| 258 | visibility = ["//y2023:__subpackages__"], |
| 259 | deps = [ |
| 260 | ":game_pieces_lib", |
| 261 | "//aos:init", |
| 262 | "//aos/events:shm_event_loop", |
| 263 | ], |
| 264 | ) |
| 265 | |
| 266 | cc_library( |
| 267 | name = "game_pieces_lib", |
| 268 | srcs = [ |
| 269 | "game_pieces.cc", |
| 270 | ], |
| 271 | hdrs = [ |
| 272 | "game_pieces.h", |
| 273 | ], |
| 274 | data = [ |
| 275 | "//y2023:aos_config", |
Filip Kujawa | 8c76e5d | 2023-04-08 16:20:27 -0700 | [diff] [blame] | 276 | "@game_pieces_edgetpu_model//file", |
Filip Kujawa | 3004f20 | 2023-02-12 16:41:40 -0800 | [diff] [blame] | 277 | ], |
| 278 | target_compatible_with = ["@platforms//os:linux"], |
| 279 | visibility = ["//y2023:__subpackages__"], |
| 280 | deps = [ |
| 281 | ":game_pieces_fbs", |
Filip Kujawa | 8c76e5d | 2023-04-08 16:20:27 -0700 | [diff] [blame] | 282 | ":yolov5_lib", |
Filip Kujawa | 3004f20 | 2023-02-12 16:41:40 -0800 | [diff] [blame] | 283 | "//aos/events:event_loop", |
| 284 | "//aos/events:shm_event_loop", |
| 285 | "//frc971/vision:vision_fbs", |
| 286 | ], |
| 287 | ) |
| 288 | |
| 289 | flatbuffer_cc_library( |
| 290 | name = "game_pieces_fbs", |
| 291 | srcs = ["game_pieces.fbs"], |
| 292 | gen_reflections = 1, |
| 293 | target_compatible_with = ["@platforms//os:linux"], |
| 294 | visibility = ["//visibility:public"], |
| 295 | ) |
Maxwell Henderson | bf1bcec | 2023-03-05 18:00:20 -0800 | [diff] [blame] | 296 | |
| 297 | flatbuffer_ts_library( |
| 298 | name = "game_pieces_ts_fbs", |
| 299 | srcs = ["game_pieces.fbs"], |
| 300 | target_compatible_with = ["@platforms//os:linux"], |
| 301 | visibility = ["//visibility:public"], |
| 302 | ) |
milind-u | a96c518 | 2023-03-10 23:31:11 -0800 | [diff] [blame] | 303 | |
| 304 | cc_binary( |
| 305 | name = "image_logger", |
| 306 | srcs = [ |
| 307 | "image_logger.cc", |
| 308 | ], |
| 309 | target_compatible_with = ["@platforms//os:linux"], |
| 310 | visibility = ["//visibility:public"], |
| 311 | deps = [ |
| 312 | "//aos:configuration", |
| 313 | "//aos:init", |
| 314 | "//aos/events:shm_event_loop", |
| 315 | "//aos/events/logging:log_writer", |
| 316 | "//aos/logging:log_namer", |
| 317 | "//frc971/input:joystick_state_fbs", |
| 318 | "@com_github_gflags_gflags//:gflags", |
| 319 | "@com_github_google_glog//:glog", |
| 320 | ], |
| 321 | ) |
Filip Kujawa | dc7d47c | 2023-04-08 16:16:51 -0700 | [diff] [blame] | 322 | |
| 323 | cc_library( |
| 324 | name = "yolov5_lib", |
| 325 | srcs = ["yolov5.cc"], |
| 326 | hdrs = ["yolov5.h"], |
| 327 | deps = [ |
| 328 | "//third_party:opencv", |
| 329 | "@com_github_gflags_gflags//:gflags", |
| 330 | "@com_github_google_glog//:glog", |
Filip Kujawa | f3b8adb | 2023-04-07 21:00:49 -0700 | [diff] [blame] | 331 | "@com_google_absl//absl/types:span", |
Filip Kujawa | dc7d47c | 2023-04-08 16:16:51 -0700 | [diff] [blame] | 332 | ] + cpu_select({ |
| 333 | "amd64": [ |
| 334 | "@libtensorflowlite//:tensorflow-k8", |
| 335 | "@libedgetpu//:libedgetpu-k8", |
| 336 | ], |
| 337 | "arm": [ |
| 338 | "@libtensorflowlite//:tensorflow-arm", |
| 339 | "@libedgetpu//:libedgetpu-arm", |
| 340 | ], |
| 341 | }), |
| 342 | ) |
Filip Kujawa | ec433e1 | 2023-04-09 19:58:59 -0700 | [diff] [blame] | 343 | |
| 344 | filegroup( |
| 345 | name = "game_pieces_detector_starter", |
| 346 | srcs = ["game_pieces_detector_starter.sh"], |
| 347 | visibility = ["//visibility:public"], |
| 348 | ) |
James Kuszmaul | 910fbe4 | 2023-04-09 16:18:40 -0700 | [diff] [blame] | 349 | |
| 350 | cc_library( |
| 351 | name = "camera_monitor_lib", |
| 352 | srcs = ["camera_monitor_lib.cc"], |
| 353 | hdrs = ["camera_monitor_lib.h"], |
| 354 | deps = [ |
| 355 | "//aos/events:event_loop", |
| 356 | "//aos/starter:starter_rpc_lib", |
| 357 | "//frc971/vision:vision_fbs", |
| 358 | ], |
| 359 | ) |
| 360 | |
| 361 | cc_binary( |
| 362 | name = "camera_monitor", |
| 363 | srcs = ["camera_monitor.cc"], |
| 364 | visibility = ["//visibility:public"], |
| 365 | deps = [ |
| 366 | ":camera_monitor_lib", |
| 367 | "//aos:init", |
| 368 | "//aos/events:shm_event_loop", |
| 369 | ], |
| 370 | ) |