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;
42 pA[0].resize(3); pA[0][0] = 0.0; pA[0][1] = 0.5; pA[0][2] = 0.4;
43 pA[1].resize(3); pA[1][0] = 1.0; pA[1][1] = 1.5; pA[1][2] = -0.1;
44 pA[2].resize(3); pA[2][0] = 1.2; pA[2][1] = 1.1; pA[2][2] = 0.9;
45 pA[3].resize(3); pA[3][0] = 0.7; pA[3][1] = 0.3; pA[3][2] = 3.4;
46 pA[4].resize(3); pA[4][0] = 1.9; pA[4][1] = 2.5; pA[4][2] = -1.7;
49 for(
unsigned int i = 0; i < 5; ++i )
65 for(
unsigned int i = 0; i < 5; ++i )
76 list.push_back( pair );
86 ptsA.resize( pA.size() );
87 ptsB.resize( pA.size() );
88 for(
unsigned int i = 0; i < pA.size(); ++i )
95 TEST(tfest, se3_l2_MatchList)
110 if( (qPose[3]*outQuat[3] > 0 && qPose[4]*outQuat[4] > 0 && qPose[5]*outQuat[5] > 0 && qPose[6]*outQuat[6] > 0) ||
111 (qPose[3]*outQuat[3] < 0 && qPose[4]*outQuat[4] < 0 && qPose[5]*outQuat[5] < 0 && qPose[6]*outQuat[6] < 0) )
113 for(
unsigned int i = 0; i < 7; ++i )
114 err +=
square( std::fabs(qPose[i])-std::fabs(outQuat[i]) );
116 EXPECT_TRUE( err< 1e-6 )
117 <<
"Applied quaternion: " << endl << qPose << endl
118 <<
"Out CPose3DQuat: " << endl << outQuat <<
" [Err: " << err <<
"]" << endl;
123 <<
"Applied quaternion: " << endl << qPose << endl
124 <<
"Out CPose3DQuat: " << endl << outQuat << endl;
133 vector<mrpt::math::TPoint3D> ptsA, ptsB;
141 if( (qPose[3]*qu[3] > 0 && qPose[4]*qu[4] > 0 && qPose[5]*qu[5] > 0 && qPose[6]*qu[6] > 0) ||
142 (qPose[3]*qu[3] < 0 && qPose[4]*qu[4] < 0 && qPose[5]*qu[5] < 0 && qPose[6]*qu[6] < 0) )
145 for(
unsigned int i = 0; i < 7; ++i )
146 err +=
square( std::fabs(qPose[i])-std::fabs(qu[i]) );
148 EXPECT_TRUE( err< 1e-6 )
149 <<
"Applied quaternion: " << endl << qPose << endl
150 <<
"Out CPose3DQuat: " << endl << qu <<
" [Err: " << err <<
"]" << endl;
155 <<
"Applied quaternion: " << endl << qPose << endl
156 <<
"Out CPose3DQuat: " << endl << qu << endl;
170 params.ransac_minSetSize = 3;
171 params.ransac_maxSetSizePct = 3.0 / list.size();
177 if( (qPose[3]*outQuat[3] > 0 && qPose[4]*outQuat[4] > 0 && qPose[5]*outQuat[5] > 0 && qPose[6]*outQuat[6] > 0) ||
178 (qPose[3]*outQuat[3] < 0 && qPose[4]*outQuat[4] < 0 && qPose[5]*outQuat[5] < 0 && qPose[6]*outQuat[6] < 0) )
180 for(
unsigned int i = 0; i < 7; ++i )
181 err +=
square( std::fabs(qPose[i])-std::fabs(outQuat[i]) );
183 EXPECT_TRUE( err< 1e-6 )
184 <<
"Applied quaternion: " << endl << qPose << endl
185 <<
"Out CPose3DQuat: " << endl << outQuat <<
" [Err: " << err <<
"]" << endl;
190 <<
"Applied quaternion: " << endl << qPose << endl
191 <<
"Out CPose3DQuat: " << endl << outQuat << endl;
A namespace of pseudo-random numbers genrators of diferent distributions.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
bool TFEST_IMPEXP 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.
std::vector< std::vector< double > > TPoints
bool TFEST_IMPEXP 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 ...
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=NULL, mrpt::math::CMatrixFixedNumeric< double, 3, 7 > *out_jacobian_df_dpose=NULL) const
Computes the 3D point L such as .
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)