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