Jim Ostrowski | 007e2ea | 2022-01-30 13:13:26 -0800 | [diff] [blame] | 1 | load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_py_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 | |
| 12 | flatbuffer_py_library( |
| 13 | name = "calibration_fbs_python", |
| 14 | srcs = [ |
| 15 | "calibration.fbs", |
| 16 | ], |
| 17 | namespace = "frc971.vision.calibration", |
| 18 | tables = [ |
| 19 | "CalibrationData", |
| 20 | "CameraCalibration", |
| 21 | "TransformationMatrix", |
| 22 | ], |
| 23 | target_compatible_with = ["@platforms//os:linux"], |
| 24 | visibility = ["//visibility:public"], |
| 25 | ) |
| 26 | |
James Kuszmaul | b35e234 | 2022-03-06 15:44:00 -0800 | [diff] [blame] | 27 | ts_library( |
| 28 | name = "vision_plotter", |
| 29 | srcs = ["vision_plotter.ts"], |
| 30 | target_compatible_with = ["@platforms//os:linux"], |
| 31 | visibility = ["//visibility:public"], |
| 32 | deps = [ |
| 33 | "//aos/network/www:aos_plotter", |
| 34 | "//aos/network/www:colors", |
| 35 | "//aos/network/www:proxy", |
| 36 | ], |
| 37 | ) |
| 38 | |
Jim Ostrowski | 007e2ea | 2022-01-30 13:13:26 -0800 | [diff] [blame] | 39 | py_library( |
| 40 | name = "camera_definition", |
| 41 | srcs = [ |
| 42 | "camera_definition.py", |
| 43 | ], |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 44 | deps = [ |
Jim Ostrowski | 007e2ea | 2022-01-30 13:13:26 -0800 | [diff] [blame] | 45 | "//external:python-glog", |
| 46 | ], |
| 47 | ) |
| 48 | |
| 49 | py_binary( |
| 50 | name = "create_calib_file", |
| 51 | srcs = [ |
| 52 | "create_calib_file.py", |
| 53 | ], |
| 54 | args = [ |
| 55 | "calibration_data.h", |
| 56 | ], |
| 57 | data = glob(["calib_files/*.json"]), |
| 58 | target_compatible_with = ["@platforms//os:linux"], |
| 59 | deps = [ |
| 60 | ":camera_definition", |
| 61 | "//external:python-glog", |
| 62 | "//y2022/vision:calibration_fbs_python", |
| 63 | "@bazel_tools//tools/python/runfiles", |
| 64 | "@opencv_contrib_nonfree_amd64//:python_opencv", |
| 65 | ], |
| 66 | ) |
| 67 | |
| 68 | genrule( |
| 69 | name = "run_calibration_data", |
| 70 | outs = [ |
| 71 | "calibration_data.h", |
| 72 | ], |
| 73 | cmd = " ".join([ |
| 74 | "$(location :create_calib_file)", |
| 75 | "$(location calibration_data.h)", |
| 76 | ]), |
| 77 | target_compatible_with = ["@platforms//os:linux"], |
| 78 | tools = [ |
| 79 | ":create_calib_file", |
| 80 | ], |
| 81 | ) |
| 82 | |
| 83 | cc_library( |
| 84 | name = "calibration_data", |
| 85 | hdrs = [ |
| 86 | "calibration_data.h", |
| 87 | ], |
| 88 | target_compatible_with = ["@platforms//os:linux"], |
| 89 | visibility = ["//visibility:public"], |
| 90 | deps = [ |
| 91 | "@com_google_absl//absl/types:span", |
Jim Ostrowski | ff7b3de | 2022-01-22 22:20:26 -0800 | [diff] [blame] | 92 | ], |
| 93 | ) |
| 94 | |
| 95 | cc_library( |
| 96 | name = "camera_reader_lib", |
| 97 | srcs = [ |
| 98 | "camera_reader.cc", |
| 99 | ], |
| 100 | hdrs = [ |
| 101 | "camera_reader.h", |
Jim Ostrowski | 2a483b3 | 2022-02-15 18:19:14 -0800 | [diff] [blame] | 102 | "gpio.h", |
Jim Ostrowski | ff7b3de | 2022-01-22 22:20:26 -0800 | [diff] [blame] | 103 | ], |
| 104 | data = [ |
Austin Schuh | c5fa6d9 | 2022-02-25 14:36:28 -0800 | [diff] [blame] | 105 | "//y2022:aos_config", |
Jim Ostrowski | ff7b3de | 2022-01-22 22:20:26 -0800 | [diff] [blame] | 106 | ], |
| 107 | target_compatible_with = ["@platforms//os:linux"], |
| 108 | visibility = ["//y2022:__subpackages__"], |
| 109 | deps = [ |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 110 | ":blob_detector_lib", |
Jim Ostrowski | 007e2ea | 2022-01-30 13:13:26 -0800 | [diff] [blame] | 111 | ":calibration_data", |
| 112 | ":calibration_fbs", |
milind-u | db98afa | 2022-03-01 19:54:57 -0800 | [diff] [blame] | 113 | ":geometry_lib", |
Henry Speiser | e45e7a2 | 2022-02-04 23:17:01 -0800 | [diff] [blame] | 114 | ":target_estimate_fbs", |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 115 | ":target_estimator_lib", |
Jim Ostrowski | ff7b3de | 2022-01-22 22:20:26 -0800 | [diff] [blame] | 116 | "//aos:flatbuffer_merge", |
| 117 | "//aos/events:event_loop", |
Henry Speiser | 1f34eea | 2022-01-30 14:35:21 -0800 | [diff] [blame] | 118 | "//aos/events:shm_event_loop", |
Jim Ostrowski | ff7b3de | 2022-01-22 22:20:26 -0800 | [diff] [blame] | 119 | "//aos/network:team_number", |
| 120 | "//frc971/vision:v4l2_reader", |
| 121 | "//frc971/vision:vision_fbs", |
| 122 | "//third_party:opencv", |
Milind Upadhyay | d67e9cf | 2022-03-13 13:56:57 -0700 | [diff] [blame^] | 123 | "//y2022/localizer:localizer_output_fbs", |
Jim Ostrowski | 007e2ea | 2022-01-30 13:13:26 -0800 | [diff] [blame] | 124 | ], |
| 125 | ) |
| 126 | |
| 127 | cc_binary( |
| 128 | name = "camera_reader", |
| 129 | srcs = [ |
| 130 | "camera_reader_main.cc", |
| 131 | ], |
| 132 | target_compatible_with = ["@platforms//os:linux"], |
| 133 | visibility = ["//y2022:__subpackages__"], |
| 134 | deps = [ |
| 135 | ":camera_reader_lib", |
| 136 | "//aos:init", |
| 137 | "//aos/events:shm_event_loop", |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 138 | ], |
| 139 | ) |
| 140 | |
| 141 | cc_library( |
milind-u | db98afa | 2022-03-01 19:54:57 -0800 | [diff] [blame] | 142 | name = "geometry_lib", |
| 143 | hdrs = [ |
| 144 | "geometry.h", |
| 145 | ], |
| 146 | target_compatible_with = ["@platforms//os:linux"], |
| 147 | visibility = ["//y2022:__subpackages__"], |
| 148 | deps = [ |
| 149 | "//aos/util:math", |
| 150 | "//third_party:opencv", |
| 151 | "@com_github_google_glog//:glog", |
| 152 | ], |
| 153 | ) |
| 154 | |
| 155 | cc_test( |
| 156 | name = "geometry_test", |
| 157 | srcs = [ |
| 158 | "geometry_test.cc", |
| 159 | ], |
| 160 | deps = [ |
| 161 | ":geometry_lib", |
| 162 | "//aos/testing:googletest", |
| 163 | ], |
| 164 | ) |
| 165 | |
| 166 | cc_library( |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 167 | name = "blob_detector_lib", |
| 168 | srcs = [ |
| 169 | "blob_detector.cc", |
| 170 | ], |
| 171 | hdrs = [ |
| 172 | "blob_detector.h", |
| 173 | ], |
| 174 | target_compatible_with = ["@platforms//os:linux"], |
| 175 | visibility = ["//y2022:__subpackages__"], |
| 176 | deps = [ |
milind-u | db98afa | 2022-03-01 19:54:57 -0800 | [diff] [blame] | 177 | ":geometry_lib", |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 178 | "//aos/network:team_number", |
Milind Upadhyay | e7aa40c | 2022-01-29 22:36:21 -0800 | [diff] [blame] | 179 | "//aos/time", |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 180 | "//third_party:opencv", |
| 181 | ], |
| 182 | ) |
| 183 | |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 184 | cc_library( |
| 185 | name = "target_estimator_lib", |
| 186 | srcs = [ |
| 187 | "target_estimator.cc", |
| 188 | ], |
| 189 | hdrs = [ |
| 190 | "target_estimator.h", |
| 191 | ], |
| 192 | target_compatible_with = ["@platforms//os:linux"], |
| 193 | visibility = ["//y2022:__subpackages__"], |
| 194 | deps = [ |
Milind Upadhyay | 8f38ad8 | 2022-03-03 10:06:18 -0800 | [diff] [blame] | 195 | ":blob_detector_lib", |
Milind Upadhyay | e2f40d7 | 2022-02-24 13:55:53 -0800 | [diff] [blame] | 196 | ":calibration_fbs", |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 197 | ":target_estimate_fbs", |
Milind Upadhyay | f61e148 | 2022-02-11 20:42:55 -0800 | [diff] [blame] | 198 | "//aos/logging", |
| 199 | "//aos/time", |
| 200 | "//frc971/control_loops:quaternion_utils", |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 201 | "//third_party:opencv", |
milind-u | cafdd5d | 2022-03-01 19:58:57 -0800 | [diff] [blame] | 202 | "//y2022:constants", |
Milind Upadhyay | f61e148 | 2022-02-11 20:42:55 -0800 | [diff] [blame] | 203 | "@com_google_absl//absl/strings:str_format", |
| 204 | "@com_google_ceres_solver//:ceres", |
| 205 | "@org_tuxfamily_eigen//:eigen", |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 206 | ], |
| 207 | ) |
| 208 | |
| 209 | flatbuffer_cc_library( |
| 210 | name = "target_estimate_fbs", |
| 211 | srcs = ["target_estimate.fbs"], |
| 212 | gen_reflections = 1, |
Milind Upadhyay | e2f40d7 | 2022-02-24 13:55:53 -0800 | [diff] [blame] | 213 | includes = [ |
| 214 | ":calibration_fbs_includes", |
| 215 | ], |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 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_binary( |
| 221 | name = "viewer", |
| 222 | srcs = [ |
| 223 | "viewer.cc", |
| 224 | ], |
| 225 | data = [ |
Austin Schuh | c5fa6d9 | 2022-02-25 14:36:28 -0800 | [diff] [blame] | 226 | "//y2022:aos_config", |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 227 | ], |
| 228 | target_compatible_with = ["@platforms//os:linux"], |
| 229 | visibility = ["//y2022:__subpackages__"], |
| 230 | deps = [ |
| 231 | ":blob_detector_lib", |
milind-u | cafdd5d | 2022-03-01 19:58:57 -0800 | [diff] [blame] | 232 | ":calibration_data", |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 233 | ":target_estimator_lib", |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 234 | "//aos:init", |
| 235 | "//aos/events:shm_event_loop", |
Jim Ostrowski | 977850f | 2022-01-22 21:04:22 -0800 | [diff] [blame] | 236 | "//frc971/vision:vision_fbs", |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 237 | "//third_party:opencv", |
Jim Ostrowski | ff0f5e4 | 2022-01-22 01:35:31 -0800 | [diff] [blame] | 238 | ], |
| 239 | ) |
Austin Schuh | 3e14588 | 2022-02-26 16:48:43 -0800 | [diff] [blame] | 240 | |
| 241 | cc_binary( |
| 242 | name = "extrinsics_calibration", |
| 243 | srcs = [ |
| 244 | "extrinsics_calibration.cc", |
| 245 | ], |
| 246 | target_compatible_with = ["@platforms//os:linux"], |
| 247 | visibility = ["//y2022:__subpackages__"], |
| 248 | deps = [ |
| 249 | "//aos:init", |
| 250 | "//aos/events/logging:log_reader", |
| 251 | "//frc971/control_loops:profiled_subsystem_fbs", |
| 252 | "//frc971/vision:extrinsics_calibration", |
| 253 | "//y2022/control_loops/superstructure:superstructure_status_fbs", |
| 254 | ], |
| 255 | ) |
James Kuszmaul | 3eb753d | 2022-03-12 15:21:12 -0800 | [diff] [blame] | 256 | |
| 257 | cc_binary( |
| 258 | name = "image_decimator", |
| 259 | srcs = ["image_decimator.cc"], |
| 260 | visibility = ["//y2022:__subpackages__"], |
| 261 | deps = [ |
| 262 | "//aos:flatbuffers", |
| 263 | "//aos:init", |
| 264 | "//aos/events:shm_event_loop", |
| 265 | "//frc971/vision:vision_fbs", |
| 266 | ], |
| 267 | ) |