MRPT logo

mrpt::slam::CColouredPointsMap Class Reference

A map of 2D/3D points with individual colours (RGB). More...

#include <mrpt/slam/CColouredPointsMap.h>

Inheritance diagram for mrpt::slam::CColouredPointsMap:

mrpt::slam::CPointsMap mrpt::slam::CMetricMap mrpt::utils::CSerializable

List of all members.

Classes

struct  TColourOptions
 The definition of parameters for generating colors from laser scans. More...

Public Types

enum  TColouringMethod { cmFromHeightRelativeToSensor = 0 }
 The choices for coloring schemes:
  • cmFromHeightRelativeToSensor: The Z coordinate wrt the sensor will be used to obtain the color using the limits z_min,z_max.
More...

Public Member Functions

virtual ~CColouredPointsMap ()
 Destructor.
 CColouredPointsMap ()
 Default constructor.
void copyFrom (const CPointsMap &obj)
 Copy operator.
void loadFromRangeScan (const CObservation2DRangeScan &rangeScan, const CPose3D *robotPose=NULL)
 Transform the range scan into a set of cartessian coordinated points.
bool load2D_from_text_file (std::string file)
 Load from a text file.
bool load3D_from_text_file (std::string file)
 Load from a text file.
bool save3D_and_colour_to_text_file (const std::string &file) const
 Save to a text file.
void clear ()
 Clear the map, erasing all the points.
void fuseWith (CPointsMap *otherMap, float minDistForFuse=0.02f, std::vector< bool > *notFusedPoints=NULL)
 Insert the contents of another map into this one, fusing the previous content with the new one.
virtual void setPoint (size_t index, CPoint2D &p)
 Changes a given point from map, as a 2D point.
virtual void setPoint (size_t index, CPoint3D &p)
 Changes a given point from map, as a 3D point.
virtual void setPoint (size_t index, float x, float y)
 Changes a given point from map.
virtual void setPoint (size_t index, float x, float y, float z)
 Changes a given point from map.
void insertPoint (float x, float y, float z=0)
 Provides a way to insert individual points into the map:.
void insertPoint (CPoint3D p)
 Provides a way to insert individual points into the map:.
void applyDeletionMask (std::vector< bool > &mask)
 Remove from the map the points marked in a bool's array as "true".
void insertPoint (float x, float y, float z, float R, float G, float B)
 Adds a new point given its coordinates and color.
void getPoint (size_t index, float &x, float &y, float &z, float &R, float &G, float &B) const
 Retrieves a point and its color.
bool insertObservation (const CObservation *obs, const CPose3D *robotPose=NULL)
 Insert the observation information into this map.
double computeObservationLikelihood (const CObservation *obs, const CPose3D &takenFrom)
 Computes the likelihood that a given observation was taken from a given pose in the world being modeled with this map.
void auxParticleFilterCleanUp ()
 This method is called at the end of each "prediction-update-map insertion" cycle within "mrpt::slam::CMetricMapBuilderRBPF::processActionObservation".
void reserve (size_t newLength)
 Reserves memory for a given number of points: the size of the map does not change, it only reserves the memory.
void setAllPoints (const vector_float &X, const vector_float &Y, const vector_float &Z)
 Set all the points at once from vectors with X,Y and Z coordinates.
void setAllPoints (const vector_float &X, const vector_float &Y)
 Set all the points at once from vectors with X and Y coordinates (Z=0).
virtual void getAs3DObject (mrpt::opengl::CSetOfObjectsPtr &outObj) const
 Override of the default 3D scene builder to account for the individual points' color.
bool colourFromObservation (const CObservationImage &obs, const CPose3D &robotPose)
 Colour a set of points from a CObservationImage and the global pose of the robot.
void resetPointsMinDist (float defValue=2000.0f)
 Reset the minimum-observed-distance buffer for all the points to a predefined value.

Public Attributes

TColourOptions colorScheme
 The options employed when inserting laser scans in the map.

Protected Attributes

vector_float m_color_R
 The color data.
vector_float m_color_G
vector_float m_color_B
vector_float m_min_dist
 Minimum distance from where the points have been seen.


Detailed Description

A map of 2D/3D points with individual colours (RGB).

For different color schemes, see CColouredPointsMap::colorScheme Colors are defined in the range [0,1].

See also:
mrpt::slam::CPointsMap, mrpt::slam::CMetricMap, mrpt::utils::CSerializable

Definition at line 50 of file CColouredPointsMap.h.


Member Enumeration Documentation

The choices for coloring schemes:

  • cmFromHeightRelativeToSensor: The Z coordinate wrt the sensor will be used to obtain the color using the limits z_min,z_max.

See also:
TColourOptions
Enumerator:
cmFromHeightRelativeToSensor 

Definition at line 215 of file CColouredPointsMap.h.


Constructor & Destructor Documentation

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

Destructor.

mrpt::slam::CColouredPointsMap::CColouredPointsMap (  ) 

Default constructor.


Member Function Documentation

void mrpt::slam::CColouredPointsMap::applyDeletionMask ( std::vector< bool > &  mask  )  [virtual]

Remove from the map the points marked in a bool's array as "true".

Exceptions:
std::exception If mask size is not equal to points count.

Implements mrpt::slam::CPointsMap.

void mrpt::slam::CColouredPointsMap::auxParticleFilterCleanUp (  )  [virtual]

This method is called at the end of each "prediction-update-map insertion" cycle within "mrpt::slam::CMetricMapBuilderRBPF::processActionObservation".

This method should normally do nothing, but in some cases can be used to free auxiliary cached variables.

Implements mrpt::slam::CMetricMap.

void mrpt::slam::CColouredPointsMap::clear (  )  [virtual]

Clear the map, erasing all the points.

Implements mrpt::slam::CPointsMap.

bool mrpt::slam::CColouredPointsMap::colourFromObservation ( const CObservationImage obs,
const CPose3D robotPose 
)

Colour a set of points from a CObservationImage and the global pose of the robot.

double mrpt::slam::CColouredPointsMap::computeObservationLikelihood ( const CObservation obs,
const CPose3D takenFrom 
) [virtual]

Computes the likelihood that a given observation was taken from a given pose in the world being modeled with this map.

The implementation in this class checks if the points map has an associated gridmap, i.e. I am into a CHibridMetricMap. If this is so, it always return 1.0 therefore the gridmap can return a more appropiate value. If this map is a standalone metric map, it returns the points-matching ratio as the likelihood, using 1.5 times the parameter "minDistBetweenLaserPoints" (from "CPointsMap::insertionOptions") as the matching distance threshold.

Parameters:
takenFrom The robot's pose the observation is supposed to be taken from.
obs The observation.
Returns:
This method returns a likelihood in the range [0,1].
See also:
Used in particle filter algorithms, see: CMultiMetricMapPDF::update

Implements mrpt::slam::CMetricMap.

void mrpt::slam::CColouredPointsMap::copyFrom ( const CPointsMap obj  )  [virtual]

Copy operator.

Implements mrpt::slam::CPointsMap.

void mrpt::slam::CColouredPointsMap::fuseWith ( CPointsMap otherMap,
float  minDistForFuse = 0.02f,
std::vector< bool > *  notFusedPoints = NULL 
) [virtual]

Insert the contents of another map into this one, fusing the previous content with the new one.

This means that points very close to existing ones will be "fused", rather than "added". This prevents the unbounded increase in size of these class of maps. NOTICE that "otherMap" is neither translated nor rotated here, so if this is desired it must done before calling this method.

Parameters:
otherMap The other map whose points are to be inserted into this one.
minDistForFuse Minimum distance (in meters) between two points, each one in a map, to be considered the same one and be fused rather than added.
notFusedPoints If a pointer is supplied, this list will contain at output a list with a "bool" value per point in "this" map. This will be false/true according to that point having been fused or not.
See also:
insertAnotherMap

Implements mrpt::slam::CPointsMap.

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

Override of the default 3D scene builder to account for the individual points' color.

Reimplemented from mrpt::slam::CPointsMap.

void mrpt::slam::CColouredPointsMap::getPoint ( size_t  index,
float &  x,
float &  y,
float &  z,
float &  R,
float &  G,
float &  B 
) const

Retrieves a point and its color.

bool mrpt::slam::CColouredPointsMap::insertObservation ( const CObservation obs,
const CPose3D robotPose = NULL 
) [virtual]

Insert the observation information into this map.

This method must be implemented in derived classes.

Parameters:
obs The observation
robotPose The 3D pose of the robot mobile base in the map reference system, or NULL (default) if you want to use CPose2D(0,0,deg)
See also:
CObservation::insertObservationInto

Implements mrpt::slam::CMetricMap.

void mrpt::slam::CColouredPointsMap::insertPoint ( float  x,
float  y,
float  z,
float  R,
float  G,
float  B 
)

Adds a new point given its coordinates and color.

void mrpt::slam::CColouredPointsMap::insertPoint ( CPoint3D  p  ) 

Provides a way to insert individual points into the map:.

void mrpt::slam::CColouredPointsMap::insertPoint ( float  x,
float  y,
float  z = 0 
) [virtual]

Provides a way to insert individual points into the map:.

Implements mrpt::slam::CPointsMap.

bool mrpt::slam::CColouredPointsMap::load2D_from_text_file ( std::string  file  )  [virtual]

Load from a text file.

In each line there are a point coordinates. Returns false if any error occured, true elsewere.

Implements mrpt::slam::CPointsMap.

bool mrpt::slam::CColouredPointsMap::load3D_from_text_file ( std::string  file  )  [virtual]

Load from a text file.

In each line there are a point coordinates. Returns false if any error occured, true elsewere.

Implements mrpt::slam::CPointsMap.

void mrpt::slam::CColouredPointsMap::loadFromRangeScan ( const CObservation2DRangeScan rangeScan,
const CPose3D robotPose = NULL 
) [virtual]

Transform the range scan into a set of cartessian coordinated points.

The options in "insertionOptions" are considered in this method.

Parameters:
rangeScan The scan to be inserted into this map
robotPose The robot 3D pose, default to (0,0,0|0deg,0deg,0deg). It is used to compute the sensor pose relative to the robot actual pose. Recall sensor pose is embeded in the observation class.
Note:
Only ranges marked as "valid=true" in the observation will be inserted
See also:
CObservation2DRangeScan

Implements mrpt::slam::CPointsMap.

void mrpt::slam::CColouredPointsMap::reserve ( size_t  newLength  )  [virtual]

Reserves memory for a given number of points: the size of the map does not change, it only reserves the memory.

This is useful for situations where it is approximately known the final size of the map. This method is more efficient than constantly increasing the size of the buffers. Refer to the STL C++ library's "reserve" methods.

Implements mrpt::slam::CPointsMap.

void mrpt::slam::CColouredPointsMap::resetPointsMinDist ( float  defValue = 2000.0f  ) 

Reset the minimum-observed-distance buffer for all the points to a predefined value.

bool mrpt::slam::CColouredPointsMap::save3D_and_colour_to_text_file ( const std::string &  file  )  const

Save to a text file.

In each line contains X Y Z (meters) R G B (range [0,1]) for each point in the map. Returns false if any error occured, true elsewere.

void mrpt::slam::CColouredPointsMap::setAllPoints ( const vector_float X,
const vector_float Y 
) [virtual]

Set all the points at once from vectors with X and Y coordinates (Z=0).

Implements mrpt::slam::CPointsMap.

void mrpt::slam::CColouredPointsMap::setAllPoints ( const vector_float X,
const vector_float Y,
const vector_float Z 
) [virtual]

Set all the points at once from vectors with X,Y and Z coordinates.

Implements mrpt::slam::CPointsMap.

virtual void mrpt::slam::CColouredPointsMap::setPoint ( size_t  index,
float  x,
float  y,
float  z 
) [virtual]

Changes a given point from map.

First index is 0.

Exceptions:
Throws std::exception on index out of bound.

Implements mrpt::slam::CPointsMap.

virtual void mrpt::slam::CColouredPointsMap::setPoint ( size_t  index,
float  x,
float  y 
) [virtual]

Changes a given point from map.

First index is 0.

Exceptions:
Throws std::exception on index out of bound.

Implements mrpt::slam::CPointsMap.

virtual void mrpt::slam::CColouredPointsMap::setPoint ( size_t  index,
CPoint3D p 
) [virtual]

Changes a given point from map, as a 3D point.

First index is 0.

Exceptions:
Throws std::exception on index out of bound.

Implements mrpt::slam::CPointsMap.

virtual void mrpt::slam::CColouredPointsMap::setPoint ( size_t  index,
CPoint2D p 
) [virtual]

Changes a given point from map, as a 2D point.

First index is 0.

Exceptions:
Throws std::exception on index out of bound.

Implements mrpt::slam::CPointsMap.


Member Data Documentation

The options employed when inserting laser scans in the map.

Definition at line 241 of file CColouredPointsMap.h.

Definition at line 57 of file CColouredPointsMap.h.

Definition at line 57 of file CColouredPointsMap.h.

The color data.

Definition at line 57 of file CColouredPointsMap.h.

Minimum distance from where the points have been seen.

Definition at line 60 of file CColouredPointsMap.h.




Page generated by Doxygen 1.5.7.1 for MRPT 0.7.1 SVN: at Mon Aug 17 23:02:22 EDT 2009