class mrpt::maps::CHeightGridMap2D_MRF

CHeightGridMap2D_MRF represents digital-elevation-model over a 2D area, with uncertainty, based on a Markov-Random-Field (MRF) estimator.

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()

New in MRPT 1.4.0

See also:

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

#include <mrpt/maps/CHeightGridMap2D_MRF.h>

class CHeightGridMap2D_MRF:
    public mrpt::maps::CRandomFieldGridMap2D,
    public mrpt::maps::CHeightGridMap2D_Base
{
public:
    // structs

    struct TInsertionOptions;

    //
fields

    mrpt::maps::CHeightGridMap2D_MRF::TInsertionOptions insertionOptions;
    bool run_map_estimation_at_ctor {true};
    double min_x {-2};
    double max_x {2};
    double min_y {-2};
    double max_y {2};
    double resolution {0.10f};
    mrpt::maps::CHeightGridMap2D_MRF::TMapRepresentation mapType {mrGMRF_SD};
    mrpt::maps::CHeightGridMap2D_MRF::TInsertionOptions insertionOpts;

    // construction

    CHeightGridMap2D_MRF(
        TMapRepresentation mapType = mrGMRF_SD,
        double x_min = -2,
        double x_max = 2,
        double y_min = -2,
        double y_max = 2,
        double resolution = 0.5,
        bool run_first_map_estimation_now = true
        );

    //
methods

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

    virtual bool insertIndividualPoint(
        const double x,
        const double y,
        const double z,
        const CHeightGridMap2D_Base::TPointInsertParams& params = CHeightGridMap2D_Base::TPointInsertParams()
        );

    virtual double dem_get_resolution() const;
    virtual size_t dem_get_size_x() const;
    virtual size_t dem_get_size_y() const;
    virtual bool dem_get_z_by_cell(size_t cx, size_t cy, double& z_out) const;
    virtual bool dem_get_z(const double x, const double y, double& z_out) const;
    virtual void dem_update_map();
    virtual CRandomFieldGridMap2D::TInsertionOptionsCommon* getCommonInsertOptions();
    virtual void internal_clear();

    virtual bool internal_insertObservation(
        const mrpt::obs::CObservation& obs,
        const std::optional<const mrpt::poses::CPose3D>& robotPose = std::nullopt
        );

    virtual double internal_computeObservationLikelihood(const mrpt::obs::CObservation& obs, const mrpt::poses::CPose3D& takenFrom) const;
};

Inherited Members

public:
    // structs

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

    //
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;

    virtual bool insertIndividualPoint(
        const double x,
        const double y,
        const double z,
        const TPointInsertParams& params = TPointInsertParams()
        ) = 0;

    virtual double dem_get_resolution() const = 0;
    virtual size_t dem_get_size_x() const = 0;
    virtual size_t dem_get_size_y() const = 0;
    virtual bool dem_get_z_by_cell(size_t cx, size_t cy, double& z_out) const = 0;
    virtual bool dem_get_z(const double x, const double y, double& z_out) const = 0;
    virtual void dem_update_map() = 0;

Fields

bool run_map_estimation_at_ctor {true}

Runs map estimation at start up (Default:true)

double min_x {-2}

See CHeightGridMap2D_MRF::CHeightGridMap2D_MRF.

mrpt::maps::CHeightGridMap2D_MRF::TMapRepresentation mapType {mrGMRF_SD}

The kind of map representation (see CHeightGridMap2D_MRF::CHeightGridMap2D_MRF)

mrpt::maps::CHeightGridMap2D_MRF::TInsertionOptions insertionOpts

Observations insertion options.

Construction

CHeightGridMap2D_MRF(
    TMapRepresentation mapType = mrGMRF_SD,
    double x_min = -2,
    double x_max = 2,
    double y_min = -2,
    double y_max = 2,
    double resolution = 0.5,
    bool run_first_map_estimation_now = true
    )

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.

virtual bool insertIndividualPoint(
    const double x,
    const double y,
    const double z,
    const CHeightGridMap2D_Base::TPointInsertParams& params = CHeightGridMap2D_Base::TPointInsertParams()
    )

Update the DEM with one new point.

Returns:

true if updated OK, false if (x,y) is out of bounds

See also:

mrpt::maps::CMetricMap::insertObservation() for inserting higher-level objects like 2D/3D LIDAR scans

virtual bool dem_get_z_by_cell(size_t cx, size_t cy, double& z_out) const

Get cell ‘z’ by (cx,cy) cell indices.

Returns:

false if out of bounds or un-observed cell.

virtual bool dem_get_z(const double x, const double y, double& z_out) const

Get cell ‘z’ (x,y) by metric coordinates.

Returns:

false if out of bounds or un-observed cell.

virtual void dem_update_map()

Ensure that all observations are reflected in the map estimate.

virtual CRandomFieldGridMap2D::TInsertionOptionsCommon* getCommonInsertOptions()

Get the part of the options common to all CRandomFieldGridMap2D classes.

virtual void internal_clear()

Internal method called by clear()

virtual bool internal_insertObservation(
    const mrpt::obs::CObservation& obs,
    const std::optional<const mrpt::poses::CPose3D>& robotPose = std::nullopt
    )

Internal method called by insertObservation()

virtual double internal_computeObservationLikelihood(
    const mrpt::obs::CObservation& obs,
    const mrpt::poses::CPose3D& takenFrom
    ) const

Internal method called by computeObservationLikelihood()