27 const std::vector<Eigen::Matrix<double, 7, 1>> &traj_gt, Eigen::Matrix3d &R, Eigen::Vector3d &t,
28 double &s, std::string method,
int n_aligned) {
31 if (method ==
"posyaw") {
34 }
else if (method ==
"posyawsingle") {
37 }
else if (method ==
"se3") {
39 align_se3(traj_es, traj_gt, R, t, n_aligned);
40 }
else if (method ==
"se3single") {
43 }
else if (method ==
"sim3") {
44 assert(n_aligned >= 2 || n_aligned == -1);
46 }
else if (method ==
"none") {
52 PRINT_ERROR(
RED "[ALIGN]: Possible options: posyaw, posyawsingle, se3, se3single, sim3, none\n" RESET);
53 std::exit(EXIT_FAILURE);
58 const std::vector<Eigen::Matrix<double, 7, 1>> &traj_gt, Eigen::Matrix3d &R, Eigen::Vector3d &t) {
61 Eigen::Vector4d q_es_0 = traj_es.at(0).block(3, 0, 4, 1);
62 Eigen::Vector3d p_es_0 = traj_es.at(0).block(0, 0, 3, 1);
64 Eigen::Vector4d q_gt_0 = traj_gt.at(0).block(3, 0, 4, 1);
65 Eigen::Vector3d p_gt_0 = traj_gt.at(0).block(0, 0, 3, 1);
72 Eigen::Matrix3d C_R = est_rot * g_rot.transpose();
81 t.noalias() = p_gt_0 - R * p_es_0;
85 const std::vector<Eigen::Matrix<double, 7, 1>> &traj_gt, Eigen::Matrix3d &R, Eigen::Vector3d &t,
94 assert(!traj_es.empty());
95 std::vector<Eigen::Vector3d> pos_est, pos_gt;
96 for (
size_t i = 0; i < traj_es.size() && i < traj_gt.size(); i++) {
97 pos_est.push_back(traj_es.at(i).block(0, 0, 3, 1));
98 pos_gt.push_back(traj_gt.at(i).block(0, 0, 3, 1));
109 const std::vector<Eigen::Matrix<double, 7, 1>> &traj_gt, Eigen::Matrix3d &R, Eigen::Vector3d &t) {
112 Eigen::Vector4d q_es_0 = traj_es.at(0).block(3, 0, 4, 1);
113 Eigen::Vector3d p_es_0 = traj_es.at(0).block(0, 0, 3, 1);
115 Eigen::Vector4d q_gt_0 = traj_gt.at(0).block(3, 0, 4, 1);
116 Eigen::Vector3d p_gt_0 = traj_gt.at(0).block(0, 0, 3, 1);
122 R.noalias() = g_rot * est_rot.transpose();
123 t.noalias() = p_gt_0 - R * p_es_0;
127 const std::vector<Eigen::Matrix<double, 7, 1>> &traj_gt, Eigen::Matrix3d &R, Eigen::Vector3d &t,
131 if (n_aligned == 1) {
136 assert(!traj_es.empty());
137 std::vector<Eigen::Vector3d> pos_est, pos_gt;
138 for (
size_t i = 0; i < traj_es.size() && i < traj_gt.size(); i++) {
139 pos_est.push_back(traj_es.at(i).block(0, 0, 3, 1));
140 pos_gt.push_back(traj_gt.at(i).block(0, 0, 3, 1));
150 const std::vector<Eigen::Matrix<double, 7, 1>> &traj_gt, Eigen::Matrix3d &R, Eigen::Vector3d &t,
double &s,
154 assert(n_aligned >= 2 || n_aligned == -1);
157 assert(!traj_es.empty());
158 std::vector<Eigen::Vector3d> pos_est, pos_gt;
159 for (
size_t i = 0; i < traj_es.size() && i < traj_gt.size(); i++) {
160 pos_est.push_back(traj_es.at(i).block(0, 0, 3, 1));
161 pos_gt.push_back(traj_gt.at(i).block(0, 0, 3, 1));