Main MRPT website > C++ reference
MRPT logo
Public Member Functions | Protected Member Functions

mrpt::slam::CSimplePointsMap Class Reference


Detailed Description

A cloud of points in 2D or 3D, which can be built from a sequence of laser scans.

This class stores the coordinates (x,y,z) and a "weight", or counter of how many times that point has been seen, used only if points fusion is enabled in the options structure.

See also:
CMetricMap, CPoint, mrpt::utils::CSerializable

Definition at line 50 of file CSimplePointsMap.h.

#include <mrpt/slam/CSimplePointsMap.h>

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

List of all members.

Public Member Functions

virtual ~CSimplePointsMap ()
 Destructor.
 CSimplePointsMap ()
 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 cartesian coordinated points.
void loadFromRangeScan (const CObservation3DRangeScan &rangeScan, const CPose3D *robotPose=NULL)
 Enter the set of cartesian coordinated points from the 3D range scan into the map.
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.
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.
void insertAnotherMap (CPointsMap *otherMap, const CPose2D &otherPose)
 Insert the contents of another map into this one, without fusing close points.
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 (const mrpt::math::TPoint3D &new_pnt)
 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 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.
template<typename VECTOR >
void setAllPointsTemplate (const VECTOR &X, const VECTOR &Y, const VECTOR &Z=VECTOR())
 Set all the points at once from vectors with X,Y and Z coordinates (if Z is not provided, it will be set to all zeros).
virtual void setAllPoints (const std::vector< float > &X, const std::vector< float > &Y, const std::vector< float > &Z)
 Set all the points at once from vectors with X,Y and Z coordinates.
virtual void setAllPoints (const std::vector< float > &X, const std::vector< float > &Y)
 Set all the points at once from vectors with X and Y coordinates (Z=0).
virtual const CSimplePointsMapgetAsSimplePointsMap () const
 If the map is a simple points map or it's a multi-metric map that contains EXACTLY one simple points map, return it.
virtual CSimplePointsMapgetAsSimplePointsMap ()

Protected Member Functions

virtual void internal_clear ()
 Clear the map, erasing all the points.
bool internal_insertObservation (const CObservation *obs, const CPose3D *robotPose=NULL)
 Insert the observation information into this map.

RTTI stuff

typedef CSimplePointsMapPtr SmartPtr
static mrpt::utils::CLASSINIT _init_CSimplePointsMap
static mrpt::utils::TRuntimeClassId classCSimplePointsMap
static const
mrpt::utils::TRuntimeClassId
classinfo
static const
mrpt::utils::TRuntimeClassId
_GetBaseClass ()
virtual const
mrpt::utils::TRuntimeClassId
GetRuntimeClass () const
 Returns information about the class of an object in runtime.
virtual mrpt::utils::CObjectduplicate () const
 Returns a copy of the object, indepently of its class.
static mrpt::utils::CObjectCreateObject ()
static CSimplePointsMapPtr Create ()

Member Typedef Documentation

A typedef for the associated smart pointer

Definition at line 53 of file CSimplePointsMap.h.


Constructor & Destructor Documentation

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

Destructor.

mrpt::slam::CSimplePointsMap::CSimplePointsMap (  )

Default constructor.


Member Function Documentation

static const mrpt::utils::TRuntimeClassId* mrpt::slam::CSimplePointsMap::_GetBaseClass (  ) [static, protected]

Reimplemented from mrpt::slam::CPointsMap.

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

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

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

Implements mrpt::slam::CPointsMap.

void mrpt::slam::CSimplePointsMap::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::CSimplePointsMap::copyFrom ( const CPointsMap obj ) [virtual]

Copy operator.

Implements mrpt::slam::CPointsMap.

static CSimplePointsMapPtr mrpt::slam::CSimplePointsMap::Create (  ) [static]
static mrpt::utils::CObject* mrpt::slam::CSimplePointsMap::CreateObject (  ) [static]
virtual mrpt::utils::CObject* mrpt::slam::CSimplePointsMap::duplicate (  ) const [virtual]

Returns a copy of the object, indepently of its class.

Implements mrpt::utils::CObject.

void mrpt::slam::CSimplePointsMap::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:
otherMapThe other map whose points are to be inserted into this one.
minDistForFuseMinimum distance (in meters) between two points, each one in a map, to be considered the same one and be fused rather than added.
notFusedPointsIf 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 const CSimplePointsMap* mrpt::slam::CSimplePointsMap::getAsSimplePointsMap (  ) const [inline, virtual]

If the map is a simple points map or it's a multi-metric map that contains EXACTLY one simple points map, return it.

Otherwise, return NULL

Reimplemented from mrpt::slam::CMetricMap.

Definition at line 207 of file CSimplePointsMap.h.

virtual CSimplePointsMap* mrpt::slam::CSimplePointsMap::getAsSimplePointsMap (  ) [inline, virtual]

Reimplemented from mrpt::slam::CMetricMap.

Definition at line 208 of file CSimplePointsMap.h.

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

Returns information about the class of an object in runtime.

Reimplemented from mrpt::slam::CPointsMap.

void mrpt::slam::CSimplePointsMap::insertAnotherMap ( CPointsMap otherMap,
const CPose2D otherPose 
)

Insert the contents of another map into this one, without fusing close points.

Parameters:
otherMapThe other map whose points are to be inserted into this one.
otherPoseThe pose of the other map in the coordinates of THIS map
See also:
fuseWith
void mrpt::slam::CSimplePointsMap::insertPoint ( float  x,
float  y,
float  z = 0 
) [virtual]

Provides a way to insert individual points into the map:

Implements mrpt::slam::CPointsMap.

void mrpt::slam::CSimplePointsMap::insertPoint ( const mrpt::math::TPoint3D new_pnt ) [inline]

Provides a way to insert individual points into the map:

Reimplemented from mrpt::slam::CPointsMap.

Definition at line 154 of file CSimplePointsMap.h.

virtual void mrpt::slam::CSimplePointsMap::internal_clear (  ) [protected, virtual]

Clear the map, erasing all the points.

Implements mrpt::slam::CMetricMap.

bool mrpt::slam::CSimplePointsMap::internal_insertObservation ( const CObservation obs,
const CPose3D robotPose = NULL 
) [protected, virtual]

Insert the observation information into this map.

This method must be implemented in derived classes.

Parameters:
obsThe observation
robotPoseThe 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.

bool mrpt::slam::CSimplePointsMap::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::CSimplePointsMap::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::CSimplePointsMap::loadFromRangeScan ( const CObservation3DRangeScan rangeScan,
const CPose3D robotPose = NULL 
)

Enter the set of cartesian coordinated points from the 3D range scan into the map.

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

Parameters:
rangeScanThe 3D scan to be inserted into this map
robotPoseThe 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:
CObservation3DRangeScan
void mrpt::slam::CSimplePointsMap::loadFromRangeScan ( const CObservation2DRangeScan rangeScan,
const CPose3D robotPose = NULL 
) [virtual]

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

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

Parameters:
rangeScanThe scan to be inserted into this map
robotPoseThe 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::CSimplePointsMap::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.

virtual void mrpt::slam::CSimplePointsMap::setAllPoints ( const std::vector< float > &  X,
const std::vector< float > &  Y,
const std::vector< float > &  Z 
) [inline, virtual]

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

See also:
getAllPoints

Implements mrpt::slam::CPointsMap.

Definition at line 193 of file CSimplePointsMap.h.

virtual void mrpt::slam::CSimplePointsMap::setAllPoints ( const std::vector< float > &  X,
const std::vector< float > &  Y 
) [inline, virtual]

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

See also:
getAllPoints

Implements mrpt::slam::CPointsMap.

Definition at line 199 of file CSimplePointsMap.h.

template<typename VECTOR >
void mrpt::slam::CSimplePointsMap::setAllPointsTemplate ( const VECTOR &  X,
const VECTOR &  Y,
const VECTOR &  Z = VECTOR() 
) [inline]

Set all the points at once from vectors with X,Y and Z coordinates (if Z is not provided, it will be set to all zeros).

Template Parameters:
VECTORcan be mrpt::vector_float or std::vector<float> or any other column or row Eigen::Matrix.

Definition at line 179 of file CSimplePointsMap.h.

References ASSERT_, ASSERT_EQUAL_, and internal::y.

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

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

First index is 0.

Exceptions:
Throwsstd::exception on index out of bound.

Implements mrpt::slam::CPointsMap.

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

Changes a given point from map.

First index is 0.

Exceptions:
Throwsstd::exception on index out of bound.

Implements mrpt::slam::CPointsMap.

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

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

First index is 0.

Exceptions:
Throwsstd::exception on index out of bound.

Implements mrpt::slam::CPointsMap.

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

Changes a given point from map.

First index is 0.

Exceptions:
Throwsstd::exception on index out of bound.

Implements mrpt::slam::CPointsMap.


Member Data Documentation

Definition at line 53 of file CSimplePointsMap.h.

Definition at line 53 of file CSimplePointsMap.h.

Definition at line 53 of file CSimplePointsMap.h.




Page generated by Doxygen 1.7.2 for MRPT 0.9.4 SVN: at Mon Jan 10 22:46:17 UTC 2011