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