blob: c52afaee4f033fea36cf2f0277540833c2d30f56 [file] [log] [blame]
milind-u2f101fc2023-01-21 12:28:49 -08001load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_py_library")
Austin Schuha1d006e2022-09-14 21:50:42 -07002load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library")
Jim Ostrowski977850f2022-01-22 21:04:22 -08003
4flatbuffer_cc_library(
5 name = "vision_fbs",
6 srcs = ["vision.fbs"],
7 gen_reflections = 1,
8 target_compatible_with = ["@platforms//os:linux"],
9 visibility = ["//visibility:public"],
10)
11
12flatbuffer_ts_library(
13 name = "vision_ts_fbs",
14 srcs = ["vision.fbs"],
15 target_compatible_with = ["@platforms//os:linux"],
16 visibility = ["//visibility:public"],
17)
18
milind-u2f101fc2023-01-21 12:28:49 -080019flatbuffer_cc_library(
20 name = "calibration_fbs",
21 srcs = ["calibration.fbs"],
22 gen_reflections = 1,
23 target_compatible_with = ["@platforms//os:linux"],
24 visibility = ["//visibility:public"],
25)
26
27flatbuffer_ts_library(
28 name = "calibration_ts_fbs",
29 srcs = ["calibration.fbs"],
30 target_compatible_with = ["@platforms//os:linux"],
31 visibility = ["//visibility:public"],
32)
33
34flatbuffer_py_library(
35 name = "calibration_fbs_python",
36 srcs = [
37 "calibration.fbs",
38 ],
39 namespace = "frc971.vision.calibration",
40 tables = [
41 "CalibrationData",
42 "CameraCalibration",
43 "TransformationMatrix",
44 ],
45 target_compatible_with = ["@platforms//os:linux"],
46 visibility = ["//visibility:public"],
47)
48
milind-u959d6bd2023-01-21 12:32:52 -080049py_library(
50 name = "create_calib_file",
51 srcs = [
52 "create_calib_file.py",
53 ],
54 target_compatible_with = ["@platforms//os:linux"],
55 visibility = ["//visibility:public"],
56 deps = [
57 ":calibration_fbs_python",
58 "@bazel_tools//tools/python/runfiles",
59 "@pip//glog",
60 "@pip//opencv_python",
61 ],
62)
63
Jim Ostrowski977850f2022-01-22 21:04:22 -080064cc_library(
65 name = "v4l2_reader",
66 srcs = [
67 "v4l2_reader.cc",
68 ],
69 hdrs = [
70 "v4l2_reader.h",
71 ],
72 target_compatible_with = ["@platforms//os:linux"],
73 visibility = ["//visibility:public"],
74 deps = [
75 ":vision_fbs",
Ravago Jonesdc524752022-12-27 01:15:13 -080076 "//aos/events:epoll",
Jim Ostrowski977850f2022-01-22 21:04:22 -080077 "//aos/events:event_loop",
78 "//aos/scoped:scoped_fd",
79 "@com_github_google_glog//:glog",
80 "@com_google_absl//absl/base",
81 ],
82)
Austin Schuhdcb6b362022-02-25 18:06:21 -080083
84cc_library(
85 name = "charuco_lib",
86 srcs = [
87 "charuco_lib.cc",
88 ],
89 hdrs = [
90 "charuco_lib.h",
91 ],
92 target_compatible_with = ["@platforms//os:linux"],
93 visibility = ["//visibility:public"],
94 deps = [
95 "//aos:flatbuffers",
96 "//aos/events:event_loop",
97 "//aos/network:message_bridge_server_fbs",
98 "//aos/network:team_number",
99 "//frc971/control_loops:quaternion_utils",
100 "//frc971/vision:vision_fbs",
101 "//third_party:opencv",
102 "//y2020/vision/sift:sift_fbs",
103 "//y2020/vision/sift:sift_training_fbs",
104 "//y2020/vision/tools/python_code:sift_training_data",
105 "@com_github_google_glog//:glog",
106 "@com_google_absl//absl/strings:str_format",
107 "@com_google_absl//absl/types:span",
108 "@org_tuxfamily_eigen//:eigen",
109 ],
110)
111
112cc_library(
113 name = "extrinsics_calibration",
114 srcs = [
115 "calibration_accumulator.cc",
116 "calibration_accumulator.h",
117 "extrinsics_calibration.cc",
118 "extrinsics_calibration.h",
119 ],
120 target_compatible_with = ["@platforms//os:linux"],
121 visibility = ["//visibility:public"],
122 deps = [
123 ":charuco_lib",
124 "//aos:init",
125 "//aos/events/logging:log_reader",
126 "//frc971/analysis:in_process_plotter",
127 "//frc971/control_loops/drivetrain:improved_down_estimator",
Jim Ostrowskiba2edd12022-12-03 15:44:37 -0800128 "//frc971/vision:visualize_robot",
Austin Schuhdcb6b362022-02-25 18:06:21 -0800129 "//frc971/wpilib:imu_batch_fbs",
130 "//frc971/wpilib:imu_fbs",
131 "//third_party:opencv",
132 "@com_google_absl//absl/strings:str_format",
133 "@com_google_ceres_solver//:ceres",
134 "@org_tuxfamily_eigen//:eigen",
135 ],
136)
Milind Upadhyayb67c6182022-10-22 13:45:45 -0700137
Milind Upadhyaycd677a32022-12-04 13:06:43 -0800138flatbuffer_cc_library(
139 name = "target_map_fbs",
140 srcs = ["target_map.fbs"],
141 gen_reflections = 1,
142 target_compatible_with = ["@platforms//os:linux"],
143 visibility = ["//visibility:public"],
144)
145
Milind Upadhyayb67c6182022-10-22 13:45:45 -0700146cc_library(
Milind Upadhyay7c205222022-11-16 18:20:58 -0800147 name = "target_mapper",
148 srcs = ["target_mapper.cc"],
149 hdrs = ["target_mapper.h"],
Yash Chainanid5c7f0d2022-11-19 17:05:57 -0800150 data = ["target_map.json"],
Milind Upadhyay7c205222022-11-16 18:20:58 -0800151 target_compatible_with = ["@platforms//os:linux"],
152 visibility = ["//visibility:public"],
153 deps = [
154 ":geometry_lib",
Milind Upadhyaycd677a32022-12-04 13:06:43 -0800155 ":target_map_fbs",
Milind Upadhyay7c205222022-11-16 18:20:58 -0800156 "//aos/events:simulated_event_loop",
157 "//frc971/control_loops:control_loop",
Milind Upadhyayc5beba12022-12-17 17:41:20 -0800158 "//frc971/vision/ceres:pose_graph_3d_lib",
Milind Upadhyay7c205222022-11-16 18:20:58 -0800159 "//third_party:opencv",
160 "@com_google_ceres_solver//:ceres",
161 "@org_tuxfamily_eigen//:eigen",
162 ],
163)
164
165cc_test(
166 name = "target_mapper_test",
167 srcs = [
168 "target_mapper_test.cc",
169 ],
Milind Upadhyayc5beba12022-12-17 17:41:20 -0800170 data = [":target_map.json"],
Milind Upadhyay7c205222022-11-16 18:20:58 -0800171 target_compatible_with = ["@platforms//os:linux"],
172 deps = [
173 ":target_mapper",
174 "//aos/events:simulated_event_loop",
175 "//aos/testing:googletest",
Milind Upadhyayc5beba12022-12-17 17:41:20 -0800176 "//aos/testing:path",
Milind Upadhyay7c205222022-11-16 18:20:58 -0800177 "//aos/testing:random_seed",
Milind Upadhyayc5beba12022-12-17 17:41:20 -0800178 "//aos/util:math",
Milind Upadhyay7c205222022-11-16 18:20:58 -0800179 ],
180)
181
182cc_library(
Milind Upadhyayb67c6182022-10-22 13:45:45 -0700183 name = "geometry_lib",
184 hdrs = [
185 "geometry.h",
186 ],
187 target_compatible_with = ["@platforms//os:linux"],
188 visibility = ["//visibility:public"],
189 deps = [
190 "//aos/util:math",
191 "//third_party:opencv",
192 "@com_github_google_glog//:glog",
193 ],
194)
195
196cc_test(
197 name = "geometry_test",
198 srcs = [
199 "geometry_test.cc",
200 ],
201 deps = [
202 ":geometry_lib",
203 "//aos/testing:googletest",
204 ],
205)
Jim Ostrowskiba2edd12022-12-03 15:44:37 -0800206
207cc_library(
208 name = "visualize_robot",
209 srcs = [
210 "visualize_robot.cc",
211 ],
212 hdrs = [
213 "visualize_robot.h",
214 ],
215 deps = [
216 "//aos:init",
217 "//third_party:opencv",
218 "@com_google_absl//absl/strings:str_format",
219 "@org_tuxfamily_eigen//:eigen",
220 ],
221)
222
223cc_binary(
224 name = "visualize_robot_sample",
225 srcs = [
226 "visualize_robot_sample.cc",
227 ],
228 target_compatible_with = ["@platforms//os:linux"],
229 visibility = ["//visibility:public"],
230 deps = [
231 "//aos:init",
232 "//frc971/vision:visualize_robot",
233 "//third_party:opencv",
234 "@com_github_google_glog//:glog",
235 "@com_google_ceres_solver//:ceres",
236 "@org_tuxfamily_eigen//:eigen",
237 ],
238)
Austin Schuhc97d48d2022-12-26 14:09:13 -0800239
240cc_library(
241 name = "media_device",
242 srcs = [
243 "media_device.cc",
244 ],
245 hdrs = ["media_device.h"],
246 visibility = ["//visibility:public"],
247 deps = [
248 "//aos/scoped:scoped_fd",
249 "//aos/util:file",
250 "@com_github_google_glog//:glog",
251 "@com_google_absl//absl/strings",
252 ],
253)
James Kuszmaul0c593962023-01-28 16:04:20 -0800254
255cc_library(
256 name = "foxglove_image_converter",
257 srcs = ["foxglove_image_converter.cc"],
258 hdrs = ["foxglove_image_converter.h"],
259 visibility = ["//visibility:public"],
260 deps = [
261 ":vision_fbs",
262 "//aos/events:event_loop",
263 "//third_party:opencv",
264 "@com_github_foxglove_schemas//:schemas",
265 ],
266)