blob: 308792c4bd897d632db8ae0f70ef61b6d3503929 [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",
James Kuszmaul969e4ab2023-01-28 16:09:19 -0800105 "@com_github_foxglove_schemas//:schemas",
Austin Schuhdcb6b362022-02-25 18:06:21 -0800106 "@com_github_google_glog//:glog",
107 "@com_google_absl//absl/strings:str_format",
108 "@com_google_absl//absl/types:span",
109 "@org_tuxfamily_eigen//:eigen",
110 ],
111)
112
113cc_library(
114 name = "extrinsics_calibration",
115 srcs = [
116 "calibration_accumulator.cc",
117 "calibration_accumulator.h",
118 "extrinsics_calibration.cc",
119 "extrinsics_calibration.h",
120 ],
121 target_compatible_with = ["@platforms//os:linux"],
122 visibility = ["//visibility:public"],
123 deps = [
124 ":charuco_lib",
James Kuszmaul969e4ab2023-01-28 16:09:19 -0800125 ":foxglove_image_converter",
Austin Schuhdcb6b362022-02-25 18:06:21 -0800126 "//aos:init",
127 "//aos/events/logging:log_reader",
128 "//frc971/analysis:in_process_plotter",
129 "//frc971/control_loops/drivetrain:improved_down_estimator",
Jim Ostrowskiba2edd12022-12-03 15:44:37 -0800130 "//frc971/vision:visualize_robot",
Austin Schuhdcb6b362022-02-25 18:06:21 -0800131 "//frc971/wpilib:imu_batch_fbs",
132 "//frc971/wpilib:imu_fbs",
133 "//third_party:opencv",
James Kuszmaul969e4ab2023-01-28 16:09:19 -0800134 "@com_github_foxglove_schemas//:CompressedImage_schema",
135 "@com_github_foxglove_schemas//:ImageAnnotations_schema",
Austin Schuhdcb6b362022-02-25 18:06:21 -0800136 "@com_google_absl//absl/strings:str_format",
137 "@com_google_ceres_solver//:ceres",
138 "@org_tuxfamily_eigen//:eigen",
139 ],
140)
Milind Upadhyayb67c6182022-10-22 13:45:45 -0700141
Milind Upadhyaycd677a32022-12-04 13:06:43 -0800142flatbuffer_cc_library(
143 name = "target_map_fbs",
144 srcs = ["target_map.fbs"],
145 gen_reflections = 1,
146 target_compatible_with = ["@platforms//os:linux"],
147 visibility = ["//visibility:public"],
148)
149
Milind Upadhyayb67c6182022-10-22 13:45:45 -0700150cc_library(
Milind Upadhyay7c205222022-11-16 18:20:58 -0800151 name = "target_mapper",
152 srcs = ["target_mapper.cc"],
153 hdrs = ["target_mapper.h"],
Yash Chainanid5c7f0d2022-11-19 17:05:57 -0800154 data = ["target_map.json"],
Milind Upadhyay7c205222022-11-16 18:20:58 -0800155 target_compatible_with = ["@platforms//os:linux"],
156 visibility = ["//visibility:public"],
157 deps = [
158 ":geometry_lib",
Milind Upadhyaycd677a32022-12-04 13:06:43 -0800159 ":target_map_fbs",
Milind Upadhyay7c205222022-11-16 18:20:58 -0800160 "//aos/events:simulated_event_loop",
161 "//frc971/control_loops:control_loop",
Milind Upadhyayc5beba12022-12-17 17:41:20 -0800162 "//frc971/vision/ceres:pose_graph_3d_lib",
Milind Upadhyay7c205222022-11-16 18:20:58 -0800163 "//third_party:opencv",
164 "@com_google_ceres_solver//:ceres",
165 "@org_tuxfamily_eigen//:eigen",
166 ],
167)
168
169cc_test(
170 name = "target_mapper_test",
171 srcs = [
172 "target_mapper_test.cc",
173 ],
Milind Upadhyayc5beba12022-12-17 17:41:20 -0800174 data = [":target_map.json"],
Milind Upadhyay7c205222022-11-16 18:20:58 -0800175 target_compatible_with = ["@platforms//os:linux"],
176 deps = [
177 ":target_mapper",
178 "//aos/events:simulated_event_loop",
179 "//aos/testing:googletest",
Milind Upadhyayc5beba12022-12-17 17:41:20 -0800180 "//aos/testing:path",
Milind Upadhyay7c205222022-11-16 18:20:58 -0800181 "//aos/testing:random_seed",
Milind Upadhyayc5beba12022-12-17 17:41:20 -0800182 "//aos/util:math",
Milind Upadhyay7c205222022-11-16 18:20:58 -0800183 ],
184)
185
186cc_library(
Milind Upadhyayb67c6182022-10-22 13:45:45 -0700187 name = "geometry_lib",
188 hdrs = [
189 "geometry.h",
190 ],
191 target_compatible_with = ["@platforms//os:linux"],
192 visibility = ["//visibility:public"],
193 deps = [
194 "//aos/util:math",
195 "//third_party:opencv",
196 "@com_github_google_glog//:glog",
197 ],
198)
199
200cc_test(
201 name = "geometry_test",
202 srcs = [
203 "geometry_test.cc",
204 ],
205 deps = [
206 ":geometry_lib",
207 "//aos/testing:googletest",
208 ],
209)
Jim Ostrowskiba2edd12022-12-03 15:44:37 -0800210
211cc_library(
212 name = "visualize_robot",
213 srcs = [
214 "visualize_robot.cc",
215 ],
216 hdrs = [
217 "visualize_robot.h",
218 ],
219 deps = [
220 "//aos:init",
221 "//third_party:opencv",
222 "@com_google_absl//absl/strings:str_format",
223 "@org_tuxfamily_eigen//:eigen",
224 ],
225)
226
227cc_binary(
228 name = "visualize_robot_sample",
229 srcs = [
230 "visualize_robot_sample.cc",
231 ],
232 target_compatible_with = ["@platforms//os:linux"],
233 visibility = ["//visibility:public"],
234 deps = [
235 "//aos:init",
236 "//frc971/vision:visualize_robot",
237 "//third_party:opencv",
238 "@com_github_google_glog//:glog",
239 "@com_google_ceres_solver//:ceres",
240 "@org_tuxfamily_eigen//:eigen",
241 ],
242)
Austin Schuhc97d48d2022-12-26 14:09:13 -0800243
244cc_library(
245 name = "media_device",
246 srcs = [
247 "media_device.cc",
248 ],
249 hdrs = ["media_device.h"],
250 visibility = ["//visibility:public"],
251 deps = [
252 "//aos/scoped:scoped_fd",
253 "//aos/util:file",
254 "@com_github_google_glog//:glog",
255 "@com_google_absl//absl/strings",
256 ],
257)
James Kuszmaul0c593962023-01-28 16:04:20 -0800258
259cc_library(
260 name = "foxglove_image_converter",
261 srcs = ["foxglove_image_converter.cc"],
262 hdrs = ["foxglove_image_converter.h"],
263 visibility = ["//visibility:public"],
264 deps = [
265 ":vision_fbs",
266 "//aos/events:event_loop",
267 "//third_party:opencv",
268 "@com_github_foxglove_schemas//:schemas",
269 ],
270)