10 #include <gtest/gtest.h> 24 using TPoints = std::vector<std::vector<double>>;
31 const double Dx = 0.5;
32 const double Dy = 1.5;
33 const double Dz = 0.75;
35 const double yaw = 10.0_deg;
36 const double pitch = 20.0_deg;
37 const double roll = 5.0_deg;
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 generators of diferent distributions.
EXPECT_TRUE(mrpt::system::fileExists(ini_fil))
EXPECT_GT(out.final_iters, 10UL)
std::vector< std::vector< double > > TPoints
Parameters for se3_l2_robust().
mrpt::vision::TStereoCalibParams params
void generate_list_of_points(const TPoints &pA, const TPoints &pB, TMatchingPairList &list)
TEST(tfest, se3_l2_MatchList)
float d2f(const double d)
shortcut for static_cast<float>(double)
This base provides a set of functions for maths stuff.
void inverseComposePoint(const double gx, const double gy, const double gz, double &lx, double &ly, double &lz, mrpt::math::CMatrixFixed< double, 3, 3 > *out_jacobian_df_dpoint=nullptr, mrpt::math::CMatrixFixed< double, 3, 7 > *out_jacobian_df_dpose=nullptr) const
Computes the 3D point L such as .
std::vector< uint32_t > inliers_idx
Indexes within the in_correspondences list which corresponds with inliers.
TPoint3D_< double > TPoint3D
Lightweight 3D point.
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...
A structure for holding correspondences between two sets of points or points-like entities in 2D or 3...
return_t square(const num_t x)
Inline function for the square of a number.
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).
bool se3_l2(const mrpt::tfest::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 ...
CPose3DQuat generate_points(TPoints &pA, TPoints &pB)
bool se3_l2_robust(const mrpt::tfest::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 ...
mrpt::poses::CPose3DQuat transformation
The best transformation found.
Functions for estimating the optimal transformation between two frames of references given measuremen...
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)