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", |
| 102 | "//frc971/vision:vision_fbs", |
| 103 | "//third_party:opencv", |
| 104 | "//y2020/vision/sift:sift_fbs", |
| 105 | "//y2020/vision/sift:sift_training_fbs", |
| 106 | "//y2020/vision/tools/python_code:sift_training_data", |
James Kuszmaul | 969e4ab | 2023-01-28 16:09:19 -0800 | [diff] [blame] | 107 | "@com_github_foxglove_schemas//:schemas", |
Austin Schuh | dcb6b36 | 2022-02-25 18:06:21 -0800 | [diff] [blame] | 108 | "@com_github_google_glog//:glog", |
| 109 | "@com_google_absl//absl/strings:str_format", |
| 110 | "@com_google_absl//absl/types:span", |
| 111 | "@org_tuxfamily_eigen//:eigen", |
| 112 | ], |
| 113 | ) |
| 114 | |
| 115 | cc_library( |
| 116 | name = "extrinsics_calibration", |
| 117 | srcs = [ |
| 118 | "calibration_accumulator.cc", |
| 119 | "calibration_accumulator.h", |
| 120 | "extrinsics_calibration.cc", |
| 121 | "extrinsics_calibration.h", |
| 122 | ], |
| 123 | target_compatible_with = ["@platforms//os:linux"], |
| 124 | visibility = ["//visibility:public"], |
| 125 | deps = [ |
| 126 | ":charuco_lib", |
James Kuszmaul | 969e4ab | 2023-01-28 16:09:19 -0800 | [diff] [blame] | 127 | ":foxglove_image_converter", |
Austin Schuh | dcb6b36 | 2022-02-25 18:06:21 -0800 | [diff] [blame] | 128 | "//aos:init", |
| 129 | "//aos/events/logging:log_reader", |
| 130 | "//frc971/analysis:in_process_plotter", |
| 131 | "//frc971/control_loops/drivetrain:improved_down_estimator", |
Jim Ostrowski | ba2edd1 | 2022-12-03 15:44:37 -0800 | [diff] [blame] | 132 | "//frc971/vision:visualize_robot", |
Austin Schuh | dcb6b36 | 2022-02-25 18:06:21 -0800 | [diff] [blame] | 133 | "//frc971/wpilib:imu_batch_fbs", |
| 134 | "//frc971/wpilib:imu_fbs", |
| 135 | "//third_party:opencv", |
James Kuszmaul | 969e4ab | 2023-01-28 16:09:19 -0800 | [diff] [blame] | 136 | "@com_github_foxglove_schemas//:CompressedImage_schema", |
| 137 | "@com_github_foxglove_schemas//:ImageAnnotations_schema", |
Austin Schuh | dcb6b36 | 2022-02-25 18:06:21 -0800 | [diff] [blame] | 138 | "@com_google_absl//absl/strings:str_format", |
| 139 | "@com_google_ceres_solver//:ceres", |
| 140 | "@org_tuxfamily_eigen//:eigen", |
| 141 | ], |
| 142 | ) |
Milind Upadhyay | b67c618 | 2022-10-22 13:45:45 -0700 | [diff] [blame] | 143 | |
Milind Upadhyay | cd677a3 | 2022-12-04 13:06:43 -0800 | [diff] [blame] | 144 | flatbuffer_cc_library( |
| 145 | name = "target_map_fbs", |
| 146 | srcs = ["target_map.fbs"], |
| 147 | gen_reflections = 1, |
| 148 | target_compatible_with = ["@platforms//os:linux"], |
| 149 | visibility = ["//visibility:public"], |
| 150 | ) |
| 151 | |
Milind Upadhyay | b67c618 | 2022-10-22 13:45:45 -0700 | [diff] [blame] | 152 | cc_library( |
Milind Upadhyay | 7c20522 | 2022-11-16 18:20:58 -0800 | [diff] [blame] | 153 | name = "target_mapper", |
| 154 | srcs = ["target_mapper.cc"], |
| 155 | hdrs = ["target_mapper.h"], |
Yash Chainani | d5c7f0d | 2022-11-19 17:05:57 -0800 | [diff] [blame] | 156 | data = ["target_map.json"], |
Milind Upadhyay | 7c20522 | 2022-11-16 18:20:58 -0800 | [diff] [blame] | 157 | target_compatible_with = ["@platforms//os:linux"], |
| 158 | visibility = ["//visibility:public"], |
| 159 | deps = [ |
| 160 | ":geometry_lib", |
Milind Upadhyay | cd677a3 | 2022-12-04 13:06:43 -0800 | [diff] [blame] | 161 | ":target_map_fbs", |
Milind Upadhyay | 7c20522 | 2022-11-16 18:20:58 -0800 | [diff] [blame] | 162 | "//aos/events:simulated_event_loop", |
| 163 | "//frc971/control_loops:control_loop", |
Milind Upadhyay | c5beba1 | 2022-12-17 17:41:20 -0800 | [diff] [blame] | 164 | "//frc971/vision/ceres:pose_graph_3d_lib", |
Milind Upadhyay | 7c20522 | 2022-11-16 18:20:58 -0800 | [diff] [blame] | 165 | "//third_party:opencv", |
| 166 | "@com_google_ceres_solver//:ceres", |
| 167 | "@org_tuxfamily_eigen//:eigen", |
| 168 | ], |
| 169 | ) |
| 170 | |
| 171 | cc_test( |
| 172 | name = "target_mapper_test", |
| 173 | srcs = [ |
| 174 | "target_mapper_test.cc", |
| 175 | ], |
Milind Upadhyay | c5beba1 | 2022-12-17 17:41:20 -0800 | [diff] [blame] | 176 | data = [":target_map.json"], |
Milind Upadhyay | 7c20522 | 2022-11-16 18:20:58 -0800 | [diff] [blame] | 177 | target_compatible_with = ["@platforms//os:linux"], |
| 178 | deps = [ |
| 179 | ":target_mapper", |
| 180 | "//aos/events:simulated_event_loop", |
| 181 | "//aos/testing:googletest", |
Milind Upadhyay | c5beba1 | 2022-12-17 17:41:20 -0800 | [diff] [blame] | 182 | "//aos/testing:path", |
Milind Upadhyay | 7c20522 | 2022-11-16 18:20:58 -0800 | [diff] [blame] | 183 | "//aos/testing:random_seed", |
Milind Upadhyay | c5beba1 | 2022-12-17 17:41:20 -0800 | [diff] [blame] | 184 | "//aos/util:math", |
Milind Upadhyay | 7c20522 | 2022-11-16 18:20:58 -0800 | [diff] [blame] | 185 | ], |
| 186 | ) |
| 187 | |
| 188 | cc_library( |
Milind Upadhyay | b67c618 | 2022-10-22 13:45:45 -0700 | [diff] [blame] | 189 | name = "geometry_lib", |
| 190 | hdrs = [ |
| 191 | "geometry.h", |
| 192 | ], |
| 193 | target_compatible_with = ["@platforms//os:linux"], |
| 194 | visibility = ["//visibility:public"], |
| 195 | deps = [ |
| 196 | "//aos/util:math", |
| 197 | "//third_party:opencv", |
| 198 | "@com_github_google_glog//:glog", |
| 199 | ], |
| 200 | ) |
| 201 | |
| 202 | cc_test( |
| 203 | name = "geometry_test", |
| 204 | srcs = [ |
| 205 | "geometry_test.cc", |
| 206 | ], |
| 207 | deps = [ |
| 208 | ":geometry_lib", |
| 209 | "//aos/testing:googletest", |
| 210 | ], |
| 211 | ) |
Jim Ostrowski | ba2edd1 | 2022-12-03 15:44:37 -0800 | [diff] [blame] | 212 | |
| 213 | cc_library( |
| 214 | name = "visualize_robot", |
| 215 | srcs = [ |
| 216 | "visualize_robot.cc", |
| 217 | ], |
| 218 | hdrs = [ |
| 219 | "visualize_robot.h", |
| 220 | ], |
| 221 | deps = [ |
| 222 | "//aos:init", |
| 223 | "//third_party:opencv", |
| 224 | "@com_google_absl//absl/strings:str_format", |
| 225 | "@org_tuxfamily_eigen//:eigen", |
| 226 | ], |
| 227 | ) |
| 228 | |
| 229 | cc_binary( |
| 230 | name = "visualize_robot_sample", |
| 231 | srcs = [ |
| 232 | "visualize_robot_sample.cc", |
| 233 | ], |
| 234 | target_compatible_with = ["@platforms//os:linux"], |
| 235 | visibility = ["//visibility:public"], |
| 236 | deps = [ |
| 237 | "//aos:init", |
| 238 | "//frc971/vision:visualize_robot", |
| 239 | "//third_party:opencv", |
| 240 | "@com_github_google_glog//:glog", |
| 241 | "@com_google_ceres_solver//:ceres", |
| 242 | "@org_tuxfamily_eigen//:eigen", |
| 243 | ], |
| 244 | ) |
Austin Schuh | c97d48d | 2022-12-26 14:09:13 -0800 | [diff] [blame] | 245 | |
| 246 | cc_library( |
| 247 | name = "media_device", |
| 248 | srcs = [ |
| 249 | "media_device.cc", |
| 250 | ], |
| 251 | hdrs = ["media_device.h"], |
| 252 | visibility = ["//visibility:public"], |
| 253 | deps = [ |
| 254 | "//aos/scoped:scoped_fd", |
| 255 | "//aos/util:file", |
| 256 | "@com_github_google_glog//:glog", |
| 257 | "@com_google_absl//absl/strings", |
| 258 | ], |
| 259 | ) |
James Kuszmaul | 0c59396 | 2023-01-28 16:04:20 -0800 | [diff] [blame] | 260 | |
| 261 | cc_library( |
| 262 | name = "foxglove_image_converter", |
| 263 | srcs = ["foxglove_image_converter.cc"], |
| 264 | hdrs = ["foxglove_image_converter.h"], |
| 265 | visibility = ["//visibility:public"], |
| 266 | deps = [ |
James Kuszmaul | 59a308f | 2023-01-28 19:14:07 -0800 | [diff] [blame] | 267 | ":charuco_lib", |
James Kuszmaul | 0c59396 | 2023-01-28 16:04:20 -0800 | [diff] [blame] | 268 | ":vision_fbs", |
| 269 | "//aos/events:event_loop", |
| 270 | "//third_party:opencv", |
| 271 | "@com_github_foxglove_schemas//:schemas", |
| 272 | ], |
| 273 | ) |
James Kuszmaul | 59a308f | 2023-01-28 19:14:07 -0800 | [diff] [blame] | 274 | |
| 275 | aos_config( |
| 276 | name = "converter_config", |
| 277 | testonly = True, |
| 278 | src = "converter_test_config.json", |
| 279 | flatbuffers = [ |
| 280 | "//frc971/vision:vision_fbs", |
| 281 | "//aos/events:event_loop_fbs", |
| 282 | "//aos/logging:log_message_fbs", |
| 283 | "//aos/network:message_bridge_client_fbs", |
| 284 | "//aos/network:message_bridge_server_fbs", |
| 285 | "//aos/network:timestamp_fbs", |
| 286 | "@com_github_foxglove_schemas//:schemas", |
| 287 | ], |
| 288 | ) |
| 289 | |
| 290 | cc_test( |
| 291 | name = "foxglove_image_converter_test", |
| 292 | srcs = ["foxglove_image_converter_test.cc"], |
| 293 | data = [ |
| 294 | ":converter_config", |
| 295 | "@april_tag_test_image", |
| 296 | ], |
| 297 | deps = [ |
| 298 | ":foxglove_image_converter", |
| 299 | "//aos:configuration", |
| 300 | "//aos/events:simulated_event_loop", |
| 301 | "//aos/testing:googletest", |
| 302 | "//aos/testing:path", |
| 303 | "//aos/testing:tmpdir", |
| 304 | ], |
| 305 | ) |