Add basic imu calibrator
This provides a ceres-based solver to take in values from multiple IMUs
and estimate the relative orientations and time offsets of the IMUs.
It still would need to be hooked up to an AOS log, and doesn't have
great hooks for visualizing the results.
Change-Id: Ifcc69a89b9e4b0957b207a8f62948cd87ebf9fa0
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/frc971/imu/BUILD b/frc971/imu/BUILD
index b90f844..3bccf20 100644
--- a/frc971/imu/BUILD
+++ b/frc971/imu/BUILD
@@ -61,3 +61,46 @@
uf2_from_elf(
name = "ADIS16505",
)
+
+cc_library(
+ name = "imu_calibrator",
+ srcs = ["imu_calibrator.cc"],
+ hdrs = [
+ "imu_calibrator.h",
+ "imu_calibrator-tmpl.h",
+ ],
+ target_compatible_with = ["@platforms//os:linux"],
+ deps = [
+ "//aos/time",
+ "//frc971/math:interpolate",
+ "@com_google_absl//absl/strings:str_format",
+ "@com_google_ceres_solver//:ceres",
+ "@org_tuxfamily_eigen//:eigen",
+ ],
+)
+
+cc_library(
+ name = "imu_calibrator_solver",
+ srcs = [
+ "imu_calibrator_solver.cc",
+ ],
+ hdrs = [
+ "imu_calibrator_solver.h",
+ ],
+ deps = [
+ ":imu_calibrator",
+ "@com_google_ceres_solver//:ceres",
+ "@org_tuxfamily_eigen//:eigen",
+ ],
+)
+
+cc_test(
+ name = "imu_calibrator_test",
+ srcs = ["imu_calibrator_test.cc"],
+ shard_count = 3,
+ deps = [
+ ":imu_calibrator",
+ ":imu_calibrator_solver",
+ "//aos/testing:googletest",
+ ],
+)