10 #include <CTraitsTest.h> 11 #include <gtest/gtest.h> 15 #include <Eigen/Dense> 23 template class mrpt::CTraitsTest<CPosePDFGaussian>;
31 double x,
double y,
double phi,
double std_scale)
38 for (
int i = 0; i < 3; i++)
cov(i, i) += 1e-7;
50 for (
int i = 0; i < 3; i++) Y[i] = p1_inv[i];
65 for (
int i = 0; i < 3; i++) x_mean[i] = pdf1.
mean[i];
73 x_mean, x_cov, func_inverse, DUMMY, y_mean, y_cov, x_incrs);
76 EXPECT_NEAR(0, (y_cov - pdf1_inv.
cov).array().abs().mean(), 1e-5)
77 <<
"pdf1 mean: " << pdf1.
mean << endl
78 <<
"Numeric approximation of covariance: " << endl
80 <<
"Returned covariance: " << endl
81 << pdf1_inv.
cov << endl;
87 testPoseInverse(0, 0, 0, 0.01);
88 testPoseInverse(0, 0, 0, 0.1);
90 testPoseInverse(1, 0, 0, 0.1);
91 testPoseInverse(0, 1, 0, 0.1);
92 testPoseInverse(0, 0, 1, 0.1);
94 testPoseInverse(-5, 0, 0, 0.1);
95 testPoseInverse(0, -5, 0, 0.1);
96 testPoseInverse(0, 0, -5, 0.1);
98 testPoseInverse(4, 6,
DEG2RAD(10), 0.1);
99 testPoseInverse(4, 6,
DEG2RAD(-10), 0.1);
101 testPoseInverse(-7, 2,
DEG2RAD(30), 0.1);
102 testPoseInverse(-7, 2,
DEG2RAD(-30), 0.1);
A compile-time fixed-size numeric matrix container.
CPose2D mean
The mean value.
double DEG2RAD(const double x)
Degrees to radians.
void fill(const Scalar &val)
void drawGaussian1DMatrix(MAT &matrix, const double mean=0, const double std=1)
Fills the given matrix with independent, 1D-normally distributed samples.
static void func_inverse(const CVectorFixedDouble< 3 > &x, const double &dummy, CVectorFixedDouble< 3 > &Y)
mrpt::math::CMatrixDouble33 cov
The 3x3 covariance matrix.
void matProductOf_AAt(const MAT_A &A)
this = A * AT
This base provides a set of functions for maths stuff.
Declares a class that represents a Probability Density function (PDF) of a 2D pose ...
void testPoseInverse(double x, double y, double phi, double std_scale)
CMatrixDouble cov(const MATRIX &v)
Computes the covariance matrix from a list of samples in an NxM matrix, where each row is a sample...
static CPosePDFGaussian generateRandomPose2DPDF(double x, double y, double phi, double std_scale)
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
TEST_F(PosePDFGaussTests, Inverse)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLdouble GLdouble GLdouble r
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
CRandomGenerator & getRandomGenerator()
A static instance of a CRandomGenerator class, for use in single-thread applications.
void inverse(CPosePDF &o) const override
Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF.
#define MRPT_UNUSED_PARAM(a)
Determines whether this is an X86 or AMD64 platform.