10 #ifndef CRandomFieldGridMap2D_H
11 #define CRandomFieldGridMap2D_H
23 #if EIGEN_VERSION_AT_LEAST(3,1,0) // eigen 3.1+
24 #include <Eigen/SparseCore>
25 #include <Eigen/SparseCholesky>
35 #if defined(MRPT_IS_X86_AMD64)
46 kf_mean (kfmean_dm_mean),
47 kf_std (kfstd_dmmeanw),
49 last_updated(
mrpt::system::
now()),
50 updated_std (kfstd_dmmeanw)
81 #if defined(MRPT_IS_X86_AMD64)
151 float resolution = 0.1
186 void internal_loadFromConfigFile_common(
188 const std::string §ion);
230 virtual void resize(
float new_x_min,
235 float additionalMarginMeters = 1.0f );
241 float maxDistForCorr = 0.10f,
242 float maxMahaDistForCorr = 2.0f
249 const std::string &filNamePrefix
265 virtual void getAs3DObject ( mrpt::opengl::CSetOfObjectsPtr &outObj )
const;
269 virtual void getAs3DObject ( mrpt::opengl::CSetOfObjectsPtr &meanObj, mrpt::opengl::CSetOfObjectsPtr &varObj )
const;
288 double &out_predict_response,
289 double &out_predict_response_variance );
329 #if EIGEN_VERSION_AT_LEAST(3,1,0)
330 std::vector<Eigen::Triplet<double> > H_prior;
413 const size_t seed_cxo,
414 const size_t seed_cyo,
415 const size_t objective_cxo,
416 const size_t objective_cyo);
std::multimap< size_t, size_t > cell_interconnections
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
std::string GMRF_gridmap_image_file
image name of the occupancy_gridmap
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.
void insertIndividualReading(const float sensorReading, const mrpt::math::TPoint2D &point)
Direct update of the map with a reading in a given position of the map, using the appropriate method ...
float sigma
The sigma of the "Parzen"-kernel Gaussian.
virtual void getAsBitmapFile(mrpt::utils::CImage &out_img) const
Returns an image just as described in saveAsBitmapFile.
void clear()
Calls the base CMetricMap::clear Declared here to avoid ambiguity between the two clear() in both bas...
TMapRepresentation
The type of map representation to be used, see CRandomFieldGridMap2D for a discussion.
static void fill(bimap< enum_t, std::string > &m_map)
This class is a "CSerializable" wrapper for "CMatrixTemplateNumeric".
float compute3DMatchingRatio(const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose3D &otherMapPose, float maxDistForCorr=0.10f, float maxMahaDistForCorr=2.0f) const
See docs in base class: in this class this always returns 0.
double m_average_normreadings_mean
float KF_defaultCellMeanValue
The default value for the mean of cells' concentration.
double computeConfidenceCellValue_DM_DMV(const TRandomFieldCell *cell) const
Computes the confidence of the cell concentration (alpha)
A class for storing images as grayscale or RGB bitmaps.
uint16_t GMRF_constraintsSize
The size of the Gaussian window to impose fixed restrictions between cells.
float GMRF_lambdaObsLoss
The loss of information of the observations with each iteration.
void clear()
Erase all the contents of the map.
void insertObservation_KF(float normReading, const mrpt::math::TPoint2D &point)
The implementation of "insertObservation" for the (whole) Kalman Filter map model.
mrpt::math::CMatrixD m_cov
The whole covariance matrix, used for the Kalman Filter map representation.
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction...
std::vector< float > m_DM_gaussWindow
mrpt::system::TTimeStamp now()
A shortcut for system::getCurrentTime.
mrpt::system::TTimeStamp last_updated
[Dynamic maps only] The timestamp of the last time the cell was updated
double gmrf_mean
[GMRF only] The mean value of this cell
Only specializations of this class are defined for each enum type of interest.
std::vector< float > gauss_val
float cutoffRadius
The cutoff radius for updating cells.
virtual void saveMetricMapRepresentationToFile(const std::string &filNamePrefix) const
The implementation in this class just calls all the corresponding method of the contained metric maps...
This class allows loading and storing values and vectors of different types from a configuration text...
#define DEFINE_VIRTUAL_SERIALIZABLE(class_name)
This declaration must be inserted in virtual CSerializable classes definition:
double computeVarCellValue_DM_DMV(const TRandomFieldCell *cell) const
Computes the estimated variance of the cell concentration, or the overall average variance if it has ...
TMapRepresentation m_mapType
The map representation type of this map, as passed in the constructor.
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 saveAsBitmapFile(const std::string &filName) const
Save the current map as a graphical file (BMP,PNG,...).
double dm_mean_w
[Kernel-methods only] The cumulative weights (concentration = alpha * dm_mean / dm_mean_w + (1-alpha)...
Parameters common to any derived class.
float KF_observationModelNoise
The sensor model noise (in normalized concentration units).
TInsertionOptionsCommon * m_insertOptions_common
Common options to all random-field grid maps: pointer that is set to the derived-class instance of "i...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
TRandomFieldCell(double kfmean_dm_mean=1e-20, double kfstd_dmmeanw=0)
Constructor.
A 2D grid of dynamic size which stores any kind of data at each cell.
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
TMapRepresentation getMapType()
Return the type of the random-field grid map, according to parameters passed on construction.
double kf_mean
[KF-methods only] The mean value of this cell
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 meth...
The contents of each cell in a CRandomFieldGridMap2D map.
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...
size_t m_average_normreadings_count
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)...
A bidirectional version of std::map, declared as bimap and which actually contains two std...
void insertObservation_GMRF(float normReading, const mrpt::math::TPoint2D &point)
The implementation of "insertObservation" for the Gaussian Markov Random Field map model...
void recoverMeanAndCov() const
In the KF2 implementation, takes the auxiliary matrices and from them update the cells' mean and std ...
double dm_sigma_omega
[DM/DM+V methods] The scaling parameter for the confidence "alpha" values (see the IROS 2009 paper; s...
float GMRF_lambdaObs
The initial information (Lambda) of each observation (this information will decrease with time) ...
float cell2float(const TRandomFieldCell &c) const
bool m_hasToRecoverMeanAndCov
Only for the KF2 implementation.
float GMRF_gridmap_image_res
occupancy_gridmap resolution: size of each pixel (m)
double updated_std
[Dynamic maps only] The std cell value that was updated (to be used in the Forgetting_curve ...
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.
A class for storing an occupancy grid map.
float GMRF_lambdaPrior
The information (Lambda) of fixed map constraints.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
CRandomFieldGridMap2D represents a 2D grid map where each cell is associated one real-valued property...
float KF_covSigma
The "sigma" for the initial covariance value between cells (in meters).
Declares a virtual base class for all metric maps storage classes.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
void insertObservation_KernelDM_DMV(float normReading, const mrpt::math::TPoint2D &point, bool is_DMV)
The implementation of "insertObservation" for Achim Lilienthal's map models DM & DM+V.
double m_average_normreadings_var
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 o...
double dmv_var_mean
[Kernel DM-V only] The cumulative weighted variance of this cell
bool GMRF_use_occupancy_information
wether to use information of an occupancy_gridmap map for buidling the GMRF
std::string GMRF_simplemap_file
simplemap_file name of the occupancy_gridmap
uint16_t KF_W_size
[mrKalmanApproximate] The size of the window of neighbor cells.
float GMRF_constraintsSigma
The sigma of the Gaussian window to impose fixed restrictions between cells.
virtual void getAs3DObject(mrpt::opengl::CSetOfObjectsPtr &outObj) const
Returns a 3D object representing the map (mean).
void insertObservation_KF2(float normReading, const mrpt::math::TPoint2D &point)
The implementation of "insertObservation" for the Efficient Kalman Filter map model.
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)...
mrpt::math::CMatrixD m_stackedCov
The compressed band diagonal matrix for the KF2 implementation.
virtual CRandomFieldGridMap2D::TInsertionOptionsCommon * getCommonInsertOptions()=0
Get the part of the options common to all CRandomFieldGridMap2D classes.
virtual void internal_clear()
Erase all the contents of the map.
bool exist_relation_between2cells(const mrpt::maps::COccupancyGridMap2D *m_Ocgridmap, size_t cxo_min, size_t cxo_max, size_t cyo_min, size_t cyo_max, const size_t seed_cxo, const size_t seed_cyo, const size_t objective_cxo, const size_t objective_cyo)
Check if two cells of the gridmap (m_map) are connected, based on the provided occupancy gridmap...
void insert(const KEY &k, const VALUE &v)
Insert a new pair KEY<->VALUE in the bi-map.
double dm_mean
[Kernel-methods only] The cumulative weighted readings of this cell
size_t GMRF_gridmap_image_cx
Pixel coordinates of the origin for the occupancy_gridmap.
virtual bool isEmpty() const
Returns true if the map is empty/no observation has been inserted (in this class it always return fal...
Another alias for "mrKernelDM", for backwards compatibility.
virtual ~CRandomFieldGridMap2D()
Destructor.
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
void updateMapEstimation_GMRF()
solves the minimum quadratic system to determine the new concentration of each cell ...
float KF_initialCellStd
The initial standard deviation of each cell's concentration (will be stored both at each cell's struc...
size_t GMRF_gridmap_image_cy
Pixel coordinates of the origin for the occupancy_gridmap.
utils::CDynamicGrid< TRandomFieldCell > BASE
double kf_std
[KF-methods only] The standard deviation value of this cell
double computeMeanCellValue_DM_DMV(const TRandomFieldCell *cell) const
Computes the average cell concentration, or the overall average value if it has never been observed...
std::vector< std::vector< TobservationGMRF > > activeObs
maps::CRandomFieldGridMap2D::TMapRepresentation enum_t