blob: 5d20affc0d9078cd273571b268d63a01ecd0e65a [file] [log] [blame]
milind-u2f101fc2023-01-21 12:28:49 -08001load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_py_library")
James Kuszmaul59a308f2023-01-28 19:14:07 -08002load("//aos:config.bzl", "aos_config")
Austin Schuha1d006e2022-09-14 21:50:42 -07003load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library")
Jim Ostrowski977850f2022-01-22 21:04:22 -08004
5flatbuffer_cc_library(
6 name = "vision_fbs",
7 srcs = ["vision.fbs"],
8 gen_reflections = 1,
9 target_compatible_with = ["@platforms//os:linux"],
10 visibility = ["//visibility:public"],
11)
12
13flatbuffer_ts_library(
14 name = "vision_ts_fbs",
15 srcs = ["vision.fbs"],
16 target_compatible_with = ["@platforms//os:linux"],
17 visibility = ["//visibility:public"],
18)
19
milind-u2f101fc2023-01-21 12:28:49 -080020flatbuffer_cc_library(
21 name = "calibration_fbs",
22 srcs = ["calibration.fbs"],
23 gen_reflections = 1,
24 target_compatible_with = ["@platforms//os:linux"],
25 visibility = ["//visibility:public"],
26)
27
28flatbuffer_ts_library(
29 name = "calibration_ts_fbs",
30 srcs = ["calibration.fbs"],
31 target_compatible_with = ["@platforms//os:linux"],
32 visibility = ["//visibility:public"],
33)
34
35flatbuffer_py_library(
36 name = "calibration_fbs_python",
37 srcs = [
38 "calibration.fbs",
39 ],
40 namespace = "frc971.vision.calibration",
41 tables = [
42 "CalibrationData",
43 "CameraCalibration",
44 "TransformationMatrix",
45 ],
46 target_compatible_with = ["@platforms//os:linux"],
47 visibility = ["//visibility:public"],
48)
49
milind-u959d6bd2023-01-21 12:32:52 -080050py_library(
51 name = "create_calib_file",
52 srcs = [
53 "create_calib_file.py",
54 ],
55 target_compatible_with = ["@platforms//os:linux"],
56 visibility = ["//visibility:public"],
57 deps = [
58 ":calibration_fbs_python",
59 "@bazel_tools//tools/python/runfiles",
60 "@pip//glog",
61 "@pip//opencv_python",
62 ],
63)
64
Jim Ostrowski977850f2022-01-22 21:04:22 -080065cc_library(
66 name = "v4l2_reader",
67 srcs = [
68 "v4l2_reader.cc",
69 ],
70 hdrs = [
71 "v4l2_reader.h",
72 ],
73 target_compatible_with = ["@platforms//os:linux"],
74 visibility = ["//visibility:public"],
75 deps = [
76 ":vision_fbs",
Ravago Jonesdc524752022-12-27 01:15:13 -080077 "//aos/events:epoll",
Jim Ostrowski977850f2022-01-22 21:04:22 -080078 "//aos/events:event_loop",
79 "//aos/scoped:scoped_fd",
80 "@com_github_google_glog//:glog",
81 "@com_google_absl//absl/base",
82 ],
83)
Austin Schuhdcb6b362022-02-25 18:06:21 -080084
85cc_library(
86 name = "charuco_lib",
87 srcs = [
88 "charuco_lib.cc",
89 ],
90 hdrs = [
91 "charuco_lib.h",
92 ],
93 target_compatible_with = ["@platforms//os:linux"],
94 visibility = ["//visibility:public"],
95 deps = [
96 "//aos:flatbuffers",
97 "//aos/events:event_loop",
98 "//aos/network:message_bridge_server_fbs",
99 "//aos/network:team_number",
100 "//frc971/control_loops:quaternion_utils",
101 "//frc971/vision:vision_fbs",
102 "//third_party:opencv",
103 "//y2020/vision/sift:sift_fbs",
104 "//y2020/vision/sift:sift_training_fbs",
105 "//y2020/vision/tools/python_code:sift_training_data",
James Kuszmaul969e4ab2023-01-28 16:09:19 -0800106 "@com_github_foxglove_schemas//:schemas",
Austin Schuhdcb6b362022-02-25 18:06:21 -0800107 "@com_github_google_glog//:glog",
108 "@com_google_absl//absl/strings:str_format",
109 "@com_google_absl//absl/types:span",
110 "@org_tuxfamily_eigen//:eigen",
111 ],
112)
113
114cc_library(
115 name = "extrinsics_calibration",
116 srcs = [
117 "calibration_accumulator.cc",
118 "calibration_accumulator.h",
119 "extrinsics_calibration.cc",
120 "extrinsics_calibration.h",
121 ],
122 target_compatible_with = ["@platforms//os:linux"],
123 visibility = ["//visibility:public"],
124 deps = [
125 ":charuco_lib",
James Kuszmaul969e4ab2023-01-28 16:09:19 -0800126 ":foxglove_image_converter",
Austin Schuhdcb6b362022-02-25 18:06:21 -0800127 "//aos:init",
128 "//aos/events/logging:log_reader",
129 "//frc971/analysis:in_process_plotter",
130 "//frc971/control_loops/drivetrain:improved_down_estimator",
Jim Ostrowskiba2edd12022-12-03 15:44:37 -0800131 "//frc971/vision:visualize_robot",
Austin Schuhdcb6b362022-02-25 18:06:21 -0800132 "//frc971/wpilib:imu_batch_fbs",
133 "//frc971/wpilib:imu_fbs",
134 "//third_party:opencv",
James Kuszmaul969e4ab2023-01-28 16:09:19 -0800135 "@com_github_foxglove_schemas//:CompressedImage_schema",
136 "@com_github_foxglove_schemas//:ImageAnnotations_schema",
Austin Schuhdcb6b362022-02-25 18:06:21 -0800137 "@com_google_absl//absl/strings:str_format",
138 "@com_google_ceres_solver//:ceres",
139 "@org_tuxfamily_eigen//:eigen",
140 ],
141)
Milind Upadhyayb67c6182022-10-22 13:45:45 -0700142
Milind Upadhyaycd677a32022-12-04 13:06:43 -0800143flatbuffer_cc_library(
144 name = "target_map_fbs",
145 srcs = ["target_map.fbs"],
146 gen_reflections = 1,
147 target_compatible_with = ["@platforms//os:linux"],
148 visibility = ["//visibility:public"],
149)
150
Milind Upadhyayb67c6182022-10-22 13:45:45 -0700151cc_library(
Milind Upadhyay7c205222022-11-16 18:20:58 -0800152 name = "target_mapper",
153 srcs = ["target_mapper.cc"],
154 hdrs = ["target_mapper.h"],
Yash Chainanid5c7f0d2022-11-19 17:05:57 -0800155 data = ["target_map.json"],
Milind Upadhyay7c205222022-11-16 18:20:58 -0800156 target_compatible_with = ["@platforms//os:linux"],
157 visibility = ["//visibility:public"],
158 deps = [
159 ":geometry_lib",
Milind Upadhyaycd677a32022-12-04 13:06:43 -0800160 ":target_map_fbs",
Milind Upadhyay7c205222022-11-16 18:20:58 -0800161 "//aos/events:simulated_event_loop",
162 "//frc971/control_loops:control_loop",
Milind Upadhyayc5beba12022-12-17 17:41:20 -0800163 "//frc971/vision/ceres:pose_graph_3d_lib",
Milind Upadhyay7c205222022-11-16 18:20:58 -0800164 "//third_party:opencv",
165 "@com_google_ceres_solver//:ceres",
166 "@org_tuxfamily_eigen//:eigen",
167 ],
168)
169
170cc_test(
171 name = "target_mapper_test",
172 srcs = [
173 "target_mapper_test.cc",
174 ],
Milind Upadhyayc5beba12022-12-17 17:41:20 -0800175 data = [":target_map.json"],
Milind Upadhyay7c205222022-11-16 18:20:58 -0800176 target_compatible_with = ["@platforms//os:linux"],
177 deps = [
178 ":target_mapper",
179 "//aos/events:simulated_event_loop",
180 "//aos/testing:googletest",
Milind Upadhyayc5beba12022-12-17 17:41:20 -0800181 "//aos/testing:path",
Milind Upadhyay7c205222022-11-16 18:20:58 -0800182 "//aos/testing:random_seed",
Milind Upadhyayc5beba12022-12-17 17:41:20 -0800183 "//aos/util:math",
Milind Upadhyay7c205222022-11-16 18:20:58 -0800184 ],
185)
186
187cc_library(
Milind Upadhyayb67c6182022-10-22 13:45:45 -0700188 name = "geometry_lib",
189 hdrs = [
190 "geometry.h",
191 ],
192 target_compatible_with = ["@platforms//os:linux"],
193 visibility = ["//visibility:public"],
194 deps = [
195 "//aos/util:math",
196 "//third_party:opencv",
197 "@com_github_google_glog//:glog",
198 ],
199)
200
201cc_test(
202 name = "geometry_test",
203 srcs = [
204 "geometry_test.cc",
205 ],
206 deps = [
207 ":geometry_lib",
208 "//aos/testing:googletest",
209 ],
210)
Jim Ostrowskiba2edd12022-12-03 15:44:37 -0800211
212cc_library(
213 name = "visualize_robot",
214 srcs = [
215 "visualize_robot.cc",
216 ],
217 hdrs = [
218 "visualize_robot.h",
219 ],
220 deps = [
221 "//aos:init",
222 "//third_party:opencv",
223 "@com_google_absl//absl/strings:str_format",
224 "@org_tuxfamily_eigen//:eigen",
225 ],
226)
227
228cc_binary(
229 name = "visualize_robot_sample",
230 srcs = [
231 "visualize_robot_sample.cc",
232 ],
233 target_compatible_with = ["@platforms//os:linux"],
234 visibility = ["//visibility:public"],
235 deps = [
236 "//aos:init",
237 "//frc971/vision:visualize_robot",
238 "//third_party:opencv",
239 "@com_github_google_glog//:glog",
240 "@com_google_ceres_solver//:ceres",
241 "@org_tuxfamily_eigen//:eigen",
242 ],
243)
Austin Schuhc97d48d2022-12-26 14:09:13 -0800244
245cc_library(
246 name = "media_device",
247 srcs = [
248 "media_device.cc",
249 ],
250 hdrs = ["media_device.h"],
251 visibility = ["//visibility:public"],
252 deps = [
253 "//aos/scoped:scoped_fd",
254 "//aos/util:file",
255 "@com_github_google_glog//:glog",
256 "@com_google_absl//absl/strings",
257 ],
258)
James Kuszmaul0c593962023-01-28 16:04:20 -0800259
260cc_library(
261 name = "foxglove_image_converter",
262 srcs = ["foxglove_image_converter.cc"],
263 hdrs = ["foxglove_image_converter.h"],
264 visibility = ["//visibility:public"],
265 deps = [
James Kuszmaul59a308f2023-01-28 19:14:07 -0800266 ":charuco_lib",
James Kuszmaul0c593962023-01-28 16:04:20 -0800267 ":vision_fbs",
268 "//aos/events:event_loop",
269 "//third_party:opencv",
270 "@com_github_foxglove_schemas//:schemas",
271 ],
272)
James Kuszmaul59a308f2023-01-28 19:14:07 -0800273
274aos_config(
275 name = "converter_config",
276 testonly = True,
277 src = "converter_test_config.json",
278 flatbuffers = [
279 "//frc971/vision:vision_fbs",
280 "//aos/events:event_loop_fbs",
281 "//aos/logging:log_message_fbs",
282 "//aos/network:message_bridge_client_fbs",
283 "//aos/network:message_bridge_server_fbs",
284 "//aos/network:timestamp_fbs",
285 "@com_github_foxglove_schemas//:schemas",
286 ],
287)
288
289cc_test(
290 name = "foxglove_image_converter_test",
291 srcs = ["foxglove_image_converter_test.cc"],
292 data = [
293 ":converter_config",
294 "@april_tag_test_image",
295 ],
296 deps = [
297 ":foxglove_image_converter",
298 "//aos:configuration",
299 "//aos/events:simulated_event_loop",
300 "//aos/testing:googletest",
301 "//aos/testing:path",
302 "//aos/testing:tmpdir",
303 ],
304)