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