class mrpt::poses::CPointPDFParticles

A probability distribution of a 2D/3D point, represented as a set of random samples (particles).

See also:

CPointPDF

#include <mrpt/poses/CPointPDFParticles.h>

class CPointPDFParticles:
    public mrpt::poses::CPointPDF,
    public mrpt::bayes::CParticleFilterData,
    public mrpt::bayes::CParticleFilterDataImpl
{
public:
    // construction

    CPointPDFParticles(size_t numParticles = 1);

    //
methods

    void clear();
    void setSize(size_t numberParticles, const mrpt::math::TPoint3Df& defaultValue = mrpt::math::TPoint3Df{ 0, 0, 0});
    size_t size() const;
    void getMean(CPoint3D& mean_point) const;
    virtual std::tuple<cov_mat_t, type_value> getCovarianceAndMean() const;
    virtual void copyFrom(const CPointPDF& o);
    virtual bool saveToTextFile(const std::string& file) const;
    virtual void changeCoordinatesReference(const CPose3D& newReferenceBase);
    double computeKurtosis();
    void drawSingleSample(CPoint3D& outSample) const;
    virtual void bayesianFusion(const CPointPDF& p1, const CPointPDF& p2, const double minMahalanobisDistToDrop = 0);
};

Inherited Members

public:
    // typedefs

    typedef CProbabilityDensityFunction<TDATA, STATE_LEN> self_t;

    // structs

    struct TFastDrawAuxVars;

    //
methods

    virtual void copyFrom(const CPointPDF& o) = 0;
    virtual void changeCoordinatesReference(const CPose3D& newReferenceBase) = 0;
    virtual double getW(size_t i) const = 0;
    virtual void setW(size_t i, double w) = 0;
    virtual size_t particlesCount() const = 0;
    virtual void performSubstitution(const std::vector<size_t>& indx) = 0;
    virtual double normalizeWeights(double* out_max_log_w = nullptr) = 0;
    virtual double ESS() const = 0;

Construction

CPointPDFParticles(size_t numParticles = 1)

Default constructor.

Methods

void clear()

Clear all the particles (free memory)

void setSize(size_t numberParticles, const mrpt::math::TPoint3Df& defaultValue = mrpt::math::TPoint3Df{ 0, 0, 0})

Erase all the previous particles and change the number of particles, with a given initial value

size_t size() const

Returns the number of particles.

virtual std::tuple<cov_mat_t, type_value> getCovarianceAndMean() const

Returns an estimate of the pose covariance matrix (STATE_LENxSTATE_LEN cov matrix) and the mean, both at once.

See also:

getMean, getInformationMatrix

virtual void copyFrom(const CPointPDF& o)

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

virtual bool saveToTextFile(const std::string& file) const

Save PDF’s particles to a text file, where each line is: X Y Z LOG_W.

virtual void changeCoordinatesReference(const CPose3D& newReferenceBase)

this = p (+) this.

This can be used to convert a PDF from local coordinates to global, providing the point (newReferenceBase) from which “to project” the current pdf. Result PDF substituted the currently stored one in the object. Both the mean value and the covariance matrix are updated correctly.

double computeKurtosis()

Compute the kurtosis of the distribution.

void drawSingleSample(CPoint3D& outSample) const

Draw a sample from the pdf.

virtual void bayesianFusion(
    const CPointPDF& p1,
    const CPointPDF& p2,
    const double minMahalanobisDistToDrop = 0
    )

Bayesian fusion of two point distributions (product of two distributions->new distribution), then save the result in this object (WARNING: See implementing classes to see classes that can and cannot be mixtured!)

Parameters:

p1

The first distribution to fuse

p2

The second distribution to fuse

minMahalanobisDistToDrop

If set to different of 0, the result of very separate Gaussian modes (that will result in negligible components) in SOGs will be dropped to reduce the number of modes in the output.