blob: b24f13f9fc7e38e49140befc9770779003fdfd8d [file] [log] [blame]
Austin Schuhdcb6b362022-02-25 18:06:21 -08001#ifndef FRC971_VISION_EXTRINSICS_CALIBRATION_H_
2#define FRC971_VISION_EXTRINSICS_CALIBRATION_H_
3
4#include "Eigen/Dense"
5#include "Eigen/Geometry"
6#include "frc971/vision/calibration_accumulator.h"
7
8namespace frc971 {
9namespace vision {
10
11struct CalibrationParameters {
12 Eigen::Quaternion<double> initial_orientation =
13 Eigen::Quaternion<double>::Identity();
Austin Schuh2895f4c2022-02-26 16:38:46 -080014 Eigen::Quaternion<double> pivot_to_camera =
15 Eigen::Quaternion<double>::Identity();
16 Eigen::Quaternion<double> pivot_to_imu =
Austin Schuhdcb6b362022-02-25 18:06:21 -080017 Eigen::Quaternion<double>::Identity();
18 Eigen::Quaternion<double> board_to_world =
19 Eigen::Quaternion<double>::Identity();
20
21 Eigen::Vector3d gyro_bias = Eigen::Vector3d::Zero();
22 Eigen::Matrix<double, 6, 1> initial_state =
23 Eigen::Matrix<double, 6, 1>::Zero();
Austin Schuh2895f4c2022-02-26 16:38:46 -080024 Eigen::Matrix<double, 3, 1> pivot_to_camera_translation =
25 Eigen::Matrix<double, 3, 1>::Zero();
26 Eigen::Matrix<double, 3, 1> pivot_to_imu_translation =
Austin Schuhdcb6b362022-02-25 18:06:21 -080027 Eigen::Matrix<double, 3, 1>::Zero();
28
29 double gravity_scalar = 1.0;
30 Eigen::Matrix<double, 3, 1> accelerometer_bias =
31 Eigen::Matrix<double, 3, 1>::Zero();
Austin Schuh2895f4c2022-02-26 16:38:46 -080032
33 bool has_pivot = false;
Austin Schuhdcb6b362022-02-25 18:06:21 -080034};
35
Austin Schuh2895f4c2022-02-26 16:38:46 -080036// Solves the mounting problem given the calibration data and parameters. The
37// parameters are used as the seed to the solver.
Austin Schuhdcb6b362022-02-25 18:06:21 -080038void Solve(const CalibrationData &data,
39 CalibrationParameters *calibration_parameters);
40
Austin Schuh2895f4c2022-02-26 16:38:46 -080041// Plots the calibrated results to help visualize the fit.
Austin Schuhdcb6b362022-02-25 18:06:21 -080042void Plot(const CalibrationData &data,
43 const CalibrationParameters &calibration_parameters);
44
45} // namespace vision
46} // namespace frc971
47
48#endif // FRC971_VISION_EXTRINSICS_CALIBRATION_H_