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