104 out <<
cov.get_unsafe(
r,
r);
107 out <<
cov.get_unsafe(
r,
c);
140 if (
this == &o)
return;
163 p.getAsQuaternion(
q);
186 dq_dr.get_unsafe(0,0)=dq_dr.get_unsafe(1,1)=dq_dr.get_unsafe(2,2)=1;
187 dq_dr.insertMatrix(3,3,dq_dr_sub);
189 dq_dr.multiply_HCHt( o.
cov, this->cov);
194 o.
cov.extractMatrix(3,3,cov_R);
195 o.
cov.extractMatrix(0,0,cov_T);
196 o.
cov.extractMatrix(0,3,cov_TR);
203 this->
cov.insertMatrix(0,0,cov_T);
207 cov_TQ.multiply_ABt(cov_TR,dq_dr_sub);
208 this->
cov.insertMatrix (0,3,cov_TQ);
209 this->
cov.insertMatrixTranspose(3,0,cov_TQ);
213 dq_dr_sub.multiply_HCHt(cov_R,cov_q);
214 this->
cov.insertMatrix(3,3,cov_q);
223 static const double dummy=0;
244 for (
unsigned int i=0;i<7;i++)
245 os::fprintf(f,
"%e %e %e %e %e %e %e\n",
cov(i,0),
cov(i,1),
cov(i,2),
cov(i,3),
cov(i,4),
cov(i,5),
cov(i,6));
272 newReferenceBaseQuat,
281 df_du.multiply_HCHt( OLD_COV,
cov);
301 vector<CVectorDouble> &outSamples )
const 308 for (
unsigned int k=0;k<7;k++)
329 jacob.insertMatrix(0,0, df_dpose );
330 jacob.set_unsafe(3,3, 1);
331 jacob.set_unsafe(4,4, -1);
332 jacob.set_unsafe(5,5, -1);
333 jacob.set_unsafe(6,6, -1);
336 jacob.multiply_HCHt( this->
cov, out.cov );
364 df_dx.multiply_HCHt( OLD_COV,
cov );
387 df_dx.multiply_HCHt( OLD_COV,
cov );
388 df_du.multiply_HCHt( Ap.
cov,
cov,
true);
399 *
this = inv_Ap + *
this;
425 for (
unsigned int i=0;i<
size(
cov,1)-1;i++)
426 for (
unsigned int j=i+1;j<
size(
cov,1);j++)
427 cov.get_unsafe(i,j) =
cov.get_unsafe(j,i);
448 out <<
"Mean: " <<
obj.mean <<
"\n";
449 out <<
"Covariance:\n" <<
obj.cov <<
"\n";
A namespace of pseudo-random numbers genrators of diferent distributions.
void changeCoordinatesReference(const CPose3DQuat &newReferenceBase)
this = p (+) this.
mrpt::math::CQuaternionDouble & quat()
Read/Write access to the quaternion representing the 3D rotation.
double x() const
Common members of all points & poses classes.
FILE BASE_IMPEXP * fopen(const char *fileName, const char *mode) MRPT_NO_THROWS
An OS-independent version of fopen.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
CPose3D mean
The mean value.
void copyFrom(const CPose3DQuatPDF &o) MRPT_OVERRIDE
Copy operator, translating if necesary (for example, between particles and gaussian representations) ...
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...
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
BASE_IMPEXP bool USE_SUT_EULER2QUAT_CONVERSION
If set to true (default), a Scaled Unscented Transform is used instead of a linear approximation with...
void copyFrom(const CPose3DPDF &o) MRPT_OVERRIDE
Copy operator, translating if necesary (for example, between particles and gaussian representations) ...
TConstructorFlags_Quaternions
int BASE_IMPEXP void BASE_IMPEXP fclose(FILE *f)
An OS-independent version of fclose.
mrpt::math::TPoint2D BASE_IMPEXP operator+(const CPose2D &pose, const mrpt::math::TPoint2D &pnt)
Compose a 2D point from a new coordinate base given by a 2D pose.
CPose3DQuat mean
The mean value.
GLdouble GLdouble GLdouble GLdouble q
BASE_IMPEXP CRandomGenerator randomGenerator
A static instance of a CRandomGenerator class, for use in single-thread applications.
double mahalanobisDistanceTo(const CPose3DQuatPDFGaussian &theOther)
Computes the Mahalanobis distance between the centers of two Gaussians.
virtual const mrpt::utils::TRuntimeClassId * GetRuntimeClass() const
Returns information about the class of an object in runtime.
mrpt::math::CMatrixDouble77 cov
The 7x7 covariance matrix.
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)...
double evaluatePDF(const CPose3DQuat &x) const
Evaluates the PDF at a given point.
int BASE_IMPEXP fprintf(FILE *fil, const char *format,...) MRPT_NO_THROWS MRPT_printf_format_check(2
An OS-independent version of fprintf.
void operator+=(const CPose3DQuat &Ap)
Makes: thisPDF = thisPDF + Ap, where "+" is pose composition (both the mean, and the covariance matri...
void getMean(CPose3DQuat &mean_pose) const MRPT_OVERRIDE
Returns an estimate of the pose, (the mean, or mathematical expectation of the PDF).
IMPLEMENTS_SERIALIZABLE(CLogFileRecord_FullEval, CHolonomicLogFileRecord, mrpt::nav) IMPLEMENTS_SERIALIZABLE(CHolonomicFullEval
GLsizei GLsizei GLuint * obj
void drawGaussianMultivariateMany(VECTOR_OF_VECTORS &ret, size_t desiredSamples, const COVMATRIX &cov, const typename VECTOR_OF_VECTORS::value_type *mean=NULL)
Generate a given number of multidimensional random samples according to a given covariance matrix...
Declares a class that represents a Probability Density function (PDF) of a 3D pose using a quaternion...
void readFromStream(mrpt::utils::CStream &in, int version)
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
double evaluateNormalizedPDF(const CPose3DQuat &x) const
Evaluates the ratio PDF(x) / PDF(MEAN), that is, the normalized PDF in the range [0,1].
A numeric matrix of compile-time fixed size.
This base provides a set of functions for maths stuff.
Declares a class that represents a Probability Density function (PDF) of a 2D pose ...
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
Eigen::Matrix< typename MATRIX::Scalar, MATRIX::ColsAtCompileTime, MATRIX::ColsAtCompileTime > cov(const MATRIX &v)
Computes the covariance matrix from a list of samples in an NxM matrix, where each row is a sample...
void conj(CQuaternion &q_out) const
Return the conjugate quaternion.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
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...
void aux_poseypr2posequat(const CArrayDouble< 6 > &x, const double &dummy, CArrayDouble< 7 > &y)
void inverse(CPose3DQuatPDF &o) const MRPT_OVERRIDE
Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF.
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 .
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,qz).
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...
mrpt::math::CMatrixDouble66 cov
The 6x6 covariance matrix.
#define CLASS_ID(class_name)
Access to runtime class ID for a defined class name.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLdouble GLdouble GLdouble r
bool operator==(const CPoint< DERIVEDCLASS > &p1, const CPoint< DERIVEDCLASS > &p2)
CPose3DQuatPDFGaussian()
Default constructor - set all values to zero.
Declares a class that represents a Probability Density Function (PDF) of a 3D pose (6D actually)...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
void operator-=(const CPose3DQuatPDFGaussian &Ap)
Makes: thisPDF = thisPDF - Ap, where "-" is pose inverse composition (both the mean, and the covariance matrix are updated).
VECTORLIKE1::Scalar mahalanobisDistance(const VECTORLIKE1 &X, const VECTORLIKE2 &MU, const MAT &COV)
Computes the mahalanobis distance of a vector X given the mean MU and the covariance inverse COV_inv ...
static void jacobiansPoseComposition(const CPose3DQuat &x, const CPose3DQuat &u, mrpt::math::CMatrixDouble77 &df_dx, mrpt::math::CMatrixDouble77 &df_du, CPose3DQuat *out_x_oplus_u=NULL)
This static method computes the two Jacobians of a pose composition operation $f(x,u)= x u$.
A partial specialization of CArrayNumeric for double numbers.
Declares a class that represents a Probability Density function (PDF) of a 3D pose ...
virtual void getCovarianceAndMean(mrpt::math::CMatrixFixedNumeric< double, STATE_LEN, STATE_LEN > &cov, TDATA &mean_point) const =0
Returns an estimate of the pose covariance matrix (STATE_LENxSTATE_LEN cov matrix) and the mean...
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.
CMatrixFixedNumeric< double, 7, 1 > CMatrixDouble71
void drawGaussianMultivariate(std::vector< T > &out_result, const mrpt::math::CMatrixTemplateNumeric< T > &cov, const std::vector< T > *mean=NULL)
Generate multidimensional random samples according to a given covariance matrix.
A quaternion, which can represent a 3D rotation as pair , with a real part "r" and a 3D vector ...
double BASE_IMPEXP normalPDF(double x, double mu, double std)
Evaluates the univariate normal (Gaussian) distribution at a given point "x".
void getAsQuaternion(mrpt::math::CQuaternionDouble &q, mrpt::math::CMatrixFixedNumeric< double, 4, 3 > *out_dq_dr=NULL) const
Returns the quaternion associated to the rotation of this object (NOTE: XYZ translation is ignored) ...
void assureSymmetry()
Assures the symmetry of the covariance matrix (eventually certain operations in the math-coprocessor ...
EIGEN_STRONG_INLINE double mean() const
Computes the mean of the entire matrix.
void drawSingleSample(CPose3DQuat &outPart) const MRPT_OVERRIDE
Draws a single sample from the distribution.
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
std::ostream & operator<<(std::ostream &o, const CPoint< DERIVEDCLASS > &p)
Dumps a point as a string [x,y] or [x,y,z].