24 #include <Eigen/Dense>    44     : 
mean(init_Mean), 
cov(init_Cov)
   126     if (
this == &o) 
return;  
   144     C(2, 0) = C(0, 2) = C(0, 3);
   145     C(2, 1) = C(1, 2) = C(1, 3);
   156     if (!f) 
return false;
   172     const CPose3D& newReferenceBase_)
   187     const CPose2D& newReferenceBase)
   200     const double ccos = cos(ang);
   201     const double ssin = sin(ang);
   203     alignas(MRPT_MAX_STATIC_ALIGN_BYTES)
   204         const double rot_vals[] = {ccos, -ssin, 0., ssin, ccos, 0., 0., 0., 1.};
   220     outPart.
x(
mean.
x() + v[0]);
   221     outPart.
y(
mean.
y() + v[1]);
   235     size_t N, std::vector<CVectorDouble>& outSamples)
 const   239     std::vector<CVectorDouble> rndSamples;
   242     outSamples.resize(N);
   243     for (
size_t i = 0; i < N; i++)
   245         outSamples[i].resize(3);
   246         outSamples[i][0] = 
mean.
x() + rndSamples[i][0];
   247         outSamples[i][1] = 
mean.
y() + rndSamples[i][1];
   248         outSamples[i][2] = 
mean.
phi() + rndSamples[i][2];
   261     [[maybe_unused]] 
const double minMahalanobisDistToDrop)
   286     this->
mean.
x(x(0, 0));
   287     this->
mean.
y(x(1, 0));
   306     const double ccos = ::cos(
mean.
phi());
   307     const double ssin = ::sin(
mean.
phi());
   310     alignas(MRPT_MAX_STATIC_ALIGN_BYTES) 
const double H_values[] = {
   311         -ccos, -ssin, 
mean.
x() * ssin - 
mean.
y() * ccos,
   312         ssin,  -ccos, 
mean.
x() * ccos + 
mean.
y() * ssin,
   316     out->cov.asEigen().noalias() =
   376     if (MU[0] == 0 && MU[1] == 0 && MU[2] == 0)
   381     COV_ += theOther.
cov;
   397     out << 
"Mean: " << obj.
mean << 
"\n";
   398     out << 
"Covariance:\n" << obj.
cov << 
"\n";
   433     double cpi = cos(xi.
mean.
phi());
   434     double spi = sin(xi.
mean.
phi());
   453     dh_xi(0, 2) = -xv_xi * spi + yv_yi * cpi;
   456     dh_xi(1, 2) = -xv_xi * cpi - yv_yi * spi;
   478     double cp0 = cos(x0.
mean.
phi());
   479     double sp0 = sin(x0.
mean.
phi());
   498     dh_x0(0, 2) = -xv_xi * sp0 + yv_yi * cp0;
   501     dh_x0(1, 2) = -xv_xi * cp0 - yv_yi * sp0;
   513     this->
cov.
asEigen() += (M.asEigen() * M.transpose()).eval();
 A namespace of pseudo-random numbers generators of diferent distributions. 
 
CPoint2D mean
The mean value. 
 
void copyFrom(const CPosePDF &o) override
Copy operator, translating if necesary (for example, between particles and gaussian representations) ...
 
MAT_C::Scalar multiply_HtCH_scalar(const VECTOR_H &H, const MAT_C &C)
r (scalar) = H^t*C*H (H: column vector, C: symmetric matrix) 
 
void serializeSymmetricMatrixTo(MAT &m, mrpt::serialization::CArchive &out)
Binary serialization of symmetric matrices, saving the space of duplicated values. 
 
CPose2D mean
The mean value. 
 
This class is a "CSerializable" wrapper for "CMatrixDynamic<double>". 
 
A gaussian distribution for 2D points. 
 
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive. 
 
int void fclose(FILE *f)
An OS-independent version of fclose. 
 
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files. 
 
mrpt::math::TPoint2D operator+(const CPose2D &pose, const mrpt::math::TPoint2D &pnt)
Compose a 2D point from a new coordinate base given by a 2D pose. 
 
void bayesianFusion(const CPosePDF &p1, const CPosePDF &p2, const double minMahalanobisDistToDrop=0) override
Bayesian fusion of two points gauss. 
 
std::ostream & operator<<(std::ostream &o, const CPoint2D &p)
Dumps a point as a string (x,y) 
 
void assureMinCovariance(double minStdXY, double minStdPhi)
Substitutes the diagonal elements if (square) they are below some given minimum values (Use this befo...
 
void getCovariance(mrpt::math::CMatrixDouble &cov) const
Returns the estimate of the covariance matrix (STATE_LEN x STATE_LEN covariance matrix) ...
 
virtual void getMean(type_value &mean_point) const =0
Returns the mean, or mathematical expectation of the probability density distribution (PDF)...
 
double mahalanobisDistanceTo(const CPosePDFGaussian &theOther)
Computes the Mahalanobis distance between the centers of two Gaussians. 
 
void composePoint(const mrpt::math::TPoint2D &l, CPoint2DPDFGaussian &g) const
Returns the PDF of the 2D point  with "q"=this pose and "l" a point without uncertainty. 
 
#define MRPT_END_WITH_CLEAN_UP(stuff)
 
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. 
 
void saveToTextFile(const std::string &file, mrpt::math::TMatrixTextFileFormat fileFormat=mrpt::math::MATRIX_FORMAT_ENG, bool appendMRPTHeader=false, const std::string &userHeader=std::string()) const
Saves the vector/matrix to a file compatible with MATLAB/Octave text format. 
 
Virtual base class for "schematic archives" (JSON, XML,...) 
 
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations. 
 
#define ASSERT_(f)
Defines an assertion mechanism. 
 
CMatrixFixed< double, 3, 3 > CMatrixDouble33
 
void wrapToPiInPlace(T &a)
Modifies the given angle to translate it into the ]-pi,pi] range. 
 
This base provides a set of functions for maths stuff. 
 
void changeCoordinatesReference(const CPose3D &newReferenceBase) override
this = p (+) this. 
 
#define CLASS_ID(T)
Access to runtime class ID for a defined class name. 
 
CMatrixFixed< double, 3, 1 > CMatrixDouble31
 
Declares a class that represents a Probability Density function (PDF) of a 2D pose ...
 
double phi() const
Get the phi angle of the 2D pose (in radians) 
 
CPosePDFGaussian()
Default constructor. 
 
virtual const mrpt::rtti::TRuntimeClassId * GetRuntimeClass() const override
Returns information about the class of an object in runtime. 
 
void drawGaussianMultivariateMany(VECTOR_OF_VECTORS &ret, size_t desiredSamples, const COVMATRIX &cov, const typename VECTOR_OF_VECTORS::value_type *mean=nullptr)
Generate a given number of multidimensional random samples according to a given covariance matrix...
 
auto block(int start_row, int start_col)
non-const block(): Returns an Eigen::Block reference to the block 
 
CPose2D operator-(const CPose2D &p)
Unary - operator: return the inverse pose "-p" (Note that is NOT the same than a pose with negative x...
 
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive. 
 
double evaluatePDF(const CPose2D &x) const
Evaluates the PDF at a given point. 
 
void deserializeSymmetricMatrixFrom(MAT &m, mrpt::serialization::CArchive &in)
Binary serialization of symmetric matrices, saving the space of duplicated values. 
 
double x() const
Common members of all points & poses classes. 
 
Derived inverse_LLt() const
Returns the inverse of a symmetric matrix using LLt. 
 
void drawManySamples(size_t N, std::vector< mrpt::math::CVectorDouble > &outSamples) const override
Draws a number of samples from the distribution, and saves as a list of 1x3 vectors, where each row contains a (x,y,phi) datum. 
 
CMatrixDouble cov(const MATRIX &v)
Computes the covariance matrix from a list of samples in an NxM matrix, where each row is a sample...
 
double evaluateNormalizedPDF(const CPose2D &x) const
Evaluates the ratio PDF(x) / PDF(MEAN), that is, the normalized PDF in the range [0,1]. 
 
type_value getMeanVal() const
Returns the mean, or mathematical expectation of the probability density distribution (PDF)...
 
void inverseComposition(const CPosePDFGaussian &x, const CPosePDFGaussian &ref)
Set  , computing the mean using the "-" operator and the covariances through the corresponding Jacobi...
 
Declares a class that represents a probability density function (pdf) of a 2D pose (x...
 
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
 
#define SCHEMA_DESERIALIZE_DATATYPE_VERSION()
For use inside serializeFrom(CSchemeArchiveBase) methods. 
 
int fprintf(FILE *fil, const char *format,...) noexcept MRPT_printf_format_check(2
An OS-independent version of fprintf. 
 
return_t square(const num_t x)
Inline function for the square of a number. 
 
This class is a "CSerializable" wrapper for "CMatrixFloat". 
 
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries. 
 
bool operator==(const CPoint< DERIVEDCLASS, DIM > &p1, const CPoint< DERIVEDCLASS, DIM > &p2)
 
Virtual base class for "archives": classes abstracting I/O streams. 
 
void drawGaussianMultivariate(std::vector< T > &out_result, const MATRIX &cov, const std::vector< T > *mean=nullptr)
Generate multidimensional random samples according to a given covariance matrix. 
 
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
 
A class used to store a 3D pose (a 3D translation + a rotation in 3D). 
 
mrpt::vision::TStereoCalibResults out
 
static void jacobiansPoseComposition(const CPose2D &x, const CPose2D &u, mrpt::math::CMatrixDouble33 &df_dx, mrpt::math::CMatrixDouble33 &df_du, const bool compute_df_dx=true, const bool compute_df_du=true)
This static method computes the pose composition Jacobians, with these formulas: 
 
This file implements matrix/vector text and binary serialization. 
 
void readTo(CSerializable &obj)
 
void composeFrom(const CPose2D &A, const CPose2D &B)
Makes . 
 
void enforceCovSymmetry()
Assures the symmetry of the covariance matrix (eventually certain operations in the math-coprocessor ...
 
double mean(const CONTAINER &v)
Computes the mean value of a vector. 
 
EIGEN_MAP asEigen()
Get as an Eigen-compatible Eigen::Map object. 
 
FILE * fopen(const char *fileName, const char *mode) noexcept
An OS-independent version of fopen. 
 
#define SCHEMA_SERIALIZE_DATATYPE_VERSION(ser_version)
For use inside all serializeTo(CSchemeArchiveBase) methods. 
 
void operator+=(const CPose2D &Ap)
Makes: thisPDF = thisPDF + Ap, where "+" is pose composition (both the mean, and the covariance matri...
 
void rotateCov(const double ang)
Rotate the covariance matrix by replacing it by , where . 
 
CRandomGenerator & getRandomGenerator()
A static instance of a CRandomGenerator class, for use in single-thread applications. 
 
double normalPDF(double x, double mu, double std)
Evaluates the univariate normal (Gaussian) distribution at a given point "x". 
 
mrpt::math::CMatrixDouble22 cov
The 2x2 covariance matrix. 
 
void drawSingleSample(CPose2D &outPart) const override
Draws a single sample from the distribution. 
 
CMatrixFixed< double, ROWS, COLS > cast_double() const
 
Declares a class that represents a Probability Density Function (PDF) of a 3D pose (6D actually)...
 
bool saveToTextFile(const std::string &file) const override
Save PDF's particles to a text file, containing the 2D pose in the first line, then the covariance ma...
 
void normalizePhi()
Forces "phi" to be in the range [-pi,pi];. 
 
void inverse(CPosePDF &o) const override
Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF. 
 
void multiply_HCHt(const MAT_H &H, const MAT_C &C, MAT_R &R, bool accumResultInOutput=false)
R = H * C * H^t. 
 
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.