23 #include <gtest/gtest.h> 70 const size_t nMapPts = the_map.
size();
74 vector<TObs> observations;
75 observations.resize(nObs);
84 std::vector<std::pair<size_t,float> > idxs;
88 for (
size_t i=0;i<nObs;i++)
96 observations[i].ID = idxs[i].first;
106 all_correspondences.reserve(nMapPts*nObs);
109 for (
size_t j=0;j<nObs;j++)
113 match.
other_x = observations[j].x;
114 match.
other_y = observations[j].y;
116 for (
size_t i=0;i<nMapPts;i++) {
119 all_correspondences.push_back(match);
130 params.ransac_maxSetSize = all_correspondences.size();
132 params.ransac_nSimulations = 0;
133 params.ransac_fuseByCorrsMatch =
true;
134 params.ransac_fuseMaxDiffXY = 0.01f;
136 params.ransac_algorithmForLandmarks =
true;
137 params.probability_find_good_model = 0.999999;
157 <<
"Solution pose: " << solution_pose.
mean << endl
158 <<
"Ground truth pose: " << GT_pose << endl;
169 for (
int i=0;i<3;i++)
A namespace of pseudo-random numbers genrators of diferent distributions.
double drawUniform(const double Min, const double Max)
Generate a uniformly distributed pseudo-random number using the MT19937 algorithm, scaled to the selected range.
double x() const
Common members of all points & poses classes.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
CPose2D mean
The mean value.
const float normalizationStd
double distanceTo(const CPoseOrPoint< OTHERCLASS > &b) const
Returns the Euclidean distance to another pose/point:
Parameters for se2_l2_robust().
mrpt::utils::TMatchingPairList largestSubSet
the largest consensus sub-set
size_t kdTreeRadiusSearch2D(const num_t x0, const num_t y0, const num_t maxRadiusSqr, std::vector< std::pair< size_t, num_t > > &out_indices_dist) const
KD Tree-based search for all the points within a given radius of some 2D point.
BASE_IMPEXP CRandomGenerator randomGenerator
A static instance of a CRandomGenerator class, for use in single-thread applications.
void randomize(const uint32_t seed)
Initialize the PRNG from the given random seed.
const size_t MINIMUM_RANSAC_ITERS
const float ransac_mahalanobisDistanceThreshold
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans. ...
bool TFEST_IMPEXP se2_l2_robust(const mrpt::utils::TMatchingPairList &in_correspondences, const double in_normalizationStd, const TSE2RobustParams &in_ransac_params, TSE2RobustResult &out_results)
Robust least-squares (L2 norm) solution to finding the optimal SE(2) (x,y,yaw) between two reference ...
void composePoint(double lx, double ly, double &gx, double &gy) const
An alternative, slightly more efficient way of doing with G and L being 2D points and P this 2D pose...
mrpt::math::CMatrixDouble33 cov
The 3x3 covariance matrix.
double drawGaussian1D(const double mean, const double std)
Generate a normally distributed pseudo-random number.
T square(const T x)
Inline function for the square of a number.
This base provides a set of functions for maths stuff.
Declares a class that represents a Probability Density function (PDF) of a 2D pose ...
virtual void resize(size_t newLength) MRPT_OVERRIDE
Resizes all point buffers so they can hold the given number of points: newly created points are set t...
double DEG2RAD(const double x)
Degrees to radians.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
const size_t NUM_OBSERVATIONS_TO_SIMUL
bool ransac_data_assoc_run()
unsigned long getPoint(size_t index, float &x, float &y, float &z) const
Access to a given point from map, as a 2D point.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void setPoint(size_t index, float x, float y, float z)
Changes a given point from map, with Z defaulting to 0 if not provided.
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
const double & phi() const
Get the phi angle of the 2D pose (in radians)
TEST(tfest, ransac_data_assoc)
bool TFEST_IMPEXP se2_l2(const mrpt::utils::TMatchingPairList &in_correspondences, mrpt::math::TPose2D &out_transformation, mrpt::math::CMatrixDouble33 *out_estimateCovariance=NULL)
Least-squares (L2 norm) solution to finding the optimal SE(2) (x,y,yaw) between two reference frames...
size_t size() const
Returns the number of stored points in the map.
GLenum const GLfloat * params
Output placeholder for se2_l2_robust()
const size_t NUM_MAP_FEATS
A structure for holding correspondences between two sets of points or points-like entities in 2D or 3...
const size_t RANSAC_MINIMUM_INLIERS