Austin Schuh | a1d006e | 2022-09-14 21:50:42 -0700 | [diff] [blame^] | 1 | load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_py_library") |
| 2 | load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library") |
James Kuszmaul | b35e234 | 2022-03-06 15:44:00 -0800 | [diff] [blame] | 3 | load("@npm//@bazel/typescript:index.bzl", "ts_library") |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 4 | |
Jim Ostrowski | 007e2ea | 2022-01-30 13:13:26 -0800 | [diff] [blame] | 5 | flatbuffer_cc_library( |
| 6 | name = "calibration_fbs", |
| 7 | srcs = ["calibration.fbs"], |
| 8 | gen_reflections = 1, |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 9 | target_compatible_with = ["@platforms//os:linux"], |
| 10 | visibility = ["//y2022:__subpackages__"], |
Jim Ostrowski | 007e2ea | 2022-01-30 13:13:26 -0800 | [diff] [blame] | 11 | ) |
| 12 | |
Milind Upadhyay | d836bce | 2022-03-25 21:49:57 -0700 | [diff] [blame] | 13 | flatbuffer_ts_library( |
| 14 | name = "calibration_ts_fbs", |
| 15 | srcs = ["calibration.fbs"], |
| 16 | target_compatible_with = ["@platforms//os:linux"], |
| 17 | ) |
| 18 | |
Jim Ostrowski | 007e2ea | 2022-01-30 13:13:26 -0800 | [diff] [blame] | 19 | flatbuffer_py_library( |
| 20 | name = "calibration_fbs_python", |
| 21 | srcs = [ |
| 22 | "calibration.fbs", |
| 23 | ], |
| 24 | namespace = "frc971.vision.calibration", |
| 25 | tables = [ |
| 26 | "CalibrationData", |
| 27 | "CameraCalibration", |
| 28 | "TransformationMatrix", |
| 29 | ], |
| 30 | target_compatible_with = ["@platforms//os:linux"], |
| 31 | visibility = ["//visibility:public"], |
| 32 | ) |
| 33 | |
James Kuszmaul | b35e234 | 2022-03-06 15:44:00 -0800 | [diff] [blame] | 34 | ts_library( |
| 35 | name = "vision_plotter", |
| 36 | srcs = ["vision_plotter.ts"], |
| 37 | target_compatible_with = ["@platforms//os:linux"], |
| 38 | visibility = ["//visibility:public"], |
| 39 | deps = [ |
Milind Upadhyay | d836bce | 2022-03-25 21:49:57 -0700 | [diff] [blame] | 40 | ":target_estimate_ts_fbs", |
| 41 | "//aos:configuration_ts_fbs", |
James Kuszmaul | b35e234 | 2022-03-06 15:44:00 -0800 | [diff] [blame] | 42 | "//aos/network/www:aos_plotter", |
| 43 | "//aos/network/www:colors", |
| 44 | "//aos/network/www:proxy", |
Milind Upadhyay | d836bce | 2022-03-25 21:49:57 -0700 | [diff] [blame] | 45 | "//aos/network/www:reflection_ts", |
| 46 | "@com_github_google_flatbuffers//reflection:reflection_ts_fbs", |
| 47 | "@com_github_google_flatbuffers//ts:flatbuffers_ts", |
James Kuszmaul | b35e234 | 2022-03-06 15:44:00 -0800 | [diff] [blame] | 48 | ], |
| 49 | ) |
| 50 | |
Jim Ostrowski | 007e2ea | 2022-01-30 13:13:26 -0800 | [diff] [blame] | 51 | py_library( |
| 52 | name = "camera_definition", |
| 53 | srcs = [ |
| 54 | "camera_definition.py", |
| 55 | ], |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 56 | deps = [ |
Jim Ostrowski | 007e2ea | 2022-01-30 13:13:26 -0800 | [diff] [blame] | 57 | "//external:python-glog", |
| 58 | ], |
| 59 | ) |
| 60 | |
| 61 | py_binary( |
| 62 | name = "create_calib_file", |
| 63 | srcs = [ |
| 64 | "create_calib_file.py", |
| 65 | ], |
| 66 | args = [ |
| 67 | "calibration_data.h", |
| 68 | ], |
| 69 | data = glob(["calib_files/*.json"]), |
| 70 | target_compatible_with = ["@platforms//os:linux"], |
| 71 | deps = [ |
| 72 | ":camera_definition", |
| 73 | "//external:python-glog", |
| 74 | "//y2022/vision:calibration_fbs_python", |
| 75 | "@bazel_tools//tools/python/runfiles", |
| 76 | "@opencv_contrib_nonfree_amd64//:python_opencv", |
| 77 | ], |
| 78 | ) |
| 79 | |
| 80 | genrule( |
| 81 | name = "run_calibration_data", |
| 82 | outs = [ |
| 83 | "calibration_data.h", |
| 84 | ], |
| 85 | cmd = " ".join([ |
| 86 | "$(location :create_calib_file)", |
| 87 | "$(location calibration_data.h)", |
| 88 | ]), |
| 89 | target_compatible_with = ["@platforms//os:linux"], |
| 90 | tools = [ |
| 91 | ":create_calib_file", |
| 92 | ], |
| 93 | ) |
| 94 | |
| 95 | cc_library( |
| 96 | name = "calibration_data", |
| 97 | hdrs = [ |
| 98 | "calibration_data.h", |
| 99 | ], |
| 100 | target_compatible_with = ["@platforms//os:linux"], |
| 101 | visibility = ["//visibility:public"], |
| 102 | deps = [ |
| 103 | "@com_google_absl//absl/types:span", |
Jim Ostrowski | ff7b3de | 2022-01-22 22:20:26 -0800 | [diff] [blame] | 104 | ], |
| 105 | ) |
| 106 | |
| 107 | cc_library( |
| 108 | name = "camera_reader_lib", |
| 109 | srcs = [ |
| 110 | "camera_reader.cc", |
| 111 | ], |
| 112 | hdrs = [ |
| 113 | "camera_reader.h", |
Jim Ostrowski | 2a483b3 | 2022-02-15 18:19:14 -0800 | [diff] [blame] | 114 | "gpio.h", |
Jim Ostrowski | ff7b3de | 2022-01-22 22:20:26 -0800 | [diff] [blame] | 115 | ], |
| 116 | data = [ |
Austin Schuh | c5fa6d9 | 2022-02-25 14:36:28 -0800 | [diff] [blame] | 117 | "//y2022:aos_config", |
Jim Ostrowski | ff7b3de | 2022-01-22 22:20:26 -0800 | [diff] [blame] | 118 | ], |
| 119 | target_compatible_with = ["@platforms//os:linux"], |
| 120 | visibility = ["//y2022:__subpackages__"], |
| 121 | deps = [ |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 122 | ":blob_detector_lib", |
Jim Ostrowski | 007e2ea | 2022-01-30 13:13:26 -0800 | [diff] [blame] | 123 | ":calibration_data", |
| 124 | ":calibration_fbs", |
milind-u | db98afa | 2022-03-01 19:54:57 -0800 | [diff] [blame] | 125 | ":geometry_lib", |
Henry Speiser | e45e7a2 | 2022-02-04 23:17:01 -0800 | [diff] [blame] | 126 | ":target_estimate_fbs", |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 127 | ":target_estimator_lib", |
Jim Ostrowski | ff7b3de | 2022-01-22 22:20:26 -0800 | [diff] [blame] | 128 | "//aos:flatbuffer_merge", |
| 129 | "//aos/events:event_loop", |
Henry Speiser | 1f34eea | 2022-01-30 14:35:21 -0800 | [diff] [blame] | 130 | "//aos/events:shm_event_loop", |
Jim Ostrowski | ff7b3de | 2022-01-22 22:20:26 -0800 | [diff] [blame] | 131 | "//aos/network:team_number", |
| 132 | "//frc971/vision:v4l2_reader", |
| 133 | "//frc971/vision:vision_fbs", |
| 134 | "//third_party:opencv", |
Milind Upadhyay | d67e9cf | 2022-03-13 13:56:57 -0700 | [diff] [blame] | 135 | "//y2022/localizer:localizer_output_fbs", |
Jim Ostrowski | 007e2ea | 2022-01-30 13:13:26 -0800 | [diff] [blame] | 136 | ], |
| 137 | ) |
| 138 | |
| 139 | cc_binary( |
| 140 | name = "camera_reader", |
| 141 | srcs = [ |
| 142 | "camera_reader_main.cc", |
| 143 | ], |
| 144 | target_compatible_with = ["@platforms//os:linux"], |
| 145 | visibility = ["//y2022:__subpackages__"], |
| 146 | deps = [ |
| 147 | ":camera_reader_lib", |
| 148 | "//aos:init", |
| 149 | "//aos/events:shm_event_loop", |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 150 | ], |
| 151 | ) |
| 152 | |
Ravago Jones | 32bd3cb | 2022-03-26 15:45:03 -0700 | [diff] [blame] | 153 | cc_binary( |
| 154 | name = "ball_color_detector", |
| 155 | srcs = [ |
| 156 | "ball_color_main.cc", |
| 157 | ], |
| 158 | target_compatible_with = ["@platforms//os:linux"], |
| 159 | visibility = ["//y2022:__subpackages__"], |
| 160 | deps = [ |
| 161 | ":ball_color_lib", |
| 162 | "//aos:init", |
| 163 | "//aos/events:shm_event_loop", |
| 164 | ], |
| 165 | ) |
| 166 | |
| 167 | cc_test( |
| 168 | name = "ball_color_test", |
| 169 | srcs = [ |
| 170 | "ball_color_test.cc", |
| 171 | ], |
| 172 | data = [ |
| 173 | "test_ball_color_image.jpg", |
| 174 | ], |
| 175 | deps = [ |
| 176 | ":ball_color_lib", |
| 177 | "//aos:json_to_flatbuffer", |
| 178 | "//aos/events:simulated_event_loop", |
| 179 | "//aos/testing:googletest", |
| 180 | "//aos/testing:test_logging", |
| 181 | "//y2022:constants", |
| 182 | ], |
| 183 | ) |
| 184 | |
| 185 | cc_library( |
| 186 | name = "ball_color_lib", |
| 187 | srcs = [ |
| 188 | "ball_color.cc", |
| 189 | ], |
| 190 | hdrs = [ |
| 191 | "ball_color.h", |
| 192 | ], |
| 193 | data = [ |
| 194 | "//y2022:aos_config", |
| 195 | ], |
| 196 | target_compatible_with = ["@platforms//os:linux"], |
| 197 | visibility = ["//y2022:__subpackages__"], |
| 198 | deps = [ |
| 199 | ":ball_color_fbs", |
| 200 | "//aos/events:event_loop", |
| 201 | "//aos/events:shm_event_loop", |
| 202 | "//aos/network:team_number", |
| 203 | "//frc971/input:joystick_state_fbs", |
| 204 | "//frc971/vision:vision_fbs", |
| 205 | "//third_party:opencv", |
| 206 | ], |
| 207 | ) |
| 208 | |
| 209 | flatbuffer_cc_library( |
| 210 | name = "ball_color_fbs", |
| 211 | srcs = ["ball_color.fbs"], |
| 212 | gen_reflections = 1, |
| 213 | includes = [ |
| 214 | "//frc971/input:joystick_state_fbs_includes", |
| 215 | ], |
| 216 | target_compatible_with = ["@platforms//os:linux"], |
| 217 | visibility = ["//y2022:__subpackages__"], |
| 218 | ) |
| 219 | |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 220 | cc_library( |
milind-u | db98afa | 2022-03-01 19:54:57 -0800 | [diff] [blame] | 221 | name = "geometry_lib", |
| 222 | hdrs = [ |
| 223 | "geometry.h", |
| 224 | ], |
| 225 | target_compatible_with = ["@platforms//os:linux"], |
| 226 | visibility = ["//y2022:__subpackages__"], |
| 227 | deps = [ |
| 228 | "//aos/util:math", |
| 229 | "//third_party:opencv", |
| 230 | "@com_github_google_glog//:glog", |
| 231 | ], |
| 232 | ) |
| 233 | |
| 234 | cc_test( |
| 235 | name = "geometry_test", |
| 236 | srcs = [ |
| 237 | "geometry_test.cc", |
| 238 | ], |
| 239 | deps = [ |
| 240 | ":geometry_lib", |
| 241 | "//aos/testing:googletest", |
| 242 | ], |
| 243 | ) |
| 244 | |
| 245 | cc_library( |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 246 | name = "blob_detector_lib", |
| 247 | srcs = [ |
| 248 | "blob_detector.cc", |
| 249 | ], |
| 250 | hdrs = [ |
| 251 | "blob_detector.h", |
| 252 | ], |
| 253 | target_compatible_with = ["@platforms//os:linux"], |
| 254 | visibility = ["//y2022:__subpackages__"], |
| 255 | deps = [ |
milind-u | db98afa | 2022-03-01 19:54:57 -0800 | [diff] [blame] | 256 | ":geometry_lib", |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 257 | "//aos/network:team_number", |
Milind Upadhyay | e7aa40c | 2022-01-29 22:36:21 -0800 | [diff] [blame] | 258 | "//aos/time", |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 259 | "//third_party:opencv", |
| 260 | ], |
| 261 | ) |
| 262 | |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 263 | cc_library( |
| 264 | name = "target_estimator_lib", |
| 265 | srcs = [ |
| 266 | "target_estimator.cc", |
| 267 | ], |
| 268 | hdrs = [ |
| 269 | "target_estimator.h", |
| 270 | ], |
| 271 | target_compatible_with = ["@platforms//os:linux"], |
| 272 | visibility = ["//y2022:__subpackages__"], |
| 273 | deps = [ |
Milind Upadhyay | 8f38ad8 | 2022-03-03 10:06:18 -0800 | [diff] [blame] | 274 | ":blob_detector_lib", |
Milind Upadhyay | e2f40d7 | 2022-02-24 13:55:53 -0800 | [diff] [blame] | 275 | ":calibration_fbs", |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 276 | ":target_estimate_fbs", |
Milind Upadhyay | f61e148 | 2022-02-11 20:42:55 -0800 | [diff] [blame] | 277 | "//aos/logging", |
| 278 | "//aos/time", |
| 279 | "//frc971/control_loops:quaternion_utils", |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 280 | "//third_party:opencv", |
milind-u | cafdd5d | 2022-03-01 19:58:57 -0800 | [diff] [blame] | 281 | "//y2022:constants", |
Milind Upadhyay | f61e148 | 2022-02-11 20:42:55 -0800 | [diff] [blame] | 282 | "@com_google_absl//absl/strings:str_format", |
| 283 | "@com_google_ceres_solver//:ceres", |
| 284 | "@org_tuxfamily_eigen//:eigen", |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 285 | ], |
| 286 | ) |
| 287 | |
| 288 | flatbuffer_cc_library( |
| 289 | name = "target_estimate_fbs", |
| 290 | srcs = ["target_estimate.fbs"], |
| 291 | gen_reflections = 1, |
Milind Upadhyay | e2f40d7 | 2022-02-24 13:55:53 -0800 | [diff] [blame] | 292 | includes = [ |
| 293 | ":calibration_fbs_includes", |
| 294 | ], |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 295 | target_compatible_with = ["@platforms//os:linux"], |
| 296 | visibility = ["//y2022:__subpackages__"], |
| 297 | ) |
| 298 | |
Milind Upadhyay | d836bce | 2022-03-25 21:49:57 -0700 | [diff] [blame] | 299 | flatbuffer_ts_library( |
| 300 | name = "target_estimate_ts_fbs", |
| 301 | srcs = ["target_estimate.fbs"], |
| 302 | target_compatible_with = ["@platforms//os:linux"], |
| 303 | deps = [ |
| 304 | ":calibration_ts_fbs", |
| 305 | ], |
| 306 | ) |
| 307 | |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 308 | cc_binary( |
| 309 | name = "viewer", |
| 310 | srcs = [ |
| 311 | "viewer.cc", |
| 312 | ], |
| 313 | data = [ |
Austin Schuh | c5fa6d9 | 2022-02-25 14:36:28 -0800 | [diff] [blame] | 314 | "//y2022:aos_config", |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 315 | ], |
| 316 | target_compatible_with = ["@platforms//os:linux"], |
| 317 | visibility = ["//y2022:__subpackages__"], |
| 318 | deps = [ |
| 319 | ":blob_detector_lib", |
milind-u | cafdd5d | 2022-03-01 19:58:57 -0800 | [diff] [blame] | 320 | ":calibration_data", |
Milind Upadhyay | a31f027 | 2022-04-03 13:55:22 -0700 | [diff] [blame] | 321 | ":camera_reader_lib", |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 322 | ":target_estimator_lib", |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 323 | "//aos:init", |
| 324 | "//aos/events:shm_event_loop", |
Jim Ostrowski | 977850f | 2022-01-22 21:04:22 -0800 | [diff] [blame] | 325 | "//frc971/vision:vision_fbs", |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 326 | "//third_party:opencv", |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 327 | ], |
| 328 | ) |
Austin Schuh | 3e14588 | 2022-02-26 16:48:43 -0800 | [diff] [blame] | 329 | |
| 330 | cc_binary( |
Milind Upadhyay | b7e3c24 | 2022-03-12 20:05:25 -0800 | [diff] [blame] | 331 | name = "viewer_replay", |
| 332 | srcs = [ |
| 333 | "viewer_replay.cc", |
| 334 | ], |
| 335 | data = [ |
| 336 | "//y2022:aos_config", |
| 337 | ], |
| 338 | target_compatible_with = ["@platforms//os:linux"], |
| 339 | visibility = ["//y2022:__subpackages__"], |
| 340 | deps = [ |
| 341 | ":blob_detector_lib", |
| 342 | "//aos:init", |
| 343 | "//aos/events:simulated_event_loop", |
| 344 | "//aos/events/logging:log_reader", |
Milind Upadhyay | e321586 | 2022-03-24 19:59:19 -0700 | [diff] [blame] | 345 | "//frc971/control_loops:control_loops_fbs", |
| 346 | "//frc971/control_loops:profiled_subsystem_fbs", |
| 347 | "//frc971/control_loops/drivetrain:drivetrain_status_fbs", |
| 348 | "//frc971/input:joystick_state_fbs", |
Milind Upadhyay | b7e3c24 | 2022-03-12 20:05:25 -0800 | [diff] [blame] | 349 | "//frc971/vision:vision_fbs", |
| 350 | "//third_party:opencv", |
Milind Upadhyay | e321586 | 2022-03-24 19:59:19 -0700 | [diff] [blame] | 351 | "//y2022/control_loops/superstructure:superstructure_status_fbs", |
Milind Upadhyay | b7e3c24 | 2022-03-12 20:05:25 -0800 | [diff] [blame] | 352 | ], |
| 353 | ) |
| 354 | |
| 355 | cc_binary( |
Austin Schuh | 3e14588 | 2022-02-26 16:48:43 -0800 | [diff] [blame] | 356 | name = "extrinsics_calibration", |
| 357 | srcs = [ |
| 358 | "extrinsics_calibration.cc", |
| 359 | ], |
| 360 | target_compatible_with = ["@platforms//os:linux"], |
| 361 | visibility = ["//y2022:__subpackages__"], |
| 362 | deps = [ |
| 363 | "//aos:init", |
| 364 | "//aos/events/logging:log_reader", |
| 365 | "//frc971/control_loops:profiled_subsystem_fbs", |
| 366 | "//frc971/vision:extrinsics_calibration", |
| 367 | "//y2022/control_loops/superstructure:superstructure_status_fbs", |
| 368 | ], |
| 369 | ) |
James Kuszmaul | 3eb753d | 2022-03-12 15:21:12 -0800 | [diff] [blame] | 370 | |
| 371 | cc_binary( |
| 372 | name = "image_decimator", |
| 373 | srcs = ["image_decimator.cc"], |
| 374 | visibility = ["//y2022:__subpackages__"], |
| 375 | deps = [ |
| 376 | "//aos:flatbuffers", |
| 377 | "//aos:init", |
| 378 | "//aos/events:shm_event_loop", |
| 379 | "//frc971/vision:vision_fbs", |
| 380 | ], |
| 381 | ) |