class mrpt::maps::CGasConcentrationGridMap2D

CGasConcentrationGridMap2D represents a PDF of gas concentrations over a 2D area.

There are a number of methods available to build the gas grid-map, depending on the value of “TMapRepresentation maptype” passed in the constructor (see base class mrpt::maps::CRandomFieldGridMap2D).

Update the map with insertIndividualReading() or insertObservation()

See also:

mrpt::maps::CRandomFieldGridMap2D, mrpt::maps::CMetricMap, mrpt::containers::CDynamicGrid, The application icp-slam, mrpt::maps::CMultiMetricMap

#include <mrpt/maps/CGasConcentrationGridMap2D.h>

class CGasConcentrationGridMap2D: public mrpt::maps::CRandomFieldGridMap2D
{
public:
    // enums

    enum TMapRepresentation;

    // structs

    struct TGaussianCell;
    struct TGaussianWindTable;
    struct TInsertionOptions;

    //
fields

    mrpt::maps::CGasConcentrationGridMap2D::TInsertionOptions insertionOptions;
    TGaussianWindTable LUT;

    // construction

    CGasConcentrationGridMap2D(
        TMapRepresentation mapType = mrAchim,
        float x_min = -2,
        float x_max = 2,
        float y_min = -2,
        float y_max = 2,
        float resolution = 0.1f
        );

    //
methods

    virtual void getVisualizationInto(mrpt::opengl::CSetOfObjects& outObj) const;
    virtual void getAs3DObject(mrpt::opengl::CSetOfObjects& meanObj, mrpt::opengl::CSetOfObjects& varObj) const;
    void getWindAs3DObject(mrpt::opengl::CSetOfObjects::Ptr& windObj) const;
    virtual void increaseUncertainty(const double STD_increase_value);
    bool simulateAdvection(double STD_increase_value);
    void clear();
    virtual std::string asString() const;
    virtual bool isEmpty() const;
    virtual void saveAsBitmapFile(const std::string& filName) const;
    virtual void getAsBitmapFile(mrpt::img::CImage& out_img) const;
    virtual void getAsMatrix(mrpt::math::CMatrixDouble& out_mat) const;

    void resize(
        double new_x_min,
        double new_x_max,
        double new_y_min,
        double new_y_max,
        const TRandomFieldCell& defaultValueNewCells,
        double additionalMarginMeters = 1.0f
        );

    virtual void setSize(
        const double x_min,
        const double x_max,
        const double y_min,
        const double y_max,
        const double resolution,
        const TRandomFieldCell* fill_value = nullptr
        );

    void setCellsConnectivity(const ConnectivityDescriptor::Ptr& new_connectivity_descriptor);
    virtual float compute3DMatchingRatio(const mrpt::maps::CMetricMap* otherMap, const mrpt::poses::CPose3D& otherMapPose, const TMatchingRatioParams& params) const;
    virtual void saveMetricMapRepresentationToFile(const std::string& filNamePrefix) const;
    virtual void saveAsMatlab3DGraph(const std::string& filName) const;
    void getAsMatlab3DGraphScript(std::string& out_script) const;
    TMapRepresentation getMapType();

    void insertIndividualReading(
        const double sensorReading,
        const mrpt::math::TPoint2D& point,
        const bool update_map = true,
        const bool time_invariant = true,
        const double reading_stddev = .0
        );

    virtual void predictMeasurement(
        const double x,
        const double y,
        double& out_predict_response,
        double& out_predict_response_variance,
        bool do_sensor_normalization,
        const TGridInterpolationMethod interp_method = gimNearest
        );

    void getMeanAndCov(mrpt::math::CVectorDouble& out_means, mrpt::math::CMatrixDouble& out_cov) const;
    void getMeanAndSTD(mrpt::math::CVectorDouble& out_means, mrpt::math::CVectorDouble& out_STD) const;
    void setMeanAndSTD(mrpt::math::CVectorDouble& out_means, mrpt::math::CVectorDouble& out_STD);
    void updateMapEstimation();
};

Inherited Members

public:
    // structs

    struct TMsg;
    struct ConnectivityDescriptor;
    struct TInsertionOptionsCommon;
    struct TObservationGMRF;
    struct TPriorFactorGMRF;

    //
methods

    virtual bool isEmpty() const = 0;
    virtual void saveMetricMapRepresentationToFile(const std::string& filNamePrefix) const = 0;
    virtual std::string asString() const = 0;
    virtual void getVisualizationInto(mrpt::opengl::CSetOfObjects& o) const = 0;
    virtual void getVisualizationInto(mrpt::opengl::CSetOfObjects& outObj) const;
    virtual void getAs3DObject(mrpt::opengl::CSetOfObjects& meanObj, mrpt::opengl::CSetOfObjects& varObj) const;

Construction

CGasConcentrationGridMap2D(
    TMapRepresentation mapType = mrAchim,
    float x_min = -2,
    float x_max = 2,
    float y_min = -2,
    float y_max = 2,
    float resolution = 0.1f
    )

Constructor.

Methods

virtual void getVisualizationInto(mrpt::opengl::CSetOfObjects& outObj) const

Returns a 3D object representing the map.

virtual void getAs3DObject(mrpt::opengl::CSetOfObjects& meanObj, mrpt::opengl::CSetOfObjects& varObj) const

Returns two 3D objects representing the mean and variance maps.

void getWindAs3DObject(mrpt::opengl::CSetOfObjects::Ptr& windObj) const

Returns the 3D object representing the wind grid information.

virtual void increaseUncertainty(const double STD_increase_value)

Increase the kf_std of all cells from the m_map This mehod is usually called by the main_map to simulate loss of confidence in measurements when time passes.

bool simulateAdvection(double STD_increase_value)

Implements the transition model of the gasConcentration map using the information of the wind maps.

void clear()

Calls the base CMetricMap::clear Declared here to avoid ambiguity between the two clear() in both base classes.

virtual std::string asString() const

Returns a short description of the map.

virtual bool isEmpty() const

Returns true if the map is empty/no observation has been inserted (in this class it always return false, unless redefined otherwise in base classes)

virtual void saveAsBitmapFile(const std::string& filName) const

Save the current map as a graphical file (BMP,PNG,…).

The file format will be derived from the file extension (see CImage::saveToFile ) It depends on the map representation model: mrAchim: Each pixel is the ratio \(\sum{\frac{wR}{w}}\) mrKalmanFilter: Each pixel is the mean value of the Gaussian that represents each cell.

See also:

getAsBitmapFile()

virtual void getAsBitmapFile(mrpt::img::CImage& out_img) const

Returns an image just as described in saveAsBitmapFile.

virtual void getAsMatrix(mrpt::math::CMatrixDouble& out_mat) const

Like saveAsBitmapFile(), but returns the data in matrix form (first row in the matrix is the upper (y_max) part of the map)

Like saveAsBitmapFile(), but returns the data in matrix form.

void resize(
    double new_x_min,
    double new_x_max,
    double new_y_min,
    double new_y_max,
    const TRandomFieldCell& defaultValueNewCells,
    double additionalMarginMeters = 1.0f
    )

Changes the size of the grid, maintaining previous contents.

See also:

setSize

virtual void setSize(
    const double x_min,
    const double x_max,
    const double y_min,
    const double y_max,
    const double resolution,
    const TRandomFieldCell* fill_value = nullptr
    )

Changes the size of the grid, erasing previous contents.

Parameters:

connectivity_descriptor

Optional user-supplied object that will visit all grid cells to define their connectivity with neighbors and the strength of existing edges. If present, it overrides all options in insertionOptions

See also:

resize

resize

void setCellsConnectivity(const ConnectivityDescriptor::Ptr& new_connectivity_descriptor)

Sets a custom object to define the connectivity between cells.

Must call clear() or setSize() afterwards for the changes to take place.

virtual float compute3DMatchingRatio(
    const mrpt::maps::CMetricMap* otherMap,
    const mrpt::poses::CPose3D& otherMapPose,
    const TMatchingRatioParams& params
    ) const

See docs in base class: in this class this always returns 0.

virtual void saveMetricMapRepresentationToFile(const std::string& filNamePrefix) const

The implementation in this class just calls all the corresponding method of the contained metric maps.

virtual void saveAsMatlab3DGraph(const std::string& filName) const

Save a matlab “.m” file which represents as 3D surfaces the mean and a given confidence level for the concentration of each cell.

This method can only be called in a KF map model.

See also:

getAsMatlab3DGraphScript

void getAsMatlab3DGraphScript(std::string& out_script) const

Return a large text block with a MATLAB script to plot the contents of this map.

See also:

saveAsMatlab3DGraph This method can only be called in a KF map model

TMapRepresentation getMapType()

Return the type of the random-field grid map, according to parameters passed on construction.

void insertIndividualReading(
    const double sensorReading,
    const mrpt::math::TPoint2D& point,
    const bool update_map = true,
    const bool time_invariant = true,
    const double reading_stddev = .0
    )

Direct update of the map with a reading in a given position of the map, using the appropriate method according to mapType passed in the constructor.

This is a direct way to update the map, an alternative to the generic insertObservation() method which works with mrpt::obs::CObservation objects.

virtual void predictMeasurement(
    const double x,
    const double y,
    double& out_predict_response,
    double& out_predict_response_variance,
    bool do_sensor_normalization,
    const TGridInterpolationMethod interp_method = gimNearest
    )

Returns the prediction of the measurement at some (x,y) coordinates, and its certainty (in the form of the expected variance).

void getMeanAndCov(mrpt::math::CVectorDouble& out_means, mrpt::math::CMatrixDouble& out_cov) const

Return the mean and covariance vector of the full Kalman filter estimate (works for all KF-based methods).

void getMeanAndSTD(mrpt::math::CVectorDouble& out_means, mrpt::math::CVectorDouble& out_STD) const

Return the mean and STD vectors of the full Kalman filter estimate (works for all KF-based methods).

void setMeanAndSTD(mrpt::math::CVectorDouble& out_means, mrpt::math::CVectorDouble& out_STD)

Load the mean and STD vectors of the full Kalman filter estimate (works for all KF-based methods).

void updateMapEstimation()

Run the method-specific procedure required to ensure that the mean & variances are up-to-date with all inserted observations.