15 #include <gtest/gtest.h> 24 typedef std::vector<std::vector<double>>
TPoints;
31 const double Dx = 0.5;
32 const double Dy = 1.5;
33 const double Dz = 0.75;
64 for (
unsigned int i = 0; i < 5; ++i)
68 pA[i][0], pA[i][1], pA[i][2], pB[i][0], pB[i][1], pB[i][2]);
82 for (
unsigned int i = 0; i < 5; ++i)
101 const TPoints& pA,
const TPoints& pB, vector<mrpt::math::TPoint3D>& ptsA,
102 vector<mrpt::math::TPoint3D>& ptsB)
105 ptsA.resize(pA.size());
106 ptsB.resize(pA.size());
107 for (
unsigned int i = 0; i < pA.size(); ++i)
129 if ((qPose[3] * outQuat[3] > 0 && qPose[4] * outQuat[4] > 0 &&
130 qPose[5] * outQuat[5] > 0 && qPose[6] * outQuat[6] > 0) ||
131 (qPose[3] * outQuat[3] < 0 && qPose[4] * outQuat[4] < 0 &&
132 qPose[5] * outQuat[5] < 0 && qPose[6] * outQuat[6] < 0))
134 for (
unsigned int i = 0; i < 7; ++i)
135 err +=
square(std::fabs(qPose[i]) - std::fabs(outQuat[i]));
137 EXPECT_TRUE(err < 1e-6) <<
"Applied quaternion: " << endl
139 <<
"Out CPose3DQuat: " << endl
140 << outQuat <<
" [Err: " << err <<
"]" << endl;
144 GTEST_FAIL() <<
"Applied quaternion: " << endl
146 <<
"Out CPose3DQuat: " << endl
156 vector<mrpt::math::TPoint3D> ptsA, ptsB;
163 ptsA, ptsB, qu,
scale);
166 if ((qPose[3] * qu[3] > 0 && qPose[4] * qu[4] > 0 && qPose[5] * qu[5] > 0 &&
167 qPose[6] * qu[6] > 0) ||
168 (qPose[3] * qu[3] < 0 && qPose[4] * qu[4] < 0 && qPose[5] * qu[5] < 0 &&
169 qPose[6] * qu[6] < 0))
171 for (
unsigned int i = 0; i < 7; ++i)
172 err +=
square(std::fabs(qPose[i]) - std::fabs(qu[i]));
174 EXPECT_TRUE(err < 1e-6) <<
"Applied quaternion: " << endl
176 <<
"Out CPose3DQuat: " << endl
177 << qu <<
" [Err: " << err <<
"]" << endl;
181 GTEST_FAIL() <<
"Applied quaternion: " << endl
183 <<
"Out CPose3DQuat: " << endl
198 params.ransac_minSetSize = 3;
199 params.ransac_maxSetSizePct = 3.0 / list.size();
205 if ((qPose[3] * outQuat[3] > 0 && qPose[4] * outQuat[4] > 0 &&
206 qPose[5] * outQuat[5] > 0 && qPose[6] * outQuat[6] > 0) ||
207 (qPose[3] * outQuat[3] < 0 && qPose[4] * outQuat[4] < 0 &&
208 qPose[5] * outQuat[5] < 0 && qPose[6] * outQuat[6] < 0))
210 for (
unsigned int i = 0; i < 7; ++i)
211 err +=
square(std::fabs(qPose[i]) - std::fabs(outQuat[i]));
213 EXPECT_TRUE(err < 1e-6) <<
"Applied quaternion: " << endl
215 <<
"Out CPose3DQuat: " << endl
216 << outQuat <<
" [Err: " << err <<
"]" << endl;
220 GTEST_FAIL() <<
"Applied quaternion: " << endl
222 <<
"Out CPose3DQuat: " << endl
A namespace of pseudo-random numbers genrators of diferent distributions.
void inverseComposePoint(const double gx, const double gy, const double gz, double &lx, double &ly, double &lz, mrpt::math::CMatrixFixedNumeric< double, 3, 3 > *out_jacobian_df_dpoint=nullptr, mrpt::math::CMatrixFixedNumeric< double, 3, 7 > *out_jacobian_df_dpose=nullptr) const
Computes the 3D point L such as .
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
std::vector< std::vector< double > > TPoints
bool se3_l2_robust(const mrpt::utils::TMatchingPairList &in_correspondences, const TSE3RobustParams &in_params, TSE3RobustResult &out_results)
Least-squares (L2 norm) solution to finding the optimal SE(3) transform between two reference frames ...
Parameters for se3_l2_robust().
GLenum GLenum GLenum GLenum GLenum scale
void generate_list_of_points(const TPoints &pA, const TPoints &pB, TMatchingPairList &list)
TEST(tfest, se3_l2_MatchList)
T square(const T x)
Inline function for the square of a number.
mrpt::vector_int inliers_idx
Indexes within the in_correspondences list which corresponds with inliers.
This base provides a set of functions for maths stuff.
bool se3_l2(const mrpt::utils::TMatchingPairList &in_correspondences, mrpt::poses::CPose3DQuat &out_transform, double &out_scale, bool forceScaleToUnity=false)
Least-squares (L2 norm) solution to finding the optimal SE(3) transform between two reference frames ...
double DEG2RAD(const double x)
Degrees to radians.
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,qz).
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
CPose3DQuat generate_points(TPoints &pA, TPoints &pB)
mrpt::poses::CPose3DQuat transformation
The best transformation found.
GLenum const GLfloat * params
A structure for holding correspondences between two sets of points or points-like entities in 2D or 3...
Output placeholder for se3_l2_robust()
void generate_vector_of_points(const TPoints &pA, const TPoints &pB, vector< mrpt::math::TPoint3D > &ptsA, vector< mrpt::math::TPoint3D > &ptsB)