Filip Kujawa | 3004f20 | 2023-02-12 16:41:40 -0800 | [diff] [blame] | 1 | load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library") |
Maxwell Henderson | bf1bcec | 2023-03-05 18:00:20 -0800 | [diff] [blame] | 2 | load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library") |
Filip Kujawa | dc7d47c | 2023-04-08 16:16:51 -0700 | [diff] [blame] | 3 | load("//tools/build_rules:select.bzl", "cpu_select") |
Filip Kujawa | 3004f20 | 2023-02-12 16:41:40 -0800 | [diff] [blame] | 4 | |
Austin Schuh | db2ed9d | 2022-12-26 14:02:26 -0800 | [diff] [blame] | 5 | cc_binary( |
| 6 | name = "camera_reader", |
| 7 | srcs = [ |
| 8 | "camera_reader.cc", |
Ravago Jones | e870007 | 2023-01-14 19:41:56 -0800 | [diff] [blame] | 9 | "rkisp1-config.h", |
Austin Schuh | db2ed9d | 2022-12-26 14:02:26 -0800 | [diff] [blame] | 10 | ], |
Ravago Jones | e870007 | 2023-01-14 19:41:56 -0800 | [diff] [blame] | 11 | target_compatible_with = [ |
| 12 | "@platforms//os:linux", |
| 13 | "//tools/platforms/hardware:raspberry_pi", |
| 14 | ], |
Austin Schuh | db2ed9d | 2022-12-26 14:02:26 -0800 | [diff] [blame] | 15 | 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 | |
| 24 | cc_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 Jones | 17e13a2 | 2023-01-28 17:12:11 -0800 | [diff] [blame] | 33 | "//aos:json_to_flatbuffer", |
Austin Schuh | db2ed9d | 2022-12-26 14:02:26 -0800 | [diff] [blame] | 34 | "//aos/events:shm_event_loop", |
milind-u | c3cf975 | 2023-02-20 23:07:30 -0800 | [diff] [blame] | 35 | "//frc971/constants:constants_sender_lib", |
Austin Schuh | db2ed9d | 2022-12-26 14:02:26 -0800 | [diff] [blame] | 36 | "//frc971/vision:vision_fbs", |
| 37 | "//third_party:opencv", |
milind-u | c3cf975 | 2023-02-20 23:07:30 -0800 | [diff] [blame] | 38 | "//y2023/vision:vision_util", |
Ravago Jones | 17e13a2 | 2023-01-28 17:12:11 -0800 | [diff] [blame] | 39 | "@com_google_absl//absl/strings", |
Austin Schuh | db2ed9d | 2022-12-26 14:02:26 -0800 | [diff] [blame] | 40 | ], |
| 41 | ) |
milind-u | 16e3a08 | 2023-01-21 13:53:43 -0800 | [diff] [blame] | 42 | |
| 43 | cc_binary( |
milind-u | d4051fe | 2023-02-25 18:00:05 -0800 | [diff] [blame] | 44 | 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-u | 607f323 | 2023-02-26 15:22:40 -0800 | [diff] [blame] | 57 | "//y2023/localizer:utils", |
milind-u | d4051fe | 2023-02-25 18:00:05 -0800 | [diff] [blame] | 58 | "//y2023/vision:vision_util", |
| 59 | "@com_google_absl//absl/strings", |
| 60 | ], |
| 61 | ) |
| 62 | |
| 63 | cc_binary( |
milind-u | 16e3a08 | 2023-01-21 13:53:43 -0800 | [diff] [blame] | 64 | name = "target_mapping", |
| 65 | srcs = [ |
| 66 | "target_mapping.cc", |
| 67 | ], |
| 68 | data = [ |
| 69 | "//y2023:aos_config", |
milind-u | c5a494f | 2023-02-24 15:39:22 -0800 | [diff] [blame] | 70 | "//y2023/constants:constants.json", |
| 71 | "//y2023/vision:maps", |
milind-u | 16e3a08 | 2023-01-21 13:53:43 -0800 | [diff] [blame] | 72 | ], |
| 73 | target_compatible_with = ["@platforms//os:linux"], |
| 74 | visibility = ["//y2023:__subpackages__"], |
| 75 | deps = [ |
milind-u | 09fb125 | 2023-01-28 19:21:41 -0800 | [diff] [blame] | 76 | ":aprilrobotics_lib", |
milind-u | 16e3a08 | 2023-01-21 13:53:43 -0800 | [diff] [blame] | 77 | "//aos:init", |
| 78 | "//aos/events:simulated_event_loop", |
| 79 | "//aos/events/logging:log_reader", |
Jim Ostrowski | 68965cd | 2023-03-01 20:32:51 -0800 | [diff] [blame] | 80 | "//aos/util:mcap_logger", |
James Kuszmaul | d67f6d2 | 2023-02-05 17:37:25 -0800 | [diff] [blame] | 81 | "//frc971/constants:constants_sender_lib", |
milind-u | 16e3a08 | 2023-01-21 13:53:43 -0800 | [diff] [blame] | 82 | "//frc971/control_loops:pose", |
| 83 | "//frc971/vision:calibration_fbs", |
| 84 | "//frc971/vision:charuco_lib", |
| 85 | "//frc971/vision:target_mapper", |
| 86 | "//third_party:opencv", |
James Kuszmaul | d67f6d2 | 2023-02-05 17:37:25 -0800 | [diff] [blame] | 87 | "//y2023/constants:constants_fbs", |
milind-u | c5a494f | 2023-02-24 15:39:22 -0800 | [diff] [blame] | 88 | "//y2023/constants:simulated_constants_sender", |
James Kuszmaul | d67f6d2 | 2023-02-05 17:37:25 -0800 | [diff] [blame] | 89 | ], |
| 90 | ) |
| 91 | |
| 92 | cc_library( |
| 93 | name = "vision_util", |
| 94 | srcs = ["vision_util.cc"], |
| 95 | hdrs = ["vision_util.h"], |
| 96 | deps = [ |
milind-u | f2a4e32 | 2023-02-01 19:33:10 -0800 | [diff] [blame] | 97 | "//third_party:opencv", |
James Kuszmaul | d67f6d2 | 2023-02-05 17:37:25 -0800 | [diff] [blame] | 98 | "//y2023/constants:constants_fbs", |
| 99 | "@com_github_google_glog//:glog", |
milind-u | 16e3a08 | 2023-01-21 13:53:43 -0800 | [diff] [blame] | 100 | ], |
| 101 | ) |
Maxwell Henderson | febee25 | 2023-01-28 16:53:52 -0800 | [diff] [blame] | 102 | |
Ravago Jones | b84f206 | 2023-01-29 13:46:59 -0800 | [diff] [blame] | 103 | cc_library( |
| 104 | name = "aprilrobotics_lib", |
Maxwell Henderson | febee25 | 2023-01-28 16:53:52 -0800 | [diff] [blame] | 105 | srcs = [ |
| 106 | "aprilrobotics.cc", |
| 107 | "aprilrobotics.h", |
| 108 | ], |
| 109 | target_compatible_with = ["@platforms//os:linux"], |
| 110 | visibility = ["//y2023:__subpackages__"], |
| 111 | deps = [ |
James Kuszmaul | d67f6d2 | 2023-02-05 17:37:25 -0800 | [diff] [blame] | 112 | ":vision_util", |
Maxwell Henderson | febee25 | 2023-01-28 16:53:52 -0800 | [diff] [blame] | 113 | "//aos:init", |
| 114 | "//aos/events:shm_event_loop", |
James Kuszmaul | d67f6d2 | 2023-02-05 17:37:25 -0800 | [diff] [blame] | 115 | "//frc971/constants:constants_sender_lib", |
Maxwell Henderson | febee25 | 2023-01-28 16:53:52 -0800 | [diff] [blame] | 116 | "//frc971/vision:calibration_fbs", |
| 117 | "//frc971/vision:charuco_lib", |
| 118 | "//frc971/vision:target_map_fbs", |
| 119 | "//frc971/vision:target_mapper", |
| 120 | "//frc971/vision:vision_fbs", |
Jim Ostrowski | 49be823 | 2023-03-23 01:00:14 -0700 | [diff] [blame] | 121 | "//frc971/vision:visualize_robot", |
Maxwell Henderson | febee25 | 2023-01-28 16:53:52 -0800 | [diff] [blame] | 122 | "//third_party:opencv", |
| 123 | "//third_party/apriltag", |
James Kuszmaul | d67f6d2 | 2023-02-05 17:37:25 -0800 | [diff] [blame] | 124 | "//y2023/constants:constants_fbs", |
Maxwell Henderson | febee25 | 2023-01-28 16:53:52 -0800 | [diff] [blame] | 125 | ], |
| 126 | ) |
Ravago Jones | b84f206 | 2023-01-29 13:46:59 -0800 | [diff] [blame] | 127 | |
| 128 | cc_binary( |
| 129 | name = "aprilrobotics", |
| 130 | srcs = [ |
| 131 | "aprilrobotics_main.cc", |
| 132 | ], |
| 133 | target_compatible_with = ["@platforms//os:linux"], |
| 134 | visibility = ["//y2023:__subpackages__"], |
| 135 | deps = [ |
| 136 | ":aprilrobotics_lib", |
| 137 | "//aos:init", |
| 138 | "//aos/events:shm_event_loop", |
| 139 | ], |
| 140 | ) |
James Kuszmaul | 77d536c | 2023-02-11 17:30:59 -0800 | [diff] [blame] | 141 | |
Yash Chainani | 10b7b02 | 2023-02-22 14:34:04 -0800 | [diff] [blame] | 142 | cc_test( |
| 143 | name = "april_detection_test", |
| 144 | srcs = [ |
| 145 | "april_detection_test.cc", |
| 146 | ], |
| 147 | data = [ |
| 148 | "//y2023:aos_config", |
| 149 | "//y2023/constants:constants.json", |
| 150 | "@apriltag_test_bfbs_images", |
| 151 | ], |
| 152 | deps = [ |
| 153 | ":aprilrobotics_lib", |
| 154 | "//aos:flatbuffer_merge", |
| 155 | "//aos:json_to_flatbuffer", |
| 156 | "//aos/events:simulated_event_loop", |
| 157 | "//aos/testing:googletest", |
| 158 | "//aos/testing:path", |
| 159 | "//aos/testing:test_logging", |
| 160 | "//frc971/constants:constants_sender_lib", |
| 161 | "//frc971/vision:target_mapper", |
| 162 | "//frc971/vision:vision_fbs", |
| 163 | "//y2023/constants:constants_fbs", |
| 164 | "//y2023/constants:constants_list_fbs", |
| 165 | ], |
| 166 | ) |
| 167 | |
milind-u | 8e98cb9 | 2023-02-05 16:07:10 -0800 | [diff] [blame] | 168 | filegroup( |
| 169 | name = "image_streamer_start", |
| 170 | srcs = ["image_streamer_start.sh"], |
| 171 | visibility = ["//visibility:public"], |
| 172 | ) |
| 173 | |
James Kuszmaul | 77d536c | 2023-02-11 17:30:59 -0800 | [diff] [blame] | 174 | cc_binary( |
| 175 | name = "foxglove_image_converter", |
| 176 | srcs = ["foxglove_image_converter.cc"], |
| 177 | visibility = ["//y2023:__subpackages__"], |
| 178 | deps = [ |
| 179 | "//aos:init", |
| 180 | "//aos/events:shm_event_loop", |
| 181 | "//frc971/vision:foxglove_image_converter_lib", |
| 182 | ], |
| 183 | ) |
James Kuszmaul | d6199be | 2023-02-11 19:56:28 -0800 | [diff] [blame] | 184 | |
| 185 | cc_binary( |
| 186 | name = "calibrate_extrinsics", |
| 187 | srcs = [ |
| 188 | "calibrate_extrinsics.cc", |
| 189 | ], |
| 190 | target_compatible_with = ["@platforms//os:linux"], |
| 191 | deps = [ |
| 192 | "//aos:init", |
| 193 | "//aos/events/logging:log_reader", |
| 194 | "//frc971/constants:constants_sender_lib", |
| 195 | "//frc971/control_loops:profiled_subsystem_fbs", |
| 196 | "//frc971/vision:extrinsics_calibration", |
| 197 | "//third_party:opencv", |
| 198 | "//y2023/constants:constants_fbs", |
| 199 | "//y2023/vision:vision_util", |
| 200 | ], |
| 201 | ) |
Filip Kujawa | 3004f20 | 2023-02-12 16:41:40 -0800 | [diff] [blame] | 202 | |
| 203 | cc_binary( |
| 204 | name = "game_pieces_detector", |
| 205 | srcs = [ |
| 206 | "game_pieces_main.cc", |
| 207 | ], |
| 208 | target_compatible_with = ["@platforms//os:linux"], |
| 209 | visibility = ["//y2023:__subpackages__"], |
| 210 | deps = [ |
| 211 | ":game_pieces_lib", |
| 212 | "//aos:init", |
| 213 | "//aos/events:shm_event_loop", |
| 214 | ], |
| 215 | ) |
| 216 | |
| 217 | cc_library( |
| 218 | name = "game_pieces_lib", |
| 219 | srcs = [ |
| 220 | "game_pieces.cc", |
| 221 | ], |
| 222 | hdrs = [ |
| 223 | "game_pieces.h", |
| 224 | ], |
| 225 | data = [ |
| 226 | "//y2023:aos_config", |
Filip Kujawa | 8c76e5d | 2023-04-08 16:20:27 -0700 | [diff] [blame] | 227 | "@game_pieces_edgetpu_model//file", |
Filip Kujawa | 3004f20 | 2023-02-12 16:41:40 -0800 | [diff] [blame] | 228 | ], |
| 229 | target_compatible_with = ["@platforms//os:linux"], |
| 230 | visibility = ["//y2023:__subpackages__"], |
| 231 | deps = [ |
| 232 | ":game_pieces_fbs", |
Filip Kujawa | 8c76e5d | 2023-04-08 16:20:27 -0700 | [diff] [blame] | 233 | ":yolov5_lib", |
Filip Kujawa | 3004f20 | 2023-02-12 16:41:40 -0800 | [diff] [blame] | 234 | "//aos/events:event_loop", |
| 235 | "//aos/events:shm_event_loop", |
| 236 | "//frc971/vision:vision_fbs", |
| 237 | ], |
| 238 | ) |
| 239 | |
| 240 | flatbuffer_cc_library( |
| 241 | name = "game_pieces_fbs", |
| 242 | srcs = ["game_pieces.fbs"], |
| 243 | gen_reflections = 1, |
| 244 | target_compatible_with = ["@platforms//os:linux"], |
| 245 | visibility = ["//visibility:public"], |
| 246 | ) |
Maxwell Henderson | bf1bcec | 2023-03-05 18:00:20 -0800 | [diff] [blame] | 247 | |
| 248 | flatbuffer_ts_library( |
| 249 | name = "game_pieces_ts_fbs", |
| 250 | srcs = ["game_pieces.fbs"], |
| 251 | target_compatible_with = ["@platforms//os:linux"], |
| 252 | visibility = ["//visibility:public"], |
| 253 | ) |
milind-u | a96c518 | 2023-03-10 23:31:11 -0800 | [diff] [blame] | 254 | |
| 255 | cc_binary( |
| 256 | name = "image_logger", |
| 257 | srcs = [ |
| 258 | "image_logger.cc", |
| 259 | ], |
| 260 | target_compatible_with = ["@platforms//os:linux"], |
| 261 | visibility = ["//visibility:public"], |
| 262 | deps = [ |
| 263 | "//aos:configuration", |
| 264 | "//aos:init", |
| 265 | "//aos/events:shm_event_loop", |
| 266 | "//aos/events/logging:log_writer", |
| 267 | "//aos/logging:log_namer", |
| 268 | "//frc971/input:joystick_state_fbs", |
| 269 | "@com_github_gflags_gflags//:gflags", |
| 270 | "@com_github_google_glog//:glog", |
| 271 | ], |
| 272 | ) |
Filip Kujawa | dc7d47c | 2023-04-08 16:16:51 -0700 | [diff] [blame] | 273 | |
| 274 | cc_library( |
| 275 | name = "yolov5_lib", |
| 276 | srcs = ["yolov5.cc"], |
| 277 | hdrs = ["yolov5.h"], |
Filip Kujawa | 8c76e5d | 2023-04-08 16:20:27 -0700 | [diff] [blame] | 278 | copts = ["-Wno-unused-parameter"], |
Filip Kujawa | dc7d47c | 2023-04-08 16:16:51 -0700 | [diff] [blame] | 279 | deps = [ |
| 280 | "//third_party:opencv", |
| 281 | "@com_github_gflags_gflags//:gflags", |
| 282 | "@com_github_google_glog//:glog", |
Filip Kujawa | f3b8adb | 2023-04-07 21:00:49 -0700 | [diff] [blame] | 283 | "@com_google_absl//absl/types:span", |
Filip Kujawa | dc7d47c | 2023-04-08 16:16:51 -0700 | [diff] [blame] | 284 | ] + cpu_select({ |
| 285 | "amd64": [ |
| 286 | "@libtensorflowlite//:tensorflow-k8", |
| 287 | "@libedgetpu//:libedgetpu-k8", |
| 288 | ], |
| 289 | "arm": [ |
| 290 | "@libtensorflowlite//:tensorflow-arm", |
| 291 | "@libedgetpu//:libedgetpu-arm", |
| 292 | ], |
| 293 | }), |
| 294 | ) |