James Kuszmaul | f01da39 | 2023-12-14 11:22:14 -0800 | [diff] [blame] | 1 | load("//aos/flatbuffers:generate.bzl", "static_flatbuffer") |
| 2 | load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_py_library") |
James Kuszmaul | 59a308f | 2023-01-28 19:14:07 -0800 | [diff] [blame] | 3 | load("//aos:config.bzl", "aos_config") |
Austin Schuh | a1d006e | 2022-09-14 21:50:42 -0700 | [diff] [blame] | 4 | load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library") |
Jim Ostrowski | 977850f | 2022-01-22 21:04:22 -0800 | [diff] [blame] | 5 | |
James Kuszmaul | f01da39 | 2023-12-14 11:22:14 -0800 | [diff] [blame] | 6 | static_flatbuffer( |
Jim Ostrowski | 977850f | 2022-01-22 21:04:22 -0800 | [diff] [blame] | 7 | name = "vision_fbs", |
| 8 | srcs = ["vision.fbs"], |
Jim Ostrowski | 977850f | 2022-01-22 21:04:22 -0800 | [diff] [blame] | 9 | target_compatible_with = ["@platforms//os:linux"], |
| 10 | visibility = ["//visibility:public"], |
| 11 | ) |
| 12 | |
| 13 | flatbuffer_ts_library( |
| 14 | name = "vision_ts_fbs", |
| 15 | srcs = ["vision.fbs"], |
| 16 | target_compatible_with = ["@platforms//os:linux"], |
| 17 | visibility = ["//visibility:public"], |
| 18 | ) |
| 19 | |
James Kuszmaul | f01da39 | 2023-12-14 11:22:14 -0800 | [diff] [blame] | 20 | static_flatbuffer( |
milind-u | 2f101fc | 2023-01-21 12:28:49 -0800 | [diff] [blame] | 21 | name = "calibration_fbs", |
| 22 | srcs = ["calibration.fbs"], |
milind-u | 2f101fc | 2023-01-21 12:28:49 -0800 | [diff] [blame] | 23 | target_compatible_with = ["@platforms//os:linux"], |
| 24 | visibility = ["//visibility:public"], |
| 25 | ) |
| 26 | |
| 27 | flatbuffer_ts_library( |
| 28 | name = "calibration_ts_fbs", |
| 29 | srcs = ["calibration.fbs"], |
| 30 | target_compatible_with = ["@platforms//os:linux"], |
| 31 | visibility = ["//visibility:public"], |
| 32 | ) |
| 33 | |
Milo Lin | 1390657 | 2023-03-15 20:55:22 -0700 | [diff] [blame] | 34 | flatbuffer_ts_library( |
| 35 | name = "target_map_ts_fbs", |
| 36 | srcs = ["target_map.fbs"], |
| 37 | target_compatible_with = ["@platforms//os:linux"], |
| 38 | visibility = ["//visibility:public"], |
| 39 | ) |
| 40 | |
milind-u | 2f101fc | 2023-01-21 12:28:49 -0800 | [diff] [blame] | 41 | flatbuffer_py_library( |
| 42 | name = "calibration_fbs_python", |
| 43 | srcs = [ |
| 44 | "calibration.fbs", |
| 45 | ], |
| 46 | namespace = "frc971.vision.calibration", |
| 47 | tables = [ |
| 48 | "CalibrationData", |
| 49 | "CameraCalibration", |
| 50 | "TransformationMatrix", |
| 51 | ], |
| 52 | target_compatible_with = ["@platforms//os:linux"], |
| 53 | visibility = ["//visibility:public"], |
| 54 | ) |
| 55 | |
milind-u | 959d6bd | 2023-01-21 12:32:52 -0800 | [diff] [blame] | 56 | py_library( |
| 57 | name = "create_calib_file", |
| 58 | srcs = [ |
| 59 | "create_calib_file.py", |
| 60 | ], |
| 61 | target_compatible_with = ["@platforms//os:linux"], |
| 62 | visibility = ["//visibility:public"], |
| 63 | deps = [ |
| 64 | ":calibration_fbs_python", |
| 65 | "@bazel_tools//tools/python/runfiles", |
| 66 | "@pip//glog", |
| 67 | "@pip//opencv_python", |
| 68 | ], |
| 69 | ) |
| 70 | |
Jim Ostrowski | 977850f | 2022-01-22 21:04:22 -0800 | [diff] [blame] | 71 | cc_library( |
| 72 | name = "v4l2_reader", |
| 73 | srcs = [ |
| 74 | "v4l2_reader.cc", |
| 75 | ], |
| 76 | hdrs = [ |
| 77 | "v4l2_reader.h", |
| 78 | ], |
| 79 | target_compatible_with = ["@platforms//os:linux"], |
| 80 | visibility = ["//visibility:public"], |
| 81 | deps = [ |
| 82 | ":vision_fbs", |
Ravago Jones | dc52475 | 2022-12-27 01:15:13 -0800 | [diff] [blame] | 83 | "//aos/events:epoll", |
Jim Ostrowski | 977850f | 2022-01-22 21:04:22 -0800 | [diff] [blame] | 84 | "//aos/events:event_loop", |
| 85 | "//aos/scoped:scoped_fd", |
Ravago Jones | c6b919f | 2023-01-01 21:34:12 -0800 | [diff] [blame] | 86 | "//aos/util:threaded_consumer", |
Jim Ostrowski | 977850f | 2022-01-22 21:04:22 -0800 | [diff] [blame] | 87 | "@com_github_google_glog//:glog", |
| 88 | "@com_google_absl//absl/base", |
| 89 | ], |
| 90 | ) |
Austin Schuh | dcb6b36 | 2022-02-25 18:06:21 -0800 | [diff] [blame] | 91 | |
| 92 | cc_library( |
| 93 | name = "charuco_lib", |
| 94 | srcs = [ |
| 95 | "charuco_lib.cc", |
| 96 | ], |
| 97 | hdrs = [ |
| 98 | "charuco_lib.h", |
| 99 | ], |
| 100 | target_compatible_with = ["@platforms//os:linux"], |
| 101 | visibility = ["//visibility:public"], |
| 102 | deps = [ |
| 103 | "//aos:flatbuffers", |
| 104 | "//aos/events:event_loop", |
| 105 | "//aos/network:message_bridge_server_fbs", |
| 106 | "//aos/network:team_number", |
| 107 | "//frc971/control_loops:quaternion_utils", |
James Kuszmaul | 7e95881 | 2023-02-11 15:34:31 -0800 | [diff] [blame] | 108 | "//frc971/vision:calibration_fbs", |
Austin Schuh | dcb6b36 | 2022-02-25 18:06:21 -0800 | [diff] [blame] | 109 | "//frc971/vision:vision_fbs", |
| 110 | "//third_party:opencv", |
James Kuszmaul | 969e4ab | 2023-01-28 16:09:19 -0800 | [diff] [blame] | 111 | "@com_github_foxglove_schemas//:schemas", |
Austin Schuh | dcb6b36 | 2022-02-25 18:06:21 -0800 | [diff] [blame] | 112 | "@com_github_google_glog//:glog", |
| 113 | "@com_google_absl//absl/strings:str_format", |
| 114 | "@com_google_absl//absl/types:span", |
| 115 | "@org_tuxfamily_eigen//:eigen", |
| 116 | ], |
| 117 | ) |
| 118 | |
| 119 | cc_library( |
| 120 | name = "extrinsics_calibration", |
| 121 | srcs = [ |
| 122 | "calibration_accumulator.cc", |
| 123 | "calibration_accumulator.h", |
| 124 | "extrinsics_calibration.cc", |
| 125 | "extrinsics_calibration.h", |
| 126 | ], |
| 127 | target_compatible_with = ["@platforms//os:linux"], |
| 128 | visibility = ["//visibility:public"], |
| 129 | deps = [ |
| 130 | ":charuco_lib", |
James Kuszmaul | 77d536c | 2023-02-11 17:30:59 -0800 | [diff] [blame] | 131 | ":foxglove_image_converter_lib", |
Austin Schuh | dcb6b36 | 2022-02-25 18:06:21 -0800 | [diff] [blame] | 132 | "//aos:init", |
| 133 | "//aos/events/logging:log_reader", |
Austin Schuh | dcb6b36 | 2022-02-25 18:06:21 -0800 | [diff] [blame] | 134 | "//frc971/control_loops/drivetrain:improved_down_estimator", |
Jim Ostrowski | ba2edd1 | 2022-12-03 15:44:37 -0800 | [diff] [blame] | 135 | "//frc971/vision:visualize_robot", |
Austin Schuh | dcb6b36 | 2022-02-25 18:06:21 -0800 | [diff] [blame] | 136 | "//frc971/wpilib:imu_batch_fbs", |
| 137 | "//frc971/wpilib:imu_fbs", |
| 138 | "//third_party:opencv", |
James Kuszmaul | 969e4ab | 2023-01-28 16:09:19 -0800 | [diff] [blame] | 139 | "@com_github_foxglove_schemas//:CompressedImage_schema", |
| 140 | "@com_github_foxglove_schemas//:ImageAnnotations_schema", |
Austin Schuh | dcb6b36 | 2022-02-25 18:06:21 -0800 | [diff] [blame] | 141 | "@com_google_absl//absl/strings:str_format", |
| 142 | "@com_google_ceres_solver//:ceres", |
| 143 | "@org_tuxfamily_eigen//:eigen", |
Stephan Pleines | 85b295c | 2024-02-04 17:50:26 -0800 | [diff] [blame] | 144 | ] + [ |
| 145 | # TODO(Stephan): This is a whacky hack. If we include this |
| 146 | # in the proper spot above (alphabetically), then we get a |
| 147 | # linker error: duplicate symbol: crc32. |
| 148 | # It's part of both @zlib and @com_github_rawrtc_re. |
| 149 | "//aos/analysis:in_process_plotter", |
Austin Schuh | dcb6b36 | 2022-02-25 18:06:21 -0800 | [diff] [blame] | 150 | ], |
| 151 | ) |
Milind Upadhyay | b67c618 | 2022-10-22 13:45:45 -0700 | [diff] [blame] | 152 | |
James Kuszmaul | f01da39 | 2023-12-14 11:22:14 -0800 | [diff] [blame] | 153 | static_flatbuffer( |
Milind Upadhyay | cd677a3 | 2022-12-04 13:06:43 -0800 | [diff] [blame] | 154 | name = "target_map_fbs", |
| 155 | srcs = ["target_map.fbs"], |
Milind Upadhyay | cd677a3 | 2022-12-04 13:06:43 -0800 | [diff] [blame] | 156 | target_compatible_with = ["@platforms//os:linux"], |
| 157 | visibility = ["//visibility:public"], |
| 158 | ) |
| 159 | |
Milind Upadhyay | b67c618 | 2022-10-22 13:45:45 -0700 | [diff] [blame] | 160 | cc_library( |
Milind Upadhyay | 7c20522 | 2022-11-16 18:20:58 -0800 | [diff] [blame] | 161 | name = "target_mapper", |
| 162 | srcs = ["target_mapper.cc"], |
| 163 | hdrs = ["target_mapper.h"], |
Yash Chainani | d5c7f0d | 2022-11-19 17:05:57 -0800 | [diff] [blame] | 164 | data = ["target_map.json"], |
Milind Upadhyay | 7c20522 | 2022-11-16 18:20:58 -0800 | [diff] [blame] | 165 | target_compatible_with = ["@platforms//os:linux"], |
| 166 | visibility = ["//visibility:public"], |
| 167 | deps = [ |
| 168 | ":geometry_lib", |
Milind Upadhyay | cd677a3 | 2022-12-04 13:06:43 -0800 | [diff] [blame] | 169 | ":target_map_fbs", |
Milind Upadhyay | 7c20522 | 2022-11-16 18:20:58 -0800 | [diff] [blame] | 170 | "//aos/events:simulated_event_loop", |
| 171 | "//frc971/control_loops:control_loop", |
milind-u | 8f4e43e | 2023-04-09 17:11:19 -0700 | [diff] [blame] | 172 | "//frc971/vision:visualize_robot", |
Milind Upadhyay | c5beba1 | 2022-12-17 17:41:20 -0800 | [diff] [blame] | 173 | "//frc971/vision/ceres:pose_graph_3d_lib", |
Milind Upadhyay | 7c20522 | 2022-11-16 18:20:58 -0800 | [diff] [blame] | 174 | "//third_party:opencv", |
| 175 | "@com_google_ceres_solver//:ceres", |
| 176 | "@org_tuxfamily_eigen//:eigen", |
| 177 | ], |
| 178 | ) |
| 179 | |
| 180 | cc_test( |
| 181 | name = "target_mapper_test", |
| 182 | srcs = [ |
| 183 | "target_mapper_test.cc", |
| 184 | ], |
Milind Upadhyay | c5beba1 | 2022-12-17 17:41:20 -0800 | [diff] [blame] | 185 | data = [":target_map.json"], |
Milind Upadhyay | 7c20522 | 2022-11-16 18:20:58 -0800 | [diff] [blame] | 186 | target_compatible_with = ["@platforms//os:linux"], |
| 187 | deps = [ |
| 188 | ":target_mapper", |
| 189 | "//aos/events:simulated_event_loop", |
| 190 | "//aos/testing:googletest", |
Milind Upadhyay | c5beba1 | 2022-12-17 17:41:20 -0800 | [diff] [blame] | 191 | "//aos/testing:path", |
Milind Upadhyay | 7c20522 | 2022-11-16 18:20:58 -0800 | [diff] [blame] | 192 | "//aos/testing:random_seed", |
Milind Upadhyay | c5beba1 | 2022-12-17 17:41:20 -0800 | [diff] [blame] | 193 | "//aos/util:math", |
Milind Upadhyay | 7c20522 | 2022-11-16 18:20:58 -0800 | [diff] [blame] | 194 | ], |
| 195 | ) |
| 196 | |
| 197 | cc_library( |
Milind Upadhyay | b67c618 | 2022-10-22 13:45:45 -0700 | [diff] [blame] | 198 | name = "geometry_lib", |
| 199 | hdrs = [ |
| 200 | "geometry.h", |
| 201 | ], |
| 202 | target_compatible_with = ["@platforms//os:linux"], |
| 203 | visibility = ["//visibility:public"], |
| 204 | deps = [ |
| 205 | "//aos/util:math", |
| 206 | "//third_party:opencv", |
| 207 | "@com_github_google_glog//:glog", |
| 208 | ], |
| 209 | ) |
| 210 | |
| 211 | cc_test( |
| 212 | name = "geometry_test", |
| 213 | srcs = [ |
| 214 | "geometry_test.cc", |
| 215 | ], |
| 216 | deps = [ |
| 217 | ":geometry_lib", |
| 218 | "//aos/testing:googletest", |
| 219 | ], |
| 220 | ) |
Jim Ostrowski | ba2edd1 | 2022-12-03 15:44:37 -0800 | [diff] [blame] | 221 | |
| 222 | cc_library( |
| 223 | name = "visualize_robot", |
| 224 | srcs = [ |
| 225 | "visualize_robot.cc", |
| 226 | ], |
| 227 | hdrs = [ |
| 228 | "visualize_robot.h", |
| 229 | ], |
Jim Ostrowski | 49be823 | 2023-03-23 01:00:14 -0700 | [diff] [blame] | 230 | visibility = ["//visibility:public"], |
Jim Ostrowski | ba2edd1 | 2022-12-03 15:44:37 -0800 | [diff] [blame] | 231 | deps = [ |
| 232 | "//aos:init", |
| 233 | "//third_party:opencv", |
| 234 | "@com_google_absl//absl/strings:str_format", |
| 235 | "@org_tuxfamily_eigen//:eigen", |
| 236 | ], |
| 237 | ) |
| 238 | |
| 239 | cc_binary( |
| 240 | name = "visualize_robot_sample", |
| 241 | srcs = [ |
| 242 | "visualize_robot_sample.cc", |
| 243 | ], |
| 244 | target_compatible_with = ["@platforms//os:linux"], |
| 245 | visibility = ["//visibility:public"], |
| 246 | deps = [ |
| 247 | "//aos:init", |
| 248 | "//frc971/vision:visualize_robot", |
| 249 | "//third_party:opencv", |
| 250 | "@com_github_google_glog//:glog", |
| 251 | "@com_google_ceres_solver//:ceres", |
| 252 | "@org_tuxfamily_eigen//:eigen", |
| 253 | ], |
| 254 | ) |
Austin Schuh | c97d48d | 2022-12-26 14:09:13 -0800 | [diff] [blame] | 255 | |
| 256 | cc_library( |
| 257 | name = "media_device", |
| 258 | srcs = [ |
| 259 | "media_device.cc", |
| 260 | ], |
| 261 | hdrs = ["media_device.h"], |
| 262 | visibility = ["//visibility:public"], |
| 263 | deps = [ |
| 264 | "//aos/scoped:scoped_fd", |
| 265 | "//aos/util:file", |
| 266 | "@com_github_google_glog//:glog", |
| 267 | "@com_google_absl//absl/strings", |
| 268 | ], |
| 269 | ) |
James Kuszmaul | 0c59396 | 2023-01-28 16:04:20 -0800 | [diff] [blame] | 270 | |
| 271 | cc_library( |
James Kuszmaul | 77d536c | 2023-02-11 17:30:59 -0800 | [diff] [blame] | 272 | name = "foxglove_image_converter_lib", |
| 273 | srcs = ["foxglove_image_converter_lib.cc"], |
| 274 | hdrs = ["foxglove_image_converter_lib.h"], |
James Kuszmaul | 0c59396 | 2023-01-28 16:04:20 -0800 | [diff] [blame] | 275 | visibility = ["//visibility:public"], |
| 276 | deps = [ |
James Kuszmaul | 59a308f | 2023-01-28 19:14:07 -0800 | [diff] [blame] | 277 | ":charuco_lib", |
James Kuszmaul | 0c59396 | 2023-01-28 16:04:20 -0800 | [diff] [blame] | 278 | ":vision_fbs", |
| 279 | "//aos/events:event_loop", |
| 280 | "//third_party:opencv", |
| 281 | "@com_github_foxglove_schemas//:schemas", |
| 282 | ], |
| 283 | ) |
James Kuszmaul | 59a308f | 2023-01-28 19:14:07 -0800 | [diff] [blame] | 284 | |
| 285 | aos_config( |
| 286 | name = "converter_config", |
| 287 | testonly = True, |
| 288 | src = "converter_test_config.json", |
| 289 | flatbuffers = [ |
| 290 | "//frc971/vision:vision_fbs", |
| 291 | "//aos/events:event_loop_fbs", |
| 292 | "//aos/logging:log_message_fbs", |
| 293 | "//aos/network:message_bridge_client_fbs", |
| 294 | "//aos/network:message_bridge_server_fbs", |
| 295 | "//aos/network:timestamp_fbs", |
| 296 | "@com_github_foxglove_schemas//:schemas", |
| 297 | ], |
| 298 | ) |
| 299 | |
| 300 | cc_test( |
| 301 | name = "foxglove_image_converter_test", |
| 302 | srcs = ["foxglove_image_converter_test.cc"], |
| 303 | data = [ |
| 304 | ":converter_config", |
| 305 | "@april_tag_test_image", |
| 306 | ], |
| 307 | deps = [ |
James Kuszmaul | 77d536c | 2023-02-11 17:30:59 -0800 | [diff] [blame] | 308 | ":foxglove_image_converter_lib", |
James Kuszmaul | 59a308f | 2023-01-28 19:14:07 -0800 | [diff] [blame] | 309 | "//aos:configuration", |
| 310 | "//aos/events:simulated_event_loop", |
| 311 | "//aos/testing:googletest", |
| 312 | "//aos/testing:path", |
| 313 | "//aos/testing:tmpdir", |
| 314 | ], |
| 315 | ) |
James Kuszmaul | 7e95881 | 2023-02-11 15:34:31 -0800 | [diff] [blame] | 316 | |
| 317 | cc_library( |
| 318 | name = "intrinsics_calibration_lib", |
| 319 | srcs = [ |
| 320 | "intrinsics_calibration_lib.cc", |
| 321 | ], |
| 322 | hdrs = [ |
| 323 | "intrinsics_calibration_lib.h", |
| 324 | ], |
| 325 | target_compatible_with = ["@platforms//os:linux"], |
| 326 | deps = [ |
| 327 | "//aos/events:event_loop", |
| 328 | "//frc971/control_loops/drivetrain:improved_down_estimator", |
| 329 | "//frc971/vision:charuco_lib", |
| 330 | "//frc971/vision:vision_fbs", |
Jim Ostrowski | b974cca | 2024-01-28 15:07:50 -0800 | [diff] [blame^] | 331 | "//frc971/vision:vision_util_lib", |
James Kuszmaul | 7e95881 | 2023-02-11 15:34:31 -0800 | [diff] [blame] | 332 | "//frc971/wpilib:imu_batch_fbs", |
| 333 | "//frc971/wpilib:imu_fbs", |
| 334 | "//third_party:opencv", |
| 335 | "@com_google_absl//absl/strings:str_format", |
| 336 | "@org_tuxfamily_eigen//:eigen", |
| 337 | ], |
| 338 | ) |
| 339 | |
| 340 | cc_binary( |
| 341 | name = "intrinsics_calibration", |
| 342 | srcs = [ |
| 343 | "intrinsics_calibration.cc", |
| 344 | ], |
| 345 | target_compatible_with = ["@platforms//os:linux"], |
| 346 | visibility = [ |
| 347 | "//y2020:__subpackages__", |
| 348 | "//y2022:__subpackages__", |
| 349 | "//y2023:__subpackages__", |
Jim Ostrowski | 855b744 | 2024-01-20 18:03:09 -0800 | [diff] [blame] | 350 | "//y2024:__subpackages__", |
James Kuszmaul | 7e95881 | 2023-02-11 15:34:31 -0800 | [diff] [blame] | 351 | ], |
| 352 | deps = [ |
| 353 | ":intrinsics_calibration_lib", |
| 354 | "//aos:init", |
| 355 | "//aos/events:shm_event_loop", |
| 356 | "//frc971/control_loops/drivetrain:improved_down_estimator", |
| 357 | "//frc971/vision:charuco_lib", |
| 358 | "//frc971/vision:vision_fbs", |
| 359 | "//frc971/wpilib:imu_batch_fbs", |
| 360 | "//frc971/wpilib:imu_fbs", |
| 361 | "//third_party:opencv", |
| 362 | "@com_google_absl//absl/strings:str_format", |
| 363 | "@org_tuxfamily_eigen//:eigen", |
| 364 | ], |
| 365 | ) |
Jim Ostrowski | cb8b408 | 2024-01-21 02:23:46 -0800 | [diff] [blame] | 366 | |
| 367 | cc_library( |
| 368 | name = "vision_util_lib", |
| 369 | srcs = ["vision_util_lib.cc"], |
| 370 | hdrs = ["vision_util_lib.h"], |
| 371 | visibility = ["//visibility:public"], |
| 372 | deps = [ |
| 373 | "//frc971/vision:calibration_fbs", |
| 374 | "//third_party:opencv", |
| 375 | "@com_github_google_glog//:glog", |
| 376 | ], |
| 377 | ) |
Jim Ostrowski | b974cca | 2024-01-28 15:07:50 -0800 | [diff] [blame^] | 378 | |
| 379 | cc_test( |
| 380 | name = "vision_util_lib_test", |
| 381 | srcs = ["vision_util_lib_test.cc"], |
| 382 | visibility = ["//visibility:public"], |
| 383 | deps = [ |
| 384 | "//aos/testing:googletest", |
| 385 | "//frc971/vision:vision_util_lib", |
| 386 | "@com_github_google_glog//:glog", |
| 387 | ], |
| 388 | ) |