15 #include <gtest/gtest.h>
22 template <
class POSE_TYPE>
32 typename SE_TYPE::pose_t P1, D,
P2;
39 typename SE_TYPE::array_t eps1, eps2;
40 for (
int i = 0; i < SE_TYPE::VECTOR_SIZE; i++)
43 eps2[i] =
x[SE_TYPE::VECTOR_SIZE + i];
46 POSE_TYPE incr1, incr2;
47 SE_TYPE::exp(eps1, incr1);
48 SE_TYPE::exp(eps2, incr2);
50 const POSE_TYPE P1 = incr1 +
params.P1;
51 const POSE_TYPE P2 = incr2 +
params.P2;
52 const POSE_TYPE& Pd =
params.D;
55 P1.getHomogeneousMatrix(P1hm);
56 Pd.getHomogeneousMatrix(Pdhm);
57 P2.getInverseHomogeneousMatrix(HM_P2inv);
60 const POSE_TYPE P1DP2inv(P1DP2inv_);
63 SE_TYPE::pseudo_ln(P1DP2inv, Y);
67 double x1,
double y1,
double z1,
double yaw1,
double pitch1,
68 double roll1,
double xd,
double yd,
double zd,
double yawd,
69 double pitchd,
double rolld,
double x2,
double y2,
double z2,
70 double yaw2,
double pitch2,
double roll2)
72 const CPose3D P1_(x1, y1, z1, yaw1, pitch1, roll1);
73 const CPose3D Pd_(xd, yd, zd, yawd, pitchd, rolld);
74 const CPose3D P2_(x2, y2, z2, yaw2, pitch2, roll2);
76 const POSE_TYPE P1(P1_);
77 const POSE_TYPE Pd(Pd_);
78 const POSE_TYPE P2(P2_);
81 P1.getHomogeneousMatrix(P1hm);
82 Pd.getHomogeneousMatrix(Pdhm);
83 P2.getInverseHomogeneousMatrix(HM_P2inv);
85 const POSE_TYPE P1DP2inv(P1DP2inv_);
87 static const int DIMS = SE_TYPE::VECTOR_SIZE;
91 SE_TYPE::jacobian_dP1DP2inv_depsilon(P1DP2inv, &J1, &J2);
97 for (
int i = 0; i < DIMS + DIMS; i++) x_mean[i] = 0;
105 x_incrs.assign(1e-4);
113 x_incrs,
params, numJacobs);
115 numJacobs.extractMatrix(0, 0, num_J1);
116 numJacobs.extractMatrix(0, DIMS, num_J2);
119 const double max_eror = 1e-3;
121 EXPECT_NEAR(0, (num_J1 - J1).array().abs().
sum(), max_eror)
122 <<
"p1: " << P1 << endl
123 <<
"d: " << Pd << endl
124 <<
"p2: " << P2 << endl
127 <<
"Implemented J1:\n"
130 << J1 - num_J1 << endl;
132 EXPECT_NEAR(0, (num_J2 - J2).array().abs().
sum(), max_eror)
133 <<
"p1: " << P1 << endl
134 <<
"d: " << Pd << endl
135 <<
"p2: " << P2 << endl
138 <<
"Implemented J2:\n"
141 << J2 - num_J2 << endl;
146 test_jacobs_P1DP2inv(
147 0, 0, 0,
DEG2RAD(0),
DEG2RAD(0),
DEG2RAD(0), 0, 0, 0,
DEG2RAD(0),
151 test_jacobs_P1DP2inv(
152 0, 0, 0,
DEG2RAD(10),
DEG2RAD(0),
DEG2RAD(0), 0, 0, 0,
DEG2RAD(10),
156 test_jacobs_P1DP2inv(
157 0, 0, 0,
DEG2RAD(10),
DEG2RAD(0),
DEG2RAD(0), 0, 0, 0,
DEG2RAD(12),
161 test_jacobs_P1DP2inv(
162 0, 0, 0,
DEG2RAD(10),
DEG2RAD(20),
DEG2RAD(30), 0, 0, 0,
DEG2RAD(4),
166 test_jacobs_P1DP2inv(
171 test_jacobs_P1DP2inv(
176 test_jacobs_P1DP2inv(