blob: 642ca0fe903b385a647b18abb0e016f56a5a3e13 [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",
Ravago Jonesc6b919f2023-01-01 21:34:12 -080080 "//aos/util:threaded_consumer",
Jim Ostrowski977850f2022-01-22 21:04:22 -080081 "@com_github_google_glog//:glog",
82 "@com_google_absl//absl/base",
83 ],
84)
Austin Schuhdcb6b362022-02-25 18:06:21 -080085
86cc_library(
87 name = "charuco_lib",
88 srcs = [
89 "charuco_lib.cc",
90 ],
91 hdrs = [
92 "charuco_lib.h",
93 ],
94 target_compatible_with = ["@platforms//os:linux"],
95 visibility = ["//visibility:public"],
96 deps = [
97 "//aos:flatbuffers",
98 "//aos/events:event_loop",
99 "//aos/network:message_bridge_server_fbs",
100 "//aos/network:team_number",
101 "//frc971/control_loops:quaternion_utils",
102 "//frc971/vision:vision_fbs",
103 "//third_party:opencv",
104 "//y2020/vision/sift:sift_fbs",
105 "//y2020/vision/sift:sift_training_fbs",
106 "//y2020/vision/tools/python_code:sift_training_data",
James Kuszmaul969e4ab2023-01-28 16:09:19 -0800107 "@com_github_foxglove_schemas//:schemas",
Austin Schuhdcb6b362022-02-25 18:06:21 -0800108 "@com_github_google_glog//:glog",
109 "@com_google_absl//absl/strings:str_format",
110 "@com_google_absl//absl/types:span",
111 "@org_tuxfamily_eigen//:eigen",
112 ],
113)
114
115cc_library(
116 name = "extrinsics_calibration",
117 srcs = [
118 "calibration_accumulator.cc",
119 "calibration_accumulator.h",
120 "extrinsics_calibration.cc",
121 "extrinsics_calibration.h",
122 ],
123 target_compatible_with = ["@platforms//os:linux"],
124 visibility = ["//visibility:public"],
125 deps = [
126 ":charuco_lib",
James Kuszmaul969e4ab2023-01-28 16:09:19 -0800127 ":foxglove_image_converter",
Austin Schuhdcb6b362022-02-25 18:06:21 -0800128 "//aos:init",
129 "//aos/events/logging:log_reader",
130 "//frc971/analysis:in_process_plotter",
131 "//frc971/control_loops/drivetrain:improved_down_estimator",
Jim Ostrowskiba2edd12022-12-03 15:44:37 -0800132 "//frc971/vision:visualize_robot",
Austin Schuhdcb6b362022-02-25 18:06:21 -0800133 "//frc971/wpilib:imu_batch_fbs",
134 "//frc971/wpilib:imu_fbs",
135 "//third_party:opencv",
James Kuszmaul969e4ab2023-01-28 16:09:19 -0800136 "@com_github_foxglove_schemas//:CompressedImage_schema",
137 "@com_github_foxglove_schemas//:ImageAnnotations_schema",
Austin Schuhdcb6b362022-02-25 18:06:21 -0800138 "@com_google_absl//absl/strings:str_format",
139 "@com_google_ceres_solver//:ceres",
140 "@org_tuxfamily_eigen//:eigen",
141 ],
142)
Milind Upadhyayb67c6182022-10-22 13:45:45 -0700143
Milind Upadhyaycd677a32022-12-04 13:06:43 -0800144flatbuffer_cc_library(
145 name = "target_map_fbs",
146 srcs = ["target_map.fbs"],
147 gen_reflections = 1,
148 target_compatible_with = ["@platforms//os:linux"],
149 visibility = ["//visibility:public"],
150)
151
Milind Upadhyayb67c6182022-10-22 13:45:45 -0700152cc_library(
Milind Upadhyay7c205222022-11-16 18:20:58 -0800153 name = "target_mapper",
154 srcs = ["target_mapper.cc"],
155 hdrs = ["target_mapper.h"],
Yash Chainanid5c7f0d2022-11-19 17:05:57 -0800156 data = ["target_map.json"],
Milind Upadhyay7c205222022-11-16 18:20:58 -0800157 target_compatible_with = ["@platforms//os:linux"],
158 visibility = ["//visibility:public"],
159 deps = [
160 ":geometry_lib",
Milind Upadhyaycd677a32022-12-04 13:06:43 -0800161 ":target_map_fbs",
Milind Upadhyay7c205222022-11-16 18:20:58 -0800162 "//aos/events:simulated_event_loop",
163 "//frc971/control_loops:control_loop",
Milind Upadhyayc5beba12022-12-17 17:41:20 -0800164 "//frc971/vision/ceres:pose_graph_3d_lib",
Milind Upadhyay7c205222022-11-16 18:20:58 -0800165 "//third_party:opencv",
166 "@com_google_ceres_solver//:ceres",
167 "@org_tuxfamily_eigen//:eigen",
168 ],
169)
170
171cc_test(
172 name = "target_mapper_test",
173 srcs = [
174 "target_mapper_test.cc",
175 ],
Milind Upadhyayc5beba12022-12-17 17:41:20 -0800176 data = [":target_map.json"],
Milind Upadhyay7c205222022-11-16 18:20:58 -0800177 target_compatible_with = ["@platforms//os:linux"],
178 deps = [
179 ":target_mapper",
180 "//aos/events:simulated_event_loop",
181 "//aos/testing:googletest",
Milind Upadhyayc5beba12022-12-17 17:41:20 -0800182 "//aos/testing:path",
Milind Upadhyay7c205222022-11-16 18:20:58 -0800183 "//aos/testing:random_seed",
Milind Upadhyayc5beba12022-12-17 17:41:20 -0800184 "//aos/util:math",
Milind Upadhyay7c205222022-11-16 18:20:58 -0800185 ],
186)
187
188cc_library(
Milind Upadhyayb67c6182022-10-22 13:45:45 -0700189 name = "geometry_lib",
190 hdrs = [
191 "geometry.h",
192 ],
193 target_compatible_with = ["@platforms//os:linux"],
194 visibility = ["//visibility:public"],
195 deps = [
196 "//aos/util:math",
197 "//third_party:opencv",
198 "@com_github_google_glog//:glog",
199 ],
200)
201
202cc_test(
203 name = "geometry_test",
204 srcs = [
205 "geometry_test.cc",
206 ],
207 deps = [
208 ":geometry_lib",
209 "//aos/testing:googletest",
210 ],
211)
Jim Ostrowskiba2edd12022-12-03 15:44:37 -0800212
213cc_library(
214 name = "visualize_robot",
215 srcs = [
216 "visualize_robot.cc",
217 ],
218 hdrs = [
219 "visualize_robot.h",
220 ],
221 deps = [
222 "//aos:init",
223 "//third_party:opencv",
224 "@com_google_absl//absl/strings:str_format",
225 "@org_tuxfamily_eigen//:eigen",
226 ],
227)
228
229cc_binary(
230 name = "visualize_robot_sample",
231 srcs = [
232 "visualize_robot_sample.cc",
233 ],
234 target_compatible_with = ["@platforms//os:linux"],
235 visibility = ["//visibility:public"],
236 deps = [
237 "//aos:init",
238 "//frc971/vision:visualize_robot",
239 "//third_party:opencv",
240 "@com_github_google_glog//:glog",
241 "@com_google_ceres_solver//:ceres",
242 "@org_tuxfamily_eigen//:eigen",
243 ],
244)
Austin Schuhc97d48d2022-12-26 14:09:13 -0800245
246cc_library(
247 name = "media_device",
248 srcs = [
249 "media_device.cc",
250 ],
251 hdrs = ["media_device.h"],
252 visibility = ["//visibility:public"],
253 deps = [
254 "//aos/scoped:scoped_fd",
255 "//aos/util:file",
256 "@com_github_google_glog//:glog",
257 "@com_google_absl//absl/strings",
258 ],
259)
James Kuszmaul0c593962023-01-28 16:04:20 -0800260
261cc_library(
262 name = "foxglove_image_converter",
263 srcs = ["foxglove_image_converter.cc"],
264 hdrs = ["foxglove_image_converter.h"],
265 visibility = ["//visibility:public"],
266 deps = [
James Kuszmaul59a308f2023-01-28 19:14:07 -0800267 ":charuco_lib",
James Kuszmaul0c593962023-01-28 16:04:20 -0800268 ":vision_fbs",
269 "//aos/events:event_loop",
270 "//third_party:opencv",
271 "@com_github_foxglove_schemas//:schemas",
272 ],
273)
James Kuszmaul59a308f2023-01-28 19:14:07 -0800274
275aos_config(
276 name = "converter_config",
277 testonly = True,
278 src = "converter_test_config.json",
279 flatbuffers = [
280 "//frc971/vision:vision_fbs",
281 "//aos/events:event_loop_fbs",
282 "//aos/logging:log_message_fbs",
283 "//aos/network:message_bridge_client_fbs",
284 "//aos/network:message_bridge_server_fbs",
285 "//aos/network:timestamp_fbs",
286 "@com_github_foxglove_schemas//:schemas",
287 ],
288)
289
290cc_test(
291 name = "foxglove_image_converter_test",
292 srcs = ["foxglove_image_converter_test.cc"],
293 data = [
294 ":converter_config",
295 "@april_tag_test_image",
296 ],
297 deps = [
298 ":foxglove_image_converter",
299 "//aos:configuration",
300 "//aos/events:simulated_event_loop",
301 "//aos/testing:googletest",
302 "//aos/testing:path",
303 "//aos/testing:tmpdir",
304 ],
305)