blob: 4dbd66ce24b66582f8b100cde6159b616cb6abf4 [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",
Ravago Jonesc6b919f2023-01-01 21:34:12 -080079 "//aos/util:threaded_consumer",
Jim Ostrowski977850f2022-01-22 21:04:22 -080080 "@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",
106 "@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",
125 "//aos:init",
126 "//aos/events/logging:log_reader",
127 "//frc971/analysis:in_process_plotter",
128 "//frc971/control_loops/drivetrain:improved_down_estimator",
Jim Ostrowskiba2edd12022-12-03 15:44:37 -0800129 "//frc971/vision:visualize_robot",
Austin Schuhdcb6b362022-02-25 18:06:21 -0800130 "//frc971/wpilib:imu_batch_fbs",
131 "//frc971/wpilib:imu_fbs",
132 "//third_party:opencv",
133 "@com_google_absl//absl/strings:str_format",
134 "@com_google_ceres_solver//:ceres",
135 "@org_tuxfamily_eigen//:eigen",
136 ],
137)
Milind Upadhyayb67c6182022-10-22 13:45:45 -0700138
Milind Upadhyaycd677a32022-12-04 13:06:43 -0800139flatbuffer_cc_library(
140 name = "target_map_fbs",
141 srcs = ["target_map.fbs"],
142 gen_reflections = 1,
143 target_compatible_with = ["@platforms//os:linux"],
144 visibility = ["//visibility:public"],
145)
146
Milind Upadhyayb67c6182022-10-22 13:45:45 -0700147cc_library(
Milind Upadhyay7c205222022-11-16 18:20:58 -0800148 name = "target_mapper",
149 srcs = ["target_mapper.cc"],
150 hdrs = ["target_mapper.h"],
Yash Chainanid5c7f0d2022-11-19 17:05:57 -0800151 data = ["target_map.json"],
Milind Upadhyay7c205222022-11-16 18:20:58 -0800152 target_compatible_with = ["@platforms//os:linux"],
153 visibility = ["//visibility:public"],
154 deps = [
155 ":geometry_lib",
Milind Upadhyaycd677a32022-12-04 13:06:43 -0800156 ":target_map_fbs",
Milind Upadhyay7c205222022-11-16 18:20:58 -0800157 "//aos/events:simulated_event_loop",
158 "//frc971/control_loops:control_loop",
Milind Upadhyayc5beba12022-12-17 17:41:20 -0800159 "//frc971/vision/ceres:pose_graph_3d_lib",
Milind Upadhyay7c205222022-11-16 18:20:58 -0800160 "//third_party:opencv",
161 "@com_google_ceres_solver//:ceres",
162 "@org_tuxfamily_eigen//:eigen",
163 ],
164)
165
166cc_test(
167 name = "target_mapper_test",
168 srcs = [
169 "target_mapper_test.cc",
170 ],
Milind Upadhyayc5beba12022-12-17 17:41:20 -0800171 data = [":target_map.json"],
Milind Upadhyay7c205222022-11-16 18:20:58 -0800172 target_compatible_with = ["@platforms//os:linux"],
173 deps = [
174 ":target_mapper",
175 "//aos/events:simulated_event_loop",
176 "//aos/testing:googletest",
Milind Upadhyayc5beba12022-12-17 17:41:20 -0800177 "//aos/testing:path",
Milind Upadhyay7c205222022-11-16 18:20:58 -0800178 "//aos/testing:random_seed",
Milind Upadhyayc5beba12022-12-17 17:41:20 -0800179 "//aos/util:math",
Milind Upadhyay7c205222022-11-16 18:20:58 -0800180 ],
181)
182
183cc_library(
Milind Upadhyayb67c6182022-10-22 13:45:45 -0700184 name = "geometry_lib",
185 hdrs = [
186 "geometry.h",
187 ],
188 target_compatible_with = ["@platforms//os:linux"],
189 visibility = ["//visibility:public"],
190 deps = [
191 "//aos/util:math",
192 "//third_party:opencv",
193 "@com_github_google_glog//:glog",
194 ],
195)
196
197cc_test(
198 name = "geometry_test",
199 srcs = [
200 "geometry_test.cc",
201 ],
202 deps = [
203 ":geometry_lib",
204 "//aos/testing:googletest",
205 ],
206)
Jim Ostrowskiba2edd12022-12-03 15:44:37 -0800207
208cc_library(
209 name = "visualize_robot",
210 srcs = [
211 "visualize_robot.cc",
212 ],
213 hdrs = [
214 "visualize_robot.h",
215 ],
216 deps = [
217 "//aos:init",
218 "//third_party:opencv",
219 "@com_google_absl//absl/strings:str_format",
220 "@org_tuxfamily_eigen//:eigen",
221 ],
222)
223
224cc_binary(
225 name = "visualize_robot_sample",
226 srcs = [
227 "visualize_robot_sample.cc",
228 ],
229 target_compatible_with = ["@platforms//os:linux"],
230 visibility = ["//visibility:public"],
231 deps = [
232 "//aos:init",
233 "//frc971/vision:visualize_robot",
234 "//third_party:opencv",
235 "@com_github_google_glog//:glog",
236 "@com_google_ceres_solver//:ceres",
237 "@org_tuxfamily_eigen//:eigen",
238 ],
239)
Austin Schuhc97d48d2022-12-26 14:09:13 -0800240
241cc_library(
242 name = "media_device",
243 srcs = [
244 "media_device.cc",
245 ],
246 hdrs = ["media_device.h"],
247 visibility = ["//visibility:public"],
248 deps = [
249 "//aos/scoped:scoped_fd",
250 "//aos/util:file",
251 "@com_github_google_glog//:glog",
252 "@com_google_absl//absl/strings",
253 ],
254)
James Kuszmaul0c593962023-01-28 16:04:20 -0800255
256cc_library(
257 name = "foxglove_image_converter",
258 srcs = ["foxglove_image_converter.cc"],
259 hdrs = ["foxglove_image_converter.h"],
260 visibility = ["//visibility:public"],
261 deps = [
262 ":vision_fbs",
263 "//aos/events:event_loop",
264 "//third_party:opencv",
265 "@com_github_foxglove_schemas//:schemas",
266 ],
267)