Main MRPT website > C++ reference
MRPT logo
Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Private Types
mrpt::slam::CRandomFieldGridMap2D Class Reference

Detailed Description

CRandomFieldGridMap2D represents a 2D grid map where each cell is associated one real-valued property which is estimated by this map, either as a simple value or as a probility distribution (for each cell).

There are a number of methods available to build the gas grid-map, depending on the value of "TMapRepresentation maptype" passed in the constructor.

The following papers describe the mapping alternatives implemented here:

Note that this class is virtual, since derived classes still have to implement:

See also:
mrpt::slam::CGasConcentrationGridMap2D, mrpt::slam::CWirelessPowerGridMap2D, mrpt::slam::CMetricMap, mrpt::utils::CDynamicGrid, The application icp-slam, mrpt::slam::CMultiMetricMap

#include <mrpt/slam/CRandomFieldGridMap2D.h>

Inheritance diagram for mrpt::slam::CRandomFieldGridMap2D:
Inheritance graph
[legend]

List of all members.

Classes

struct  TInsertionOptionsCommon
 Parameters common to any derived class. More...

Public Types

enum  TMapRepresentation {
  mrKernelDM = 0, mrAchim = 0, mrKalmanFilter, mrKalmanApproximate,
  mrKernelDMV
}
 The type of map representation to be used. More...

Public Member Functions

void clear ()
 Calls the base CMetricMap::clear Declared here to avoid ambiguity between the two clear() in both base classes.
float cell2float (const TRandomFieldCell &c) const
 CRandomFieldGridMap2D (TMapRepresentation mapType=mrAchim, float x_min=-2, float x_max=2, float y_min=-2, float y_max=2, float resolution=0.1)
 Constructor.
virtual ~CRandomFieldGridMap2D ()
 Destructor.
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,...).
virtual void getAsBitmapFile (mrpt::utils::CImage &out_img) const
 Returns an image just as described in saveAsBitmapFile.
virtual void resize (float new_x_min, float new_x_max, float new_y_min, float new_y_max, const TRandomFieldCell &defaultValueNewCells, float additionalMarginMeters=1.0f)
 Changes the size of the grid, maintaining previous contents.
float compute3DMatchingRatio (const CMetricMap *otherMap, const CPose3D &otherMapPose, float minDistForCorr=0.10f, float minMahaDistForCorr=2.0f) const
 Computes the ratio in [0,1] of correspondences between "this" and the "otherMap" map, whose 6D pose relative to "this" is "otherMapPose" In the case of a multi-metric map, this returns the average between the maps.
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.
void getAsMatlab3DGraphScript (std::string &out_script) const
 Return a large text block with a MATLAB script to plot the contents of this map.
virtual void getAs3DObject (mrpt::opengl::CSetOfObjectsPtr &outObj) const
 Returns a 3D object representing the map.
TMapRepresentation getMapType ()
 Return the type of the random-field grid map, according to parameters passed on construction.
virtual void predictMeasurement (const double &x, const double &y, double &out_predict_response, double &out_predict_response_variance)
 Returns the prediction of the measurement at some (x,y) coordinates, and its certainty (in the form of the expected variance).
void getMeanAndCov (vector_double &out_means, CMatrixDouble &out_cov) const
 Return the mean and covariance vector of the full Kalman filter estimate (works for all KF-based methods).

Protected Member Functions

virtual
CRandomFieldGridMap2D::TInsertionOptionsCommon * 
getCommonInsertOptions ()=0
 Get the part of the options common to all CRandomFieldGridMap2D classes.
void insertObservation_KernelDM_DMV (float normReading, const CPose3D &sensorPose, bool is_DMV)
 The implementation of "insertObservation" for Achim Lilienthal's map models DM & DM+V.
void insertObservation_KF (float normReading, const CPose3D &sensorPose)
 The implementation of "insertObservation" for the (whole) Kalman Filter map model.
void insertObservation_KF2 (float normReading, const CPose3D &sensorPose)
 The implementation of "insertObservation" for the Efficient Kalman Filter map model.
double computeMeanCellValue_DM_DMV (const TRandomFieldCell *cell) const
 Computes the average cell concentration, or the overall average value if it has never been observed.
double computeVarCellValue_DM_DMV (const TRandomFieldCell *cell) const
 Computes the estimated variance of the cell concentration, or the overall average variance if it has never been observed.
void recoverMeanAndCov () const
 In the KF2 implementation, takes the auxiliary matrices and from them update the cells' mean and std values.
virtual void internal_clear ()
 Erase all the contents of the map.

Protected Attributes

TInsertionOptionsCommon * m_insertOptions_common
 Common options to all random-field grid maps: pointer that is set to the derived-class instance of "insertOptions" upon construction of this class.
TMapRepresentation m_mapType
 The map representation type of this map, as passed in the constructor.
CMatrixD m_cov
 The whole covariance matrix, used for the Kalman Filter map representation.
CMatrixD m_stackedCov
 The compressed band diagonal matrix for the KF2 implementation.
bool m_hasToRecoverMeanAndCov
 Only for the KF2 implementation.
Auxiliary vars for DM & DM+V methods
float m_DM_lastCutOff
std::vector< float > m_DM_gaussWindow
double m_average_normreadings_mean
double m_average_normreadings_var
size_t m_average_normreadings_count

Private Types

typedef utils::CDynamicGrid
< TRandomFieldCell > 
BASE

RTTI stuff

static const
mrpt::utils::TRuntimeClassId 
classCRandomFieldGridMap2D
class mrpt::utils::CStream
static const
mrpt::utils::TRuntimeClassId * 
_GetBaseClass ()
virtual const
mrpt::utils::TRuntimeClassId * 
GetRuntimeClass () const
 Returns information about the class of an object in runtime.

Member Typedef Documentation

Definition at line 114 of file CRandomFieldGridMap2D.h.


Member Enumeration Documentation

The type of map representation to be used.

Enumerator:
mrKernelDM 
mrAchim 
mrKalmanFilter 
mrKalmanApproximate 
mrKernelDMV 

Definition at line 133 of file CRandomFieldGridMap2D.h.


Constructor & Destructor Documentation

mrpt::slam::CRandomFieldGridMap2D::CRandomFieldGridMap2D ( TMapRepresentation  mapType = mrAchim,
float  x_min = -2,
float  x_max = 2,
float  y_min = -2,
float  y_max = 2,
float  resolution = 0.1 
)

Constructor.

virtual mrpt::slam::CRandomFieldGridMap2D::~CRandomFieldGridMap2D ( ) [virtual]

Destructor.


Member Function Documentation

static const mrpt::utils::TRuntimeClassId* mrpt::slam::CRandomFieldGridMap2D::_GetBaseClass ( ) [static, protected]
float mrpt::slam::CRandomFieldGridMap2D::cell2float ( const TRandomFieldCell &  c) const [inline]

Definition at line 126 of file CRandomFieldGridMap2D.h.

References mrpt::slam::TRandomFieldCell::kf_mean.

void mrpt::slam::CRandomFieldGridMap2D::clear ( void  ) [inline]

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

Reimplemented from mrpt::slam::CMetricMap.

Definition at line 123 of file CRandomFieldGridMap2D.h.

float mrpt::slam::CRandomFieldGridMap2D::compute3DMatchingRatio ( const CMetricMap *  otherMap,
const CPose3D &  otherMapPose,
float  minDistForCorr = 0.10f,
float  minMahaDistForCorr = 2.0f 
) const [virtual]

Computes the ratio in [0,1] of correspondences between "this" and the "otherMap" map, whose 6D pose relative to "this" is "otherMapPose" In the case of a multi-metric map, this returns the average between the maps.

This method always return 0 for grid maps.

Parameters:
otherMap[IN] The other map to compute the matching with.
otherMapPose[IN] The 6D pose of the other map as seen from "this".
minDistForCorr[IN] The minimum distance between 2 non-probabilistic map elements for counting them as a correspondence.
minMahaDistForCorr[IN] The minimum Mahalanobis distance between 2 probabilistic map elements for counting them as a correspondence.
Returns:
The matching ratio [0,1]
See also:
computeMatchingWith2D

Implements mrpt::slam::CMetricMap.

double mrpt::slam::CRandomFieldGridMap2D::computeMeanCellValue_DM_DMV ( const TRandomFieldCell *  cell) const [protected]

Computes the average cell concentration, or the overall average value if it has never been observed.

double mrpt::slam::CRandomFieldGridMap2D::computeVarCellValue_DM_DMV ( const TRandomFieldCell *  cell) const [protected]

Computes the estimated variance of the cell concentration, or the overall average variance if it has never been observed.

virtual void mrpt::slam::CRandomFieldGridMap2D::getAs3DObject ( mrpt::opengl::CSetOfObjectsPtr &  outObj) const [virtual]

Returns a 3D object representing the map.

Implements mrpt::slam::CMetricMap.

Reimplemented in mrpt::slam::CGasConcentrationGridMap2D, and mrpt::slam::CWirelessPowerGridMap2D.

virtual void mrpt::slam::CRandomFieldGridMap2D::getAsBitmapFile ( mrpt::utils::CImage &  out_img) const [virtual]

Returns an image just as described in saveAsBitmapFile.

Reimplemented in mrpt::slam::CGasConcentrationGridMap2D, and mrpt::slam::CWirelessPowerGridMap2D.

void mrpt::slam::CRandomFieldGridMap2D::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.
virtual CRandomFieldGridMap2D::TInsertionOptionsCommon* mrpt::slam::CRandomFieldGridMap2D::getCommonInsertOptions ( ) [protected, pure virtual]

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

Implemented in mrpt::slam::CGasConcentrationGridMap2D, and mrpt::slam::CWirelessPowerGridMap2D.

TMapRepresentation mrpt::slam::CRandomFieldGridMap2D::getMapType ( )

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

void mrpt::slam::CRandomFieldGridMap2D::getMeanAndCov ( vector_double &  out_means,
CMatrixDouble &  out_cov 
) const

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

virtual const mrpt::utils::TRuntimeClassId* mrpt::slam::CRandomFieldGridMap2D::GetRuntimeClass ( ) const [virtual]

Returns information about the class of an object in runtime.

Reimplemented from mrpt::slam::CMetricMap.

Reimplemented in mrpt::slam::CWirelessPowerGridMap2D, and mrpt::slam::CGasConcentrationGridMap2D.

void mrpt::slam::CRandomFieldGridMap2D::insertObservation_KernelDM_DMV ( float  normReading,
const CPose3D &  sensorPose,
bool  is_DMV 
) [protected]

The implementation of "insertObservation" for Achim Lilienthal's map models DM & DM+V.

Parameters:
normReadingIs a [0,1] normalized concentration reading.
sensorPoseIs the sensor pose on the robot
is_DMV= false -> map type is Kernel DM; true -> map type is DM+V
void mrpt::slam::CRandomFieldGridMap2D::insertObservation_KF ( float  normReading,
const CPose3D &  sensorPose 
) [protected]

The implementation of "insertObservation" for the (whole) Kalman Filter map model.

Parameters:
normReadingIs a [0,1] normalized concentration reading.
sensorPoseIs the sensor pose
void mrpt::slam::CRandomFieldGridMap2D::insertObservation_KF2 ( float  normReading,
const CPose3D &  sensorPose 
) [protected]

The implementation of "insertObservation" for the Efficient Kalman Filter map model.

Parameters:
normReadingIs a [0,1] normalized concentration reading.
sensorPoseIs the sensor pose
virtual void mrpt::slam::CRandomFieldGridMap2D::internal_clear ( ) [protected, virtual]

Erase all the contents of the map.

Implements mrpt::slam::CMetricMap.

Reimplemented in mrpt::slam::CGasConcentrationGridMap2D, and mrpt::slam::CWirelessPowerGridMap2D.

virtual bool mrpt::slam::CRandomFieldGridMap2D::isEmpty ( ) const [virtual]

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)

Implements mrpt::slam::CMetricMap.

virtual void mrpt::slam::CRandomFieldGridMap2D::predictMeasurement ( const double &  x,
const double &  y,
double &  out_predict_response,
double &  out_predict_response_variance 
) [virtual]

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

This methods is implemented differently for the different gas map types.

void mrpt::slam::CRandomFieldGridMap2D::recoverMeanAndCov ( ) const [protected]

In the KF2 implementation, takes the auxiliary matrices and from them update the cells' mean and std values.

See also:
m_hasToRecoverMeanAndCov
virtual void mrpt::slam::CRandomFieldGridMap2D::resize ( float  new_x_min,
float  new_x_max,
float  new_y_min,
float  new_y_max,
const TRandomFieldCell &  defaultValueNewCells,
float  additionalMarginMeters = 1.0f 
) [virtual]

Changes the size of the grid, maintaining previous contents.

See also:
setSize
virtual void mrpt::slam::CRandomFieldGridMap2D::saveAsBitmapFile ( const std::string &  filName) const [virtual]

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 mrpt::slam::CRandomFieldGridMap2D::saveAsMatlab3DGraph ( const std::string &  filName) const [virtual]

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

Reimplemented in mrpt::slam::CGasConcentrationGridMap2D, and mrpt::slam::CWirelessPowerGridMap2D.

virtual void mrpt::slam::CRandomFieldGridMap2D::saveMetricMapRepresentationToFile ( const std::string &  filNamePrefix) const [virtual]

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

Implements mrpt::slam::CMetricMap.

Reimplemented in mrpt::slam::CGasConcentrationGridMap2D, and mrpt::slam::CWirelessPowerGridMap2D.


Friends And Related Function Documentation

friend class mrpt::utils::CStream [friend]

Reimplemented from mrpt::slam::CMetricMap.

Definition at line 117 of file CRandomFieldGridMap2D.h.


Member Data Documentation

Definition at line 117 of file CRandomFieldGridMap2D.h.

Definition at line 298 of file CRandomFieldGridMap2D.h.

Definition at line 297 of file CRandomFieldGridMap2D.h.

Definition at line 297 of file CRandomFieldGridMap2D.h.

The whole covariance matrix, used for the Kalman Filter map representation.

Definition at line 284 of file CRandomFieldGridMap2D.h.

Definition at line 296 of file CRandomFieldGridMap2D.h.

Definition at line 295 of file CRandomFieldGridMap2D.h.

Only for the KF2 implementation.

Definition at line 291 of file CRandomFieldGridMap2D.h.

Common options to all random-field grid maps: pointer that is set to the derived-class instance of "insertOptions" upon construction of this class.

Definition at line 276 of file CRandomFieldGridMap2D.h.

The map representation type of this map, as passed in the constructor.

Definition at line 282 of file CRandomFieldGridMap2D.h.

The compressed band diagonal matrix for the KF2 implementation.

The format is a Nx(W^2+2W+1) matrix, one row per cell in the grid map with the cross-covariances between each cell and half of the window around it in the grid.

Definition at line 290 of file CRandomFieldGridMap2D.h.




Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Sun Oct 16 12:16:33 UTC 2011