Main MRPT website > C++ reference for MRPT 1.4.0
CPose3DQuatPDFGaussianInf.h
Go to the documentation of this file.
1/* +---------------------------------------------------------------------------+
2 | Mobile Robot Programming Toolkit (MRPT) |
3 | http://www.mrpt.org/ |
4 | |
5 | Copyright (c) 2005-2016, Individual contributors, see AUTHORS file |
6 | See: http://www.mrpt.org/Authors - All rights reserved. |
7 | Released under BSD License. See details in http://www.mrpt.org/License |
8 +---------------------------------------------------------------------------+ */
9#ifndef CPose3DQuatPDFGaussianInf_H
10#define CPose3DQuatPDFGaussianInf_H
11
14#include <mrpt/poses/CPosePDF.h>
15#include <mrpt/math/CMatrixD.h>
16
17namespace mrpt
18{
19namespace poses
20{
21 class CPosePDFGaussian;
23
25
26 /** Declares a class that represents a Probability Density function (PDF) of a 3D pose using a quaternion \f$ p(\mathbf{x}) = [x ~ y ~ z ~ qr ~ qx ~ qy ~ qz]^\top \f$.
27 *
28 * This class implements that PDF using a mono-modal Gaussian distribution storing the information matrix instead of its inverse, the covariance matrix.
29 * See mrpt::poses::CPose3DQuatPDF for more details, or
30 * mrpt::poses::CPose3DPDF for classes based on Euler angles instead.
31 *
32 * Uncertainty of pose composition operations (\f$ y = x \oplus u \f$) is implemented in the methods "CPose3DQuatPDFGaussianInf::operator+=" and "CPose3DQuatPDF::jacobiansPoseComposition".
33 *
34 * For further details on implemented methods and the theory behind them,
35 * see <a href="http://www.mrpt.org/6D_poses:equivalences_compositions_and_uncertainty" >this report</a>.
36 *
37 * \sa CPose3DQuat, CPose3DQuatPDF, CPose3DPDF, CPose3DQuatPDFGaussian
38 * \ingroup poses_pdf_grp
39 */
41 {
42 // This must be added to any CSerializable derived class:
44
45 public:
46 /** Default constructor - set all values to zero. */
48
49 /** Constructor which left all the member uninitialized, for using when speed is critical - as argument, use UNINITIALIZED_QUATERNION. */
51
52 /** Constructor from a default mean value, information matrix equals to zero. */
53 explicit CPose3DQuatPDFGaussianInf( const CPose3DQuat &init_Mean );
54
55 /** Constructor with mean and inverse covariance (information matrix). */
56 CPose3DQuatPDFGaussianInf( const CPose3DQuat &init_Mean, const mrpt::math::CMatrixDouble77 &init_CovInv );
57
58
59 CPose3DQuat mean; //!< The mean value
60 mrpt::math::CMatrixDouble77 cov_inv; //!< The 7x7 information matrix (the inverse of the covariance)
61
62 inline const CPose3DQuat & getPoseMean() const { return mean; }
63 inline CPose3DQuat & getPoseMean() { return mean; }
64
65 /** Returns an estimate of the pose, (the mean, or mathematical expectation of the PDF) \sa getCovariance */
66 void getMean(CPose3DQuat &mean_pose) const MRPT_OVERRIDE {
67 mean_pose = mean;
68 }
69
70 /** Returns an estimate of the pose covariance matrix (7x7 cov matrix) and the mean, both at once. \sa getMean */
72 cov_inv.inv(cov);
73 mean_point = mean;
74 }
75
76 /** Returns the information (inverse covariance) matrix (a STATE_LEN x STATE_LEN matrix) \sa getMean, getCovarianceAndMean */
78
79 void copyFrom(const CPose3DQuatPDF &o) MRPT_OVERRIDE; //!< Copy operator, translating if necesary (for example, between particles and gaussian representations)
80
81 /** Save the PDF to a text file, containing the 3D pose in the first line (x y z qr qx qy qz), then the information matrix in the next 7 lines. */
82 void saveToTextFile(const std::string &file) const MRPT_OVERRIDE;
83
84 /** this = p (+) this. This can be used to convert a PDF from local coordinates to global, providing the point (newReferenceBase) from which
85 * "to project" the current pdf. Result PDF substituted the currently stored one in the object. */
86 void changeCoordinatesReference( const CPose3DQuat &newReferenceBase );
87
88 /** this = p (+) this. This can be used to convert a PDF from local coordinates to global, providing the point (newReferenceBase) from which
89 * "to project" the current pdf. Result PDF substituted the currently stored one in the object. */
90 void changeCoordinatesReference( const CPose3D &newReferenceBase ) MRPT_OVERRIDE;
91
92
93 void drawSingleSample( CPose3DQuat &outPart ) const MRPT_OVERRIDE; //!< Draws a single sample from the distribution
94 void drawManySamples( size_t N, std::vector<mrpt::math::CVectorDouble> & outSamples ) const MRPT_OVERRIDE; //!< Draws a number of samples from the distribution, and saves as a list of 1x7 vectors, where each row contains a (x,y,z,qr,qx,qy,qz) datum
95 void inverse(CPose3DQuatPDF &o) const MRPT_OVERRIDE; //!< Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF
96
97 /** Unary - operator, returns the PDF of the inverse pose. */
99 {
101 this->inverse(p);
102 return p;
103 }
104
105 void operator += ( const CPose3DQuat &Ap); //!< Makes: thisPDF = thisPDF + Ap, where "+" is pose composition (both the mean, and the covariance matrix are updated).
106 void operator += ( const CPose3DQuatPDFGaussianInf &Ap); //!< Makes: thisPDF = thisPDF + Ap, where "+" is pose composition (both the mean, and the covariance matrix are updated) (see formulas in jacobiansPoseComposition ).
107 void operator -= ( const CPose3DQuatPDFGaussianInf &Ap);//!< Makes: thisPDF = thisPDF - Ap, where "-" is pose inverse composition (both the mean, and the covariance matrix are updated).
108
109 double evaluatePDF( const CPose3DQuat &x ) const; //!< Evaluates the PDF at a given point
110 double evaluateNormalizedPDF( const CPose3DQuat &x ) const; //!< Evaluates the ratio PDF(x) / PDF(MEAN), that is, the normalized PDF in the range [0,1]
111
112 }; // End of class def.
114
116 /** Pose composition for two 3D pose Gaussians \sa CPose3DQuatPDFGaussianInf::operator += */
118 /** Inverse pose composition for two 3D pose Gaussians \sa CPose3DQuatPDFGaussianInf::operator -= */
120
121 /** Dumps the mean and covariance matrix to a text stream. */
122 std::ostream BASE_IMPEXP & operator << (std::ostream & out, const CPose3DQuatPDFGaussianInf& obj);
123
124 } // End of namespace
125} // End of namespace
126#endif
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE(class_name, base_name)
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE(class_name, base_name)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
A numeric matrix of compile-time fixed size.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:73
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,...
Definition: CPose3DQuat.h:42
Declares a class that represents a Probability Density function (PDF) of a 3D pose using a quaternion...
void copyFrom(const CPose3DQuatPDF &o) MRPT_OVERRIDE
Copy operator, translating if necesary (for example, between particles and gaussian representations)
CPose3DQuatPDFGaussianInf(const CPose3DQuat &init_Mean)
Constructor from a default mean value, information matrix equals to zero.
mrpt::math::CMatrixDouble77 cov_inv
The 7x7 information matrix (the inverse of the covariance)
CPose3DQuatPDFGaussianInf(const CPose3DQuat &init_Mean, const mrpt::math::CMatrixDouble77 &init_CovInv)
Constructor with mean and inverse covariance (information matrix).
double evaluatePDF(const CPose3DQuat &x) const
Evaluates the PDF at a given point.
CPose3DQuatPDFGaussianInf(mrpt::math::TConstructorFlags_Quaternions constructor_dummy_param)
Constructor which left all the member uninitialized, for using when speed is critical - as argument,...
double evaluateNormalizedPDF(const CPose3DQuat &x) const
Evaluates the ratio PDF(x) / PDF(MEAN), that is, the normalized PDF in the range [0,...
void getInformationMatrix(mrpt::math::CMatrixDouble77 &inf) const MRPT_OVERRIDE
Returns the information (inverse covariance) matrix (a STATE_LEN x STATE_LEN matrix)
void drawSingleSample(CPose3DQuat &outPart) const MRPT_OVERRIDE
Draws a single sample from the distribution.
void inverse(CPose3DQuatPDF &o) const MRPT_OVERRIDE
Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF.
void getMean(CPose3DQuat &mean_pose) const MRPT_OVERRIDE
Returns an estimate of the pose, (the mean, or mathematical expectation of the PDF)
void getCovarianceAndMean(mrpt::math::CMatrixDouble77 &cov, CPose3DQuat &mean_point) const MRPT_OVERRIDE
Returns an estimate of the pose covariance matrix (7x7 cov matrix) and the mean, both at once.
void saveToTextFile(const std::string &file) const MRPT_OVERRIDE
Save the PDF to a text file, containing the 3D pose in the first line (x y z qr qx qy qz),...
CPose3DQuatPDFGaussianInf()
Default constructor - set all values to zero.
void drawManySamples(size_t N, std::vector< mrpt::math::CVectorDouble > &outSamples) const MRPT_OVERRIDE
Draws a number of samples from the distribution, and saves as a list of 1x7 vectors,...
void changeCoordinatesReference(const CPose3D &newReferenceBase) MRPT_OVERRIDE
this = p (+) this.
void changeCoordinatesReference(const CPose3DQuat &newReferenceBase)
this = p (+) this.
Declares a class that represents a Probability Density Function (PDF) of a 3D pose (6D actually),...
EIGEN_STRONG_INLINE double mean() const
Computes the mean of the entire matrix.
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
Definition: mrpt_macros.h:28
TConstructorFlags_Quaternions
Definition: CQuaternion.h:22
@ UNINITIALIZED_QUATERNION
Definition: CQuaternion.h:23
CPose2D BASE_IMPEXP operator-(const CPose2D &p)
Unary - operator: return the inverse pose "-p" (Note that is NOT the same than a pose with negative x...
class BASE_IMPEXP CPose3DPDFGaussian
class BASE_IMPEXP CPosePDFGaussian
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
STL namespace.



Page generated by Doxygen 1.9.5 for MRPT 1.4.0 SVN: at Mon Dec 26 04:51:47 UTC 2022