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