Class CPose3DPDFGrid

Inheritance Relationships

Base Types

Class Documentation

class CPose3DPDFGrid : public mrpt::poses::CPose3DPDF, public mrpt::poses::CPose3DGridTemplate<double>

Declares a class that represents a Probability Distribution function (PDF) of a SE(3) pose (x,y,z, yaw, pitch, roll), in the form of a 6-dimensional grid of “voxels”.

Public Functions

CPose3DPDFGrid(const mrpt::math::TPose3D &bb_min = mrpt::math::TPose3D(-1., -1., -1., -M_PI, -.5 * M_PI, -.5 * M_PI), const mrpt::math::TPose3D &bb_max = mrpt::math::TPose3D(1., 1., 1., M_PI, .5 * M_PI, .5 * M_PI), double resolution_XYZ = 0.10, double resolution_YPR = mrpt::DEG2RAD(10.0))

Constructor: Initializes a, uniform distribution over the whole given range, given by a “rectangular” (6D) bounding box.

~CPose3DPDFGrid() override = default

Destructor

virtual void copyFrom(const CPose3DPDF &o) override

Copy operator, translating if necessary (for example, between particles and gaussian representations)

void normalize()

Normalizes the PDF, such as all voxels sum the unity.

void uniformDistribution()

Assigns the same value to all the cells in the grid, so the sum 1

void getMean(CPose3D &mean_pose) const override
std::tuple<cov_mat_t, type_value> getCovarianceAndMean() const override
bool saveToTextFile(const std::string &dataFile) const override

Save the contents of the 3D grid in one file, as a concatenation of (X,Y) slices. The size in X,Y,and the values for Z,yaw, pitch, roll, PHI are stored in another file named <filename>_dims.txt

Returns:

false on error

virtual void changeCoordinatesReference(const CPose3D &newReferenceBase) override
virtual void bayesianFusion(const CPose3DPDF &p1, const CPose3DPDF &p2) override

Bayesian fusion of two pose distributions, then save the result in this object (WARNING: Currently only distributions of the same class can be fused! eg, gaussian with gaussian,etc)

virtual void inverse(CPose3DPDF &o) const override

Returns a new PDF such as: NEW_PDF = (0,0,0) - THIS_PDF

void drawSingleSample(CPose3D &outPart) const override

Draws a single sample from the distribution.

Note

Precondition: voxel weights are assumed to be normalized.

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 1x6 vectors, where each row contains a (x,y,z,yaw,pitch,roll) datum.

virtual void printTo(std::ostream &out) const override

Write a human-readable description of this PDF to the given stream. Derived classes must override this method.