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", |
Henry Speiser | e45e7a2 | 2022-02-04 23:17:01 -0800 | [diff] [blame] | 124 | ":target_estimate_fbs", |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 125 | ":target_estimator_lib", |
Jim Ostrowski | ff7b3de | 2022-01-22 22:20:26 -0800 | [diff] [blame] | 126 | "//aos:flatbuffer_merge", |
| 127 | "//aos/events:event_loop", |
Henry Speiser | 1f34eea | 2022-01-30 14:35:21 -0800 | [diff] [blame] | 128 | "//aos/events:shm_event_loop", |
Jim Ostrowski | ff7b3de | 2022-01-22 22:20:26 -0800 | [diff] [blame] | 129 | "//aos/network:team_number", |
| 130 | "//frc971/vision:v4l2_reader", |
| 131 | "//frc971/vision:vision_fbs", |
| 132 | "//third_party:opencv", |
Milind Upadhyay | d67e9cf | 2022-03-13 13:56:57 -0700 | [diff] [blame] | 133 | "//y2022/localizer:localizer_output_fbs", |
Jim Ostrowski | 007e2ea | 2022-01-30 13:13:26 -0800 | [diff] [blame] | 134 | ], |
| 135 | ) |
| 136 | |
| 137 | cc_binary( |
| 138 | name = "camera_reader", |
| 139 | srcs = [ |
| 140 | "camera_reader_main.cc", |
| 141 | ], |
| 142 | target_compatible_with = ["@platforms//os:linux"], |
| 143 | visibility = ["//y2022:__subpackages__"], |
| 144 | deps = [ |
| 145 | ":camera_reader_lib", |
| 146 | "//aos:init", |
| 147 | "//aos/events:shm_event_loop", |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 148 | ], |
| 149 | ) |
| 150 | |
Ravago Jones | 32bd3cb | 2022-03-26 15:45:03 -0700 | [diff] [blame] | 151 | cc_binary( |
| 152 | name = "ball_color_detector", |
| 153 | srcs = [ |
| 154 | "ball_color_main.cc", |
| 155 | ], |
| 156 | target_compatible_with = ["@platforms//os:linux"], |
| 157 | visibility = ["//y2022:__subpackages__"], |
| 158 | deps = [ |
| 159 | ":ball_color_lib", |
| 160 | "//aos:init", |
| 161 | "//aos/events:shm_event_loop", |
| 162 | ], |
| 163 | ) |
| 164 | |
| 165 | cc_test( |
| 166 | name = "ball_color_test", |
| 167 | srcs = [ |
| 168 | "ball_color_test.cc", |
| 169 | ], |
| 170 | data = [ |
| 171 | "test_ball_color_image.jpg", |
| 172 | ], |
| 173 | deps = [ |
| 174 | ":ball_color_lib", |
| 175 | "//aos:json_to_flatbuffer", |
| 176 | "//aos/events:simulated_event_loop", |
| 177 | "//aos/testing:googletest", |
| 178 | "//aos/testing:test_logging", |
| 179 | "//y2022:constants", |
| 180 | ], |
| 181 | ) |
| 182 | |
| 183 | cc_library( |
| 184 | name = "ball_color_lib", |
| 185 | srcs = [ |
| 186 | "ball_color.cc", |
| 187 | ], |
| 188 | hdrs = [ |
| 189 | "ball_color.h", |
| 190 | ], |
| 191 | data = [ |
| 192 | "//y2022:aos_config", |
| 193 | ], |
| 194 | target_compatible_with = ["@platforms//os:linux"], |
| 195 | visibility = ["//y2022:__subpackages__"], |
| 196 | deps = [ |
| 197 | ":ball_color_fbs", |
| 198 | "//aos/events:event_loop", |
| 199 | "//aos/events:shm_event_loop", |
| 200 | "//aos/network:team_number", |
| 201 | "//frc971/input:joystick_state_fbs", |
| 202 | "//frc971/vision:vision_fbs", |
| 203 | "//third_party:opencv", |
| 204 | ], |
| 205 | ) |
| 206 | |
| 207 | flatbuffer_cc_library( |
| 208 | name = "ball_color_fbs", |
| 209 | srcs = ["ball_color.fbs"], |
| 210 | gen_reflections = 1, |
| 211 | includes = [ |
| 212 | "//frc971/input:joystick_state_fbs_includes", |
| 213 | ], |
| 214 | target_compatible_with = ["@platforms//os:linux"], |
| 215 | visibility = ["//y2022:__subpackages__"], |
| 216 | ) |
| 217 | |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 218 | cc_library( |
| 219 | name = "blob_detector_lib", |
| 220 | srcs = [ |
| 221 | "blob_detector.cc", |
| 222 | ], |
| 223 | hdrs = [ |
| 224 | "blob_detector.h", |
| 225 | ], |
| 226 | target_compatible_with = ["@platforms//os:linux"], |
| 227 | visibility = ["//y2022:__subpackages__"], |
| 228 | deps = [ |
| 229 | "//aos/network:team_number", |
Milind Upadhyay | e7aa40c | 2022-01-29 22:36:21 -0800 | [diff] [blame] | 230 | "//aos/time", |
Milind Upadhyay | b67c618 | 2022-10-22 13:45:45 -0700 | [diff] [blame^] | 231 | "//frc971/vision:geometry_lib", |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 232 | "//third_party:opencv", |
| 233 | ], |
| 234 | ) |
| 235 | |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 236 | cc_library( |
| 237 | name = "target_estimator_lib", |
| 238 | srcs = [ |
| 239 | "target_estimator.cc", |
| 240 | ], |
| 241 | hdrs = [ |
| 242 | "target_estimator.h", |
| 243 | ], |
| 244 | target_compatible_with = ["@platforms//os:linux"], |
| 245 | visibility = ["//y2022:__subpackages__"], |
| 246 | deps = [ |
Milind Upadhyay | 8f38ad8 | 2022-03-03 10:06:18 -0800 | [diff] [blame] | 247 | ":blob_detector_lib", |
Milind Upadhyay | e2f40d7 | 2022-02-24 13:55:53 -0800 | [diff] [blame] | 248 | ":calibration_fbs", |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 249 | ":target_estimate_fbs", |
Milind Upadhyay | f61e148 | 2022-02-11 20:42:55 -0800 | [diff] [blame] | 250 | "//aos/logging", |
| 251 | "//aos/time", |
| 252 | "//frc971/control_loops:quaternion_utils", |
Milind Upadhyay | b67c618 | 2022-10-22 13:45:45 -0700 | [diff] [blame^] | 253 | "//frc971/vision:geometry_lib", |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 254 | "//third_party:opencv", |
milind-u | cafdd5d | 2022-03-01 19:58:57 -0800 | [diff] [blame] | 255 | "//y2022:constants", |
Milind Upadhyay | f61e148 | 2022-02-11 20:42:55 -0800 | [diff] [blame] | 256 | "@com_google_absl//absl/strings:str_format", |
| 257 | "@com_google_ceres_solver//:ceres", |
| 258 | "@org_tuxfamily_eigen//:eigen", |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 259 | ], |
| 260 | ) |
| 261 | |
| 262 | flatbuffer_cc_library( |
| 263 | name = "target_estimate_fbs", |
| 264 | srcs = ["target_estimate.fbs"], |
| 265 | gen_reflections = 1, |
Milind Upadhyay | e2f40d7 | 2022-02-24 13:55:53 -0800 | [diff] [blame] | 266 | includes = [ |
| 267 | ":calibration_fbs_includes", |
| 268 | ], |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 269 | target_compatible_with = ["@platforms//os:linux"], |
| 270 | visibility = ["//y2022:__subpackages__"], |
| 271 | ) |
| 272 | |
Milind Upadhyay | d836bce | 2022-03-25 21:49:57 -0700 | [diff] [blame] | 273 | flatbuffer_ts_library( |
| 274 | name = "target_estimate_ts_fbs", |
| 275 | srcs = ["target_estimate.fbs"], |
| 276 | target_compatible_with = ["@platforms//os:linux"], |
| 277 | deps = [ |
| 278 | ":calibration_ts_fbs", |
| 279 | ], |
| 280 | ) |
| 281 | |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 282 | cc_binary( |
| 283 | name = "viewer", |
| 284 | srcs = [ |
| 285 | "viewer.cc", |
| 286 | ], |
| 287 | data = [ |
Austin Schuh | c5fa6d9 | 2022-02-25 14:36:28 -0800 | [diff] [blame] | 288 | "//y2022:aos_config", |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 289 | ], |
| 290 | target_compatible_with = ["@platforms//os:linux"], |
| 291 | visibility = ["//y2022:__subpackages__"], |
| 292 | deps = [ |
| 293 | ":blob_detector_lib", |
milind-u | cafdd5d | 2022-03-01 19:58:57 -0800 | [diff] [blame] | 294 | ":calibration_data", |
Milind Upadhyay | a31f027 | 2022-04-03 13:55:22 -0700 | [diff] [blame] | 295 | ":camera_reader_lib", |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 296 | ":target_estimator_lib", |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 297 | "//aos:init", |
| 298 | "//aos/events:shm_event_loop", |
Jim Ostrowski | 977850f | 2022-01-22 21:04:22 -0800 | [diff] [blame] | 299 | "//frc971/vision:vision_fbs", |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 300 | "//third_party:opencv", |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 301 | ], |
| 302 | ) |
Austin Schuh | 3e14588 | 2022-02-26 16:48:43 -0800 | [diff] [blame] | 303 | |
| 304 | cc_binary( |
Milind Upadhyay | b7e3c24 | 2022-03-12 20:05:25 -0800 | [diff] [blame] | 305 | name = "viewer_replay", |
| 306 | srcs = [ |
| 307 | "viewer_replay.cc", |
| 308 | ], |
| 309 | data = [ |
| 310 | "//y2022:aos_config", |
| 311 | ], |
| 312 | target_compatible_with = ["@platforms//os:linux"], |
| 313 | visibility = ["//y2022:__subpackages__"], |
| 314 | deps = [ |
| 315 | ":blob_detector_lib", |
| 316 | "//aos:init", |
| 317 | "//aos/events:simulated_event_loop", |
| 318 | "//aos/events/logging:log_reader", |
Milind Upadhyay | e321586 | 2022-03-24 19:59:19 -0700 | [diff] [blame] | 319 | "//frc971/control_loops:control_loops_fbs", |
| 320 | "//frc971/control_loops:profiled_subsystem_fbs", |
| 321 | "//frc971/control_loops/drivetrain:drivetrain_status_fbs", |
| 322 | "//frc971/input:joystick_state_fbs", |
Milind Upadhyay | b7e3c24 | 2022-03-12 20:05:25 -0800 | [diff] [blame] | 323 | "//frc971/vision:vision_fbs", |
| 324 | "//third_party:opencv", |
Milind Upadhyay | e321586 | 2022-03-24 19:59:19 -0700 | [diff] [blame] | 325 | "//y2022/control_loops/superstructure:superstructure_status_fbs", |
Milind Upadhyay | b7e3c24 | 2022-03-12 20:05:25 -0800 | [diff] [blame] | 326 | ], |
| 327 | ) |
| 328 | |
| 329 | cc_binary( |
Austin Schuh | 3e14588 | 2022-02-26 16:48:43 -0800 | [diff] [blame] | 330 | name = "extrinsics_calibration", |
| 331 | srcs = [ |
| 332 | "extrinsics_calibration.cc", |
| 333 | ], |
| 334 | target_compatible_with = ["@platforms//os:linux"], |
| 335 | visibility = ["//y2022:__subpackages__"], |
| 336 | deps = [ |
| 337 | "//aos:init", |
| 338 | "//aos/events/logging:log_reader", |
| 339 | "//frc971/control_loops:profiled_subsystem_fbs", |
| 340 | "//frc971/vision:extrinsics_calibration", |
| 341 | "//y2022/control_loops/superstructure:superstructure_status_fbs", |
| 342 | ], |
| 343 | ) |
James Kuszmaul | 3eb753d | 2022-03-12 15:21:12 -0800 | [diff] [blame] | 344 | |
| 345 | cc_binary( |
| 346 | name = "image_decimator", |
| 347 | srcs = ["image_decimator.cc"], |
| 348 | visibility = ["//y2022:__subpackages__"], |
| 349 | deps = [ |
| 350 | "//aos:flatbuffers", |
| 351 | "//aos:init", |
| 352 | "//aos/events:shm_event_loop", |
| 353 | "//frc971/vision:vision_fbs", |
| 354 | ], |
| 355 | ) |