10#ifndef COccupancyGridMap2D_H
11#define COccupancyGridMap2D_H
28#include <mrpt/config.h>
29#if (!defined(OCCUPANCY_GRIDMAP_CELL_SIZE_8BITS) && !defined(OCCUPANCY_GRIDMAP_CELL_SIZE_16BITS)) || (defined(OCCUPANCY_GRIDMAP_CELL_SIZE_8BITS) && defined(OCCUPANCY_GRIDMAP_CELL_SIZE_16BITS))
30 #error One of OCCUPANCY_GRIDMAP_CELL_SIZE_16BITS or OCCUPANCY_GRIDMAP_CELL_SIZE_8BITS must be defined.
64#ifdef OCCUPANCY_GRIDMAP_CELL_SIZE_8BITS
75#ifdef OCCUPANCY_GRIDMAP_CELL_SIZE_8BITS
98 std::vector<cellType>
map;
120 static double H(
double p);
125 map[x+y*size_x]=p2l(value);
130 return l2p(map[x+y*size_x]);
134 if (cellIndex<size_x*size_y)
164 virtual
bool internal_insertObservation( const
mrpt::obs::CObservation *obs, const
mrpt::poses::CPose3D *robotPose = NULL )
MRPT_OVERRIDE;
168 const
std::vector<
cellType> & getRawMap()
const {
return this->map; }
175 TUpdateCellsInfoChangeOnly(
bool enabled =
false,
double I_change = 0,
int cellsUpdated=0) : enabled(enabled), I_change(I_change), cellsUpdated(cellsUpdated), laserRaysSkip(1)
182 } updateInfoChangeOnly;
184 void fill(
float default_value = 0.5f );
187 COccupancyGridMap2D(
float min_x = -20.0f,
float max_x = 20.0f,
float min_y = -20.0f,
float max_y = 20.0f,
float resolution = 0.05f );
200 void setSize(
float x_min,
float x_max,
float y_min,
float y_max,
float resolution,
float default_value = 0.5f);
211 void resizeGrid(
float new_x_min,
float new_x_max,
float new_y_min,
float new_y_max,
float new_cells_default_value = 0.5f,
bool additionalMargin =
true)
MRPT_NO_THROWS;
217 inline unsigned int getSizeX()
const {
return size_x; }
220 inline unsigned int getSizeY()
const {
return size_y; }
223 inline float getXMin()
const {
return x_min; }
226 inline float getXMax()
const {
return x_max; }
229 inline float getYMin()
const {
return y_min; }
232 inline float getYMax()
const {
return y_max; }
238 inline int x2idx(
float x)
const {
return static_cast<int>((x-x_min)/resolution ); }
239 inline int y2idx(
float y)
const {
return static_cast<int>((y-y_min)/resolution ); }
241 inline int x2idx(
double x)
const {
return static_cast<int>((x-x_min)/resolution ); }
242 inline int y2idx(
double y)
const {
return static_cast<int>((y-y_min)/resolution ); }
245 inline float idx2x(
const size_t cx)
const {
return x_min+(cx+0.5f)*resolution; }
246 inline float idx2y(
const size_t cy)
const {
return y_min+(cy+0.5f)*resolution; }
249 inline int x2idx(
float x,
float x_min)
const {
return static_cast<int>((x-x_min)/resolution ); }
250 inline int y2idx(
float y,
float y_min)
const {
return static_cast<int>((y-y_min)/resolution ); }
254 return m_logodd_lut.
l2p(l);
258 return m_logodd_lut.
l2p_255(l);
262 return m_logodd_lut.
p2l(p);
269 if (
static_cast<unsigned int>(x)>=size_x ||
static_cast<unsigned int>(y)>=size_y)
271 else map[x+y*size_x]=p2l(value);
278 if (
static_cast<unsigned int>(x)>=size_x ||
static_cast<unsigned int>(y)>=size_y)
280 else return l2p(map[x+y*size_x]);
284 inline cellType *
getRow(
int cy ) {
if (cy<0 ||
static_cast<unsigned int>(cy)>=size_y)
return NULL;
else return &map[0+cy*size_x]; }
287 inline const cellType *
getRow(
int cy )
const {
if (cy<0 ||
static_cast<unsigned int>(cy)>=size_y)
return NULL;
else return &map[0+cy*size_x]; }
290 inline void setPos(
float x,
float y,
float value) { setCell(x2idx(x),y2idx(y),value); }
293 inline float getPos(
float x,
float y)
const {
return getCell(x2idx(x),y2idx(y)); }
296 inline bool isStaticPos(
float x,
float y,
float threshold = 0.7f)
const {
return isStaticCell(x2idx(x),y2idx(y),threshold); }
297 inline bool isStaticCell(
int cx,
int cy,
float threshold = 0.7f)
const {
return (getCell(cx,cy)<=threshold); }
330 TEntropyInfo() : H(0),I(0),mean_H(0),mean_I(0),effectiveMappedArea(0),effectiveMappedCells(0)
381 lmMeanInformation = 0,
521 int computeClearance(
int cx,
int cy,
int *basis_x,
int *basis_y,
int *nBasis,
bool GetContourPoint =
false )
const;
554 float threshold = 0.6f,
557 unsigned int decimation = 1,
574 float threshold = 0.5f,
575 float rangeNoiseStd = 0.f,
580 const double x,
const double y,
const double angle_direction,
581 float &out_range,
bool &out_valid,
582 const double max_range_meters,
583 const float threshold_free=0.4f,
584 const double noiseStd=.0,
const double angleNoiseStd=.0 )
const;
667 const std::string &fileName,
677 const std::string &fileName,
686 template <
class CLANDMARKSMAP>
688 const std::string &file,
689 const CLANDMARKSMAP *landmarks,
690 bool addTextLabels =
false,
696 getAsImageFiltered( img,
false,
true );
698 for (
unsigned int i=0;i<landmarks->landmarks.size();i++)
700 const typename CLANDMARKSMAP::landmark_type *lm = landmarks->landmarks.get( i );
701 int px = x2idx( lm->pose_mean.x );
702 int py = topleft ? size_y-1- y2idx( lm->pose_mean.y ) : y2idx( lm->pose_mean.y );
703 img.
rectangle( px - 7, (py + 7), px +7, (py -7), marks_color );
704 img.
rectangle( px - 6, (py + 6), px +6, (py -6), marks_color );
745 bool loadFromBitmapFile(const
std::
string &file,
float resolution,
float xCentralPixel = -1,
float yCentralPixel =-1 );
755 bool loadFromBitmap(const
mrpt::utils::
CImage &img,
float resolution,
float xCentralPixel = -1,
float yCentralPixel =-1 );
762 virtual
void determineMatching2D(
764 const
mrpt::poses::CPose2D & otherMapPose,
774 void saveMetricMapRepresentationToFile(const
std::
string &filNamePrefix) const
MRPT_OVERRIDE;
785 std::vector<int>
x,y;
787 std::vector<int>
x_basis1,y_basis1, x_basis2,y_basis2;
788 } CriticalPointsList;
808 int direccion_vecino_x[8],direccion_vecino_y[8];
818 float min_x,max_x,min_y,max_y,resolution;
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
#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...
#define MAP_DEFINITION_END(_CLASS_NAME_, _LINKAGE_)
#define MAP_DEFINITION_START(_CLASS_NAME_, _LINKAGE_)
Add a MAP_DEFINITION_START() ... MAP_DEFINITION_END() block inside the declaration of each metric map...
Declares a virtual base class for all metric maps storage classes.
This class stores any customizable set of metric maps.
Declares a class that represents a Rao-Blackwellized set of particles for solving the SLAM problem (T...
With this struct options are provided to the observation insertion process.
float maxOccupancyUpdateCertainty
A value in the range [0.5,1] used for updating cell with a bayesian approach (default 0....
float mapAltitude
The altitude (z-axis) of 2D scans (within a 0.01m tolerance) for they to be inserted in this map!
bool useMapAltitude
The parameter "mapAltitude" has effect while inserting observations in the grid only if this is true.
float CFD_features_gaussian_size
Gaussian sigma of the filter used in getAsImageFiltered (for features detection) (Default=1) (0:Disab...
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion) MRPT_OVERRIDE
This method load the options from a ".ini" file.
void dumpToTextStream(mrpt::utils::CStream &out) const MRPT_OVERRIDE
This method should clearly display all the contents of the structure in textual form,...
float horizontalTolerance
The tolerance in rads in pitch & roll for a laser scan to be considered horizontal,...
TInsertionOptions()
Initilization of default parameters.
float maxDistanceInsertion
The largest distance at which cells will be updated (Default 15 meters)
float CFD_features_median_size
Size of the Median filter used in getAsImageFiltered (for features detection) (Default=3) (0:Disabled...
bool considerInvalidRangesAsFreeSpace
If set to true (default), invalid range values (no echo rays) as consider as free space until "maxOcc...
uint16_t decimation
Specify the decimation of the range scan (default=1 : take all the range values!)
bool wideningBeamsWithDistance
Enabled: Rays widen with distance to approximate the real behavior of lasers, disabled: insert rays a...
With this struct options are provided to the observation likelihood computation process.
TLikelihoodMethod likelihoodMethod
The selected method to compute an observation likelihood.
bool enableLikelihoodCache
Enables the usage of a cache of likelihood values (for LF methods), if set to true (default=false).
float LF_stdHit
[LikelihoodField] The laser range "sigma" used in computations; Default value = 0....
float consensus_pow
[Consensus] The power factor for the likelihood (default=5)
float LF_maxCorrsDistance
[LikelihoodField] The max. distance for searching correspondences around each sensed point
uint32_t MI_skip_rays
[MI] The scan rays decimation: at every N rays, one will be used to compute the MI
void dumpToTextStream(mrpt::utils::CStream &out) const MRPT_OVERRIDE
This method should clearly display all the contents of the structure in textual form,...
uint32_t LF_decimation
[LikelihoodField] The decimation of the points in a scan, default=1 == no decimation
int32_t rayTracing_decimation
[rayTracing] One out of "rayTracing_decimation" rays will be simulated and compared only: set to 1 to...
float LF_maxRange
[LikelihoodField] The max. range of the sensor (Default= 81 m)
TLikelihoodOptions()
Initilization of default parameters.
bool LF_useSquareDist
[LikelihoodField] (Default:false) Use exp(dist^2/std^2) instead of exp(dist^2/std^2)
float MI_ratio_max_distance
[MI] The ratio for the max. distance used in the MI computation and in the insertion of scans,...
float rayTracing_stdHit
[rayTracing] The laser range sigma.
bool LF_alternateAverageMethod
[LikelihoodField] Set this to "true" ot use an alternative method, where the likelihood of the whole ...
std::vector< float > OWA_weights
[OWA] The sequence of weights to be multiplied to of the ordered list of likelihood values (first one...
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion) MRPT_OVERRIDE
This method load the options from a ".ini" file.
float MI_exponent
[MI] The exponent in the MI likelihood computation. Default value = 5
int32_t consensus_takeEachRange
[Consensus] The down-sample ratio of ranges (default=1, consider all the ranges)
bool rayTracing_useDistanceFilter
[rayTracing] If true (default), the rayTracing method will ignore measured ranges shorter than the si...
Some members of this struct will contain intermediate or output data after calling "computeObservatio...
std::vector< double > OWA_individualLikValues
[OWA method] This will contain the ascending-ordered list of likelihood values for individual range m...
std::vector< TPairLikelihoodIndex > OWA_pairList
[OWA method] This will contain the ascending-ordered list of pairs:(likelihood values,...
A class for storing an occupancy grid map.
virtual ~COccupancyGridMap2D()
Destructor.
void setRawCell(unsigned int cellIndex, cellType b)
Changes a cell by its absolute index (Do not use it normally)
std::vector< double > precomputedLikelihood
Auxiliary variables to speed up the computation of observation likelihood values for LF method among ...
static std::vector< float > entropyTable
Internally used to speed-up entropy calculation.
TLaserSimulUncertaintyMethod
Methods for TLaserSimulUncertaintyParams in laserScanSimulatorWithUncertainty()
void getAsPointCloud(mrpt::maps::CSimplePointsMap &pm, const float occup_threshold=0.5f) const
Get a point cloud with all (border) occupied cells as points.
float resolution
Cell size, i.e. resolution of the grid map.
double computeObservationLikelihood_MI(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose2D &takenFrom)
One of the methods that can be selected for implementing "computeObservationLikelihood".
void setCell(int x, int y, float value)
Change the contents [0,1] of a cell, given its index.
double computeLikelihoodField_II(const CPointsMap *pm, const mrpt::poses::CPose2D *relativePose=NULL)
Computes the likelihood [0,1] of a set of points, given the current grid map as reference.
int x2idx(double x) const
void buildVoronoiDiagram(float threshold, float robot_size, int x1=0, int x2=0, int y1=0, int y2=0)
Build the Voronoi diagram of the grid map.
double computeObservationLikelihood_Consensus(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose2D &takenFrom)
One of the methods that can be selected for implementing "computeObservationLikelihood" (This method ...
void subSample(int downRatio)
Performs a downsampling of the gridmap, by a given factor: resolution/=ratio.
mrpt::utils::CDynamicGrid< uint16_t > m_voronoi_diagram
Used to store the Voronoi diagram.
void setBasisCell(int x, int y, uint8_t value)
Change a cell in the "basis" maps.Used for Voronoi calculation.
bool isStaticCell(int cx, int cy, float threshold=0.7f) const
uint16_t getVoroniClearance(int cx, int cy) const
Reads a the clearance of a cell (in centimeters), after building the Voronoi diagram with buildVorono...
unsigned char GetNeighborhood(int cx, int cy) const
Returns a byte with the occupancy of the 8 sorrounding cells.
void findCriticalPoints(float filter_distance)
Builds a list with the critical points from Voronoi diagram, which must must be built before calling ...
int direction2idx(int dx, int dy)
Returns the index [0,7] of the given movement, or -1 if invalid one.
float getResolution() const
Returns the resolution of the grid map.
const mrpt::utils::CDynamicGrid< uint8_t > & getBasisMap() const
Return the auxiliary "basis" map built while building the Voronoi diagram.
void setCell_nocheck(int x, int y, float value)
Change the contents [0,1] of a cell, given its index.
TInsertionOptions insertionOptions
With this struct options are provided to the observation insertion process.
static CLogOddsGridMapLUT< cellType > m_logodd_lut
Lookup tables for log-odds.
static float l2p(const cellType l)
Scales an integer representation of the log-odd into a real valued probability in [0,...
float computePathCost(float x1, float y1, float x2, float y2) const
Compute the 'cost' of traversing a segment of the map according to the occupancy of traversed cells.
void freeMap()
Frees the dynamic memory buffers of map.
static uint8_t l2p_255(const cellType l)
Scales an integer representation of the log-odd into a linear scale [0,255], using p=exp(l)/(1+exp(l)...
static double H(double p)
Entropy computation internal function:
double computeObservationLikelihood_likelihoodField_Thrun(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose2D &takenFrom)
One of the methods that can be selected for implementing "computeObservationLikelihood".
bool precomputedLikelihoodToBeRecomputed
int y2idx(double y) const
int x2idx(float x, float x_min) const
Transform a coordinate value into a cell index, using a diferent "x_min" value.
const mrpt::utils::CDynamicGrid< uint16_t > & getVoronoiDiagram() const
Return the Voronoi diagram; each cell contains the distance to its closer obstacle,...
virtual void internal_clear() MRPT_OVERRIDE
Clear the map: It set all cells to their default occupancy value (0.5), without changing the resoluti...
static double RAYTRACE_STEP_SIZE_IN_CELL_UNITS
(Default:1.0) Can be set to <1 if a more fine raytracing is needed in sonarSimulator() and laserScanS...
float computeClearance(float x, float y, float maxSearchDistance) const
An alternative method for computing the clearance of a given location (in meters).
bool isStaticPos(float x, float y, float threshold=0.7f) const
Returns "true" if cell is "static", i.e.if its occupancy is below a given threshold.
float voroni_free_threshold
The free-cells threshold used to compute the Voronoi diagram.
float getYMin() const
Returns the "y" coordinate of top side of grid map.
TLikelihoodMethod
The type for selecting a likelihood computation method.
@ lmLikelihoodField_Thrun
void laserScanSimulator(mrpt::obs::CObservation2DRangeScan &inout_Scan, const mrpt::poses::CPose2D &robotPose, float threshold=0.6f, size_t N=361, float noiseStd=0, unsigned int decimation=1, float angleNoiseStd=mrpt::utils::DEG2RAD(0)) const
Simulates a laser range scan into the current grid map.
double internal_computeObservationLikelihood(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D &takenFrom) MRPT_OVERRIDE
Internal method called by computeObservationLikelihood()
uint16_t cellTypeUnsigned
void sonarSimulator(mrpt::obs::CObservationRange &inout_observation, const mrpt::poses::CPose2D &robotPose, float threshold=0.5f, float rangeNoiseStd=0.f, float angleNoiseStd=mrpt::utils::DEG2RAD(0.f)) const
Simulates the observations of a sonar rig into the current grid map.
float idx2y(const size_t cy) const
unsigned int getSizeX() const
Returns the horizontal size of grid map in cells count.
float getCell(int x, int y) const
Read the real valued [0,1] contents of a cell, given its index.
void computeEntropy(TEntropyInfo &info) const
Computes the entropy and related values of this grid map.
std::pair< double, mrpt::math::TPoint2D > TPairLikelihoodIndex
Auxiliary private class.
COccupancyGridMap2D(float min_x=-20.0f, float max_x=20.0f, float min_y=-20.0f, float max_y=20.0f, float resolution=0.05f)
Constructor.
bool saveAsBitmapFile(const std::string &file) const
Saves the gridmap as a graphical file (BMP,PNG,...).
static bool saveAsEMFTwoMapsWithCorrespondences(const std::string &fileName, const COccupancyGridMap2D *m1, const COccupancyGridMap2D *m2, const mrpt::utils::TMatchingPairList &corrs)
Saves a composite image with two gridmaps and numbers for the correspondences between them.
cellType * getRow(int cy)
Access to a "row": mainly used for drawing grid as a bitmap efficiently, do not use it normally.
double computeObservationLikelihood_CellsDifference(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose2D &takenFrom)
One of the methods that can be selected for implementing "computeObservationLikelihood"
int x2idx(float x) const
Transform a coordinate value into a cell index.
bool m_is_empty
True upon construction; used by isEmpty()
static bool saveAsBitmapTwoMapsWithCorrespondences(const std::string &fileName, const COccupancyGridMap2D *m1, const COccupancyGridMap2D *m2, const mrpt::utils::TMatchingPairList &corrs)
Saves a composite image with two gridmaps and lines representing a set of correspondences between the...
void updateCell(int x, int y, float v)
Performs the Bayesian fusion of a new observation of a cell.
int y2idx(float y, float y_min) const
float getXMax() const
Returns the "x" coordinate of right side of grid map.
float getYMax() const
Returns the "y" coordinate of bottom side of grid map.
bool saveAsBitmapFileWithLandmarks(const std::string &file, const CLANDMARKSMAP *landmarks, bool addTextLabels=false, const mrpt::utils::TColor &marks_color=mrpt::utils::TColor(0, 0, 255)) const
Saves the gridmap as a graphical bitmap file, 8 bit gray scale, 1 pixel is 1 cell,...
void getAsImageFiltered(utils::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 ...
const cellType * getRow(int cy) const
Access to a "row": mainly used for drawing grid as a bitmap efficiently, do not use it normally.
std::vector< cellType > map
Store of cell occupancy values. Order: row by row, from left to right.
double computeObservationLikelihood_rayTracing(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose2D &takenFrom)
One of the methods that can be selected for implementing "computeObservationLikelihood".
unsigned char getBasisCell(int x, int y) const
Reads a cell in the "basis" maps.Used for Voronoi calculation.
float getPos(float x, float y) const
Read the real valued [0,1] contents of a cell, given its coordinates.
void setVoroniClearance(int cx, int cy, uint16_t dist)
Used to set the clearance of a cell, while building the Voronoi diagram.
double computeObservationLikelihood_ConsensusOWA(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose2D &takenFrom)
One of the methods that can be selected for implementing "computeObservationLikelihood".
void resizeGrid(float new_x_min, float new_x_max, float new_y_min, float new_y_max, float new_cells_default_value=0.5f, bool additionalMargin=true) MRPT_NO_THROWS
Change the size of gridmap, maintaining previous contents.
bool isEmpty() const MRPT_OVERRIDE
Returns true upon map construction or after calling clear(), the return changes to false upon success...
void fill(float default_value=0.5f)
Fills all the cells with a default value.
double computeObservationLikelihood_likelihoodField_II(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose2D &takenFrom)
One of the methods that can be selected for implementing "computeObservationLikelihood".
unsigned int getSizeY() const
Returns the vertical size of grid map in cells count.
float getXMin() const
Returns the "x" coordinate of left side of grid map.
float idx2x(const size_t cx) const
Transform a cell index into a coordinate value.
void getAs3DObject(mrpt::opengl::CSetOfObjectsPtr &outObj) const MRPT_OVERRIDE
Returns a 3D plane with its texture being the occupancy grid and transparency proportional to "uncert...
static cellType p2l(const float p)
Scales a real valued probability in [0,1] to an integer representation of: log(p)-log(1-p) in the val...
void copyMapContentFrom(const COccupancyGridMap2D &otherMap)
copy the gridmap contents, but not all the options, from another map instance
void setPos(float x, float y, float value)
Change the contents [0,1] of a cell, given its coordinates.
float getCell_nocheck(int x, int y) const
Read the real valued [0,1] contents of a cell, given its index.
int16_t cellType
The type of the map cells:
void setSize(float x_min, float x_max, float y_min, float y_max, float resolution, float default_value=0.5f)
Change the size of gridmap, erasing all its previous contents.
virtual void OnPostSuccesfulInsertObs(const mrpt::obs::CObservation *) MRPT_OVERRIDE
See base class.
void simulateScanRay(const double x, const double y, const double angle_direction, float &out_range, bool &out_valid, const double max_range_meters, const float threshold_free=0.4f, const double noiseStd=.0, const double angleNoiseStd=.0) const
Simulate just one "ray" in the grid map.
int computeClearance(int cx, int cy, int *basis_x, int *basis_y, int *nBasis, bool GetContourPoint=false) const
Compute the clearance of a given cell, and returns its two first basis (closest obstacle) points....
bool internal_canComputeObservationLikelihood(const mrpt::obs::CObservation *obs) MRPT_OVERRIDE
Internal method called by canComputeObservationLikelihood()
void getAsImage(utils::CImage &img, bool verticalFlip=false, bool forceRGB=false, bool tricolor=false) const
Returns the grid as a 8-bit graylevel image, where each pixel is a cell (output image is RGB only if ...
mrpt::utils::CDynamicGrid< uint8_t > m_basis_map
Used for Voronoi calculation.Same struct as "map", but contains a "0" if not a basis point.
double computeLikelihoodField_Thrun(const CPointsMap *pm, const mrpt::poses::CPose2D *relativePose=NULL)
Computes the likelihood [0,1] of a set of points, given the current grid map as reference.
void laserScanSimulatorWithUncertainty(const TLaserSimulUncertaintyParams &in_params, TLaserSimulUncertaintyResult &out_results) const
Like laserScanSimulatorWithUncertainty() (see it for a discussion of most parameters) but taking into...
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors.
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans.
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
A 2D range scan plus an uncertainty model for each range.
Declares a class that represents any robot's observation.
Declares a class derived from "CObservation" that encapsules a single range measurement,...
A class used to store a 2D pose.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Declares a class that represents a Probability Density function (PDF) of a 2D pose .
virtual void textOut(int x0, int y0, const std::string &str, const mrpt::utils::TColor color)
Renders 2D text using bitmap fonts.
void rectangle(int x0, int y0, int x1, int y1, const mrpt::utils::TColor color, unsigned int width=1)
Draws a rectangle (an empty rectangle, without filling)
This class allows loading and storing values and vectors of different types from a configuration text...
A 2D grid of dynamic size which stores any kind of data at each cell.
size_t getSizeX() const
Returns the horizontal size of grid map in cells count.
T * cellByIndex(unsigned int cx, unsigned int cy)
Returns a pointer to the contents of a cell given by its cell indexes, or NULL if it is out of the ma...
size_t getSizeY() const
Returns the vertical size of grid map in cells count.
A class for storing images as grayscale or RGB bitmaps.
bool isOriginTopLeft() const
Returns true if the coordinates origin is top-left, or false if it is bottom-left
bool saveToFile(const std::string &fileName, int jpeg_quality=95) const
Save the image to a file, whose format is determined from the extension (internally uses OpenCV).
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
#define ASSERT_BELOWEQ_(__A, __B)
#define ASSERT_ABOVEEQ_(__A, __B)
#define MRPT_NO_THROWS
Used after member declarations.
struct OPENGL_IMPEXP CSetOfObjectsPtr
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values,...
double DEG2RAD(const double x)
Degrees to radians.
T square(const T x)
Inline function for the square of a number.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
A generic provider of log-odds grid-map maintainance functions.
One static instance of this struct should exist in any class implementing CLogOddsGridMap2D to hold t...
uint8_t l2p_255(const cell_t l)
Scales an integer representation of the log-odd into a linear scale [0,255], using p=exp(l)/(1+exp(l)...
float l2p(const cell_t l)
Scales an integer representation of the log-odd into a real valued probability in [0,...
cell_t p2l(const float p)
Scales a real valued probability in [0,1] to an integer representation of: log(p)-log(1-p) in the val...
The structure used to store the set of Voronoi diagram critical points.
std::vector< int > clearance
The clearance of critical points, in 1/100 of cells.
std::vector< int > x_basis1
Used for returning entropy related information.
double I
The target variable for absolute "information", defining I(x) = 1 - H(x)
double H
The target variable for absolute entropy, computed as:
double effectiveMappedArea
The target variable for the area of cells with information, i.e. p(x)!=0.5.
double mean_H
The target variable for mean entropy, defined as entropy per cell: mean_H(map) = H(map) / (cells)
unsigned long effectiveMappedCells
The mapped area in cells.
double mean_I
The target variable for mean information, defined as information per cell: mean_I(map) = I(map) / (ce...
Input params for laserScanSimulatorWithUncertainty()
unsigned int decimation
(Default: 1) The rays that will be simulated are at indexes: 0, D, 2D, 3D,...
mrpt::poses::CPosePDFGaussian robotPose
The robot pose Gaussian, in map coordinates. Recall that sensor pose relative to this robot pose must...
float aperture
(Default: M_PI) The "aperture" or field-of-view of the range finder, in radians (typically M_PI = 180...
float threshold
(Default: 0.6f) The minimum occupancy threshold to consider a cell to be occupied
float rangeNoiseStd
(Default: 0) The standard deviation of measurement noise. If not desired, set to 0
float angleNoiseStd
(Default: 0) The sigma of an optional Gaussian noise added to the angles at which ranges are measured...
bool rightToLeft
(Default: true) The scanning direction: true=counterclockwise; false=clockwise
TLaserSimulUncertaintyMethod method
(Default: sumMonteCarlo) Select the method to do the uncertainty propagation
mrpt::poses::CPose3D sensorPose
(Default: at origin) The 6D pose of the sensor on the robot at the moment of starting the scan.
size_t MC_samples
[sumMonteCarlo] MonteCarlo parameter: number of samples (Default: 10)
TLaserSimulUncertaintyParams()
float maxRange
(Default: 80) The maximum range allowed by the device, in meters (e.g. 80m, 50m,.....
Output params for laserScanSimulatorWithUncertainty()
mrpt::obs::CObservation2DRangeScanWithUncertainty scanWithUncert
The scan + its uncertainty.
TLaserSimulUncertaintyResult()
An internal structure for storing data related to counting the new information apported by some obser...
bool enabled
If set to false (default), this struct is not used. Set to true only when measuring the info of an ob...
int cellsUpdated
The cummulative updated cells count: This is updated only from the "updateCell" method.
TUpdateCellsInfoChangeOnly(bool enabled=false, double I_change=0, int cellsUpdated=0)
int laserRaysSkip
In this mode, some laser rays can be skips to speep-up.
double I_change
The cummulative change in Information: This is updated only from the "updateCell" method.
Parameters for the determination of matchings between point clouds, etc.
Parameters for CMetricMap::compute3DMatchingRatio()