class mrpt::maps::CReflectivityGridMap2D

A 2D grid map representing the reflectivity of the environment (for example, measured with an IR proximity sensor).

Important implemented features are:

  • Insertion of mrpt::obs::CObservationReflectivity observations.

  • Probability estimation of observations. See base class.

  • Rendering as 3D object: a 2D textured plane.

  • Automatic resizing of the map limits when inserting observations close to the border.

Each cell contains the up-to-date average height from measured falling in that cell. Algorithms that can be used:

  • mrSimpleAverage: Each cell only stores the current average value.

#include <mrpt/maps/CReflectivityGridMap2D.h>

class CReflectivityGridMap2D:
    public mrpt::maps::CMetricMap,
    public mrpt::containers::CDynamicGrid,
    public mrpt::maps::CLogOddsGridMap2D
{
public:
    // typedefs

    typedef detail::logoddscell_traits<int8_t> traits_t;

    // structs

    struct TInsertionOptions;

    //
fields

    mrpt::maps::CReflectivityGridMap2D::TInsertionOptions insertionOptions;

    // construction

    CReflectivityGridMap2D(
        double x_min = -2,
        double x_max = 2,
        double y_min = -2,
        double y_max = 2,
        double resolution = 0.1
        );

    //
methods

    void clear();
    virtual float cell2float(const int8_t&) const;
    virtual bool isEmpty() const;
    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 getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr& outObj) const;
    void getAsImage(mrpt::img::CImage& img, bool verticalFlip = false, bool forceRGB = false) const;
};

Inherited Members

public:
    // typedefs

    typedef TCELL cell_t;

    //
methods

    virtual bool isEmpty() const = 0;
    virtual void saveMetricMapRepresentationToFile(const std::string& filNamePrefix) const = 0;
    virtual void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr& outObj) const = 0;

    static void updateCell_fast_occupied(
        const unsigned x,
        const unsigned y,
        const cell_t logodd_obs,
        const cell_t thres,
        cell_t* mapArray,
        const unsigned _size_x
        );

    static void updateCell_fast_occupied(cell_t* theCell, const cell_t logodd_obs, const cell_t thres);

    static void updateCell_fast_free(
        const unsigned x,
        const unsigned y,
        const cell_t logodd_obs,
        const cell_t thres,
        cell_t* mapArray,
        const unsigned _size_x
        );

    static void updateCell_fast_free(cell_t* theCell, const cell_t logodd_obs, const cell_t thres);

Construction

CReflectivityGridMap2D(
    double x_min = -2,
    double x_max = 2,
    double y_min = -2,
    double y_max = 2,
    double resolution = 0.1
    )

Constructor.

Methods

void clear()

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

virtual float cell2float(const int8_t&) const

The user must implement this in order to provide “saveToTextFile” a way to convert each cell into a numeric value.

virtual bool isEmpty() const

Returns true if the map is empty/no observation has been inserted.

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

This virtual method saves the map to a file “filNamePrefix”+< some_file_extension >, as an image or in any other applicable way (Notice that other methods to save the map may be implemented in classes implementing this virtual interface).

virtual void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr& outObj) const

Returns a 3D object representing the map.

See also:

genericMapParams, TMapGenericParams::enableSaveAs3DObject

void getAsImage(mrpt::img::CImage& img, bool verticalFlip = false, bool forceRGB = false) const

Returns the grid as a 8-bit graylevel image, where each pixel is a cell (output image is RGB only if forceRGB is true)