class mrpt::maps::CHeightGridMap2D_Base
Overview
Virtual base class for Digital Elevation Model (DEM) maps.
See derived classes for details. This class implements those operations which are especific to DEMs.
#include <mrpt/maps/CHeightGridMap2D_Base.h> class CHeightGridMap2D_Base { public: // structs struct TPointInsertParams; // construction CHeightGridMap2D_Base(); // methods bool intersectLine3D(const mrpt::math::TLine3D& r1, mrpt::math::TObject3D& obj) const; bool getMinMaxHeight(float& z_min, float& z_max) const; std::optional<std::pair<float, float>> getMinMaxHeightOpt() 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; bool dem_internal_insertObservation(const mrpt::obs::CObservation& obs, const std::optional<const mrpt::poses::CPose3D>& robotPose = std::nullopt); }; // direct descendants class CHeightGridMap2D; class CHeightGridMap2D_MRF;
Methods
bool intersectLine3D(const mrpt::math::TLine3D& r1, mrpt::math::TObject3D& obj) const
Gets the intersection between a 3D line and a Height Grid map (taking into account the different heights of each individual cell)
bool getMinMaxHeight(float& z_min, float& z_max) const
Computes the minimum and maximum height in the grid.
Deprecated Use getMinMaxHeightOpt() returning optional instead.
Returns:
False if there is no observed cell yet.
std::optional<std::pair<float, float>> getMinMaxHeightOpt() const
Returns {z_min, z_max} if any cell is observed, or std::nullopt otherwise.
virtual bool insertIndividualPoint( const double x, const double y, const double z, const TPointInsertParams& params = TPointInsertParams() ) = 0
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 = 0
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 = 0
Get cell ‘z’ (x,y) by metric coordinates.
Returns:
false if out of bounds or un-observed cell.
virtual void dem_update_map() = 0
Ensure that all observations are reflected in the map estimate.
bool dem_internal_insertObservation( const mrpt::obs::CObservation& obs, const std::optional<const mrpt::poses::CPose3D>& robotPose = std::nullopt )
Internal method called by internal_insertObservation()