Main MRPT website > C++ reference for MRPT 1.9.9
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
mrpt::maps::COctoMap Class Reference

Detailed Description

A three-dimensional probabilistic occupancy grid, implemented as an octo-tree with the "octomap" C++ library.

This version only stores occupancy information at each octree node. See the base class mrpt::maps::COctoMapBase.

See also
CMetricMap, the example in "MRPT/samples/octomap_simple"

Definition at line 33 of file COctoMap.h.

#include <mrpt/maps/COctoMap.h>

Inheritance diagram for mrpt::maps::COctoMap:
Inheritance graph

Classes

struct  TMapDefinition
 
struct  TMapDefinitionBase
 

Public Types

typedef COctoMapBase< octomap::OcTree, octomap::OcTreeNode > myself_t
 The type of this MRPT class. More...
 
typedef octomap::OcTree octree_t
 The type of the octree class in the "octomap" library. More...
 
typedef octomap::OcTreeNode octree_node_t
 The type of nodes in the octree, in the "octomap" library. More...
 

Public Member Functions

voidoperator new (size_t size)
 
voidoperator new[] (size_t size)
 
void operator delete (void *ptr) noexcept
 
void operator delete[] (void *ptr) noexcept
 
void operator delete (void *memory, void *ptr) noexcept
 
voidoperator new (size_t size, const std::nothrow_t &) noexcept
 
void operator delete (void *ptr, const std::nothrow_t &) noexcept
 
 COctoMap (const double resolution=0.10)
 Default constructor. More...
 
virtual ~COctoMap ()
 Destructor. More...
 
virtual void getAsOctoMapVoxels (mrpt::opengl::COctoMapVoxels &gl_obj) const override
 Builds a renderizable representation of the octomap as a mrpt::opengl::COctoMapVoxels object. More...
 
octomap::OcTree & getOctomap ()
 Get a reference to the internal octomap object. More...
 
virtual bool isEmpty () const override
 Returns true if the map is empty/no observation has been inserted. More...
 
virtual void saveMetricMapRepresentationToFile (const std::string &filNamePrefix) const override
 This virtual method saves the map to a file "filNamePrefix"+< some_file_extension >, as an image or in any other applicable way (Notice that other methods to save the map may be implemented in classes implementing this virtual interface). More...
 
virtual void getAs3DObject (mrpt::opengl::CSetOfObjects::Ptr &outObj) const override
 Returns a 3D object representing the map. More...
 
bool isPointWithinOctoMap (const float x, const float y, const float z) const
 Check whether the given point lies within the volume covered by the octomap (that is, whether it is "mapped") More...
 
bool getPointOccupancy (const float x, const float y, const float z, double &prob_occupancy) const
 Get the occupancy probability [0,1] of a point. More...
 
void updateVoxel (const double x, const double y, const double z, bool occupied)
 Manually updates the occupancy of the voxel at (x,y,z) as being occupied (true) or free (false), using the log-odds parameters in insertionOptions. More...
 
void insertPointCloud (const CPointsMap &ptMap, const float sensor_x, const float sensor_y, const float sensor_z)
 Update the octomap with a 2D or 3D scan, given directly as a point cloud and the 3D location of the sensor (the origin of the rays) in this map's frame of reference. More...
 
void insertRay (const float end_x, const float end_y, const float end_z, const float sensor_x, const float sensor_y, const float sensor_z)
 Just like insertPointCloud but with a single ray. More...
 
bool castRay (const mrpt::math::TPoint3D &origin, const mrpt::math::TPoint3D &direction, mrpt::math::TPoint3D &end, bool ignoreUnknownCells=false, double maxRange=-1.0) const
 Performs raycasting in 3d, similar to computeRay(). More...
 
void clear ()
 Erase all the contents of the map. More...
 
void loadFromProbabilisticPosesAndObservations (const mrpt::maps::CSimpleMap &Map)
 Load the map contents from a CSimpleMap object, erasing all previous content of the map. More...
 
void loadFromSimpleMap (const mrpt::maps::CSimpleMap &Map)
 ! More...
 
bool insertObservation (const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D *robotPose=NULL)
 Insert the observation information into this map. More...
 
bool insertObservationPtr (const mrpt::obs::CObservation::Ptr &obs, const mrpt::poses::CPose3D *robotPose=NULL)
 A wrapper for smart pointers, just calls the non-smart pointer version. More...
 
double computeObservationLikelihood (const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D &takenFrom)
 Computes the log-likelihood of a given observation given an arbitrary robot 3D pose. More...
 
double computeObservationLikelihood (const mrpt::obs::CObservation *obs, const mrpt::poses::CPose2D &takenFrom)
 
virtual bool canComputeObservationLikelihood (const mrpt::obs::CObservation *obs) const
 Returns true if this map is able to compute a sensible likelihood function for this observation (i.e. More...
 
bool canComputeObservationLikelihood (const mrpt::obs::CObservation::Ptr &obs) const
 
double computeObservationsLikelihood (const mrpt::obs::CSensoryFrame &sf, const mrpt::poses::CPose2D &takenFrom)
 Returns the sum of the log-likelihoods of each individual observation within a mrpt::obs::CSensoryFrame. More...
 
bool canComputeObservationsLikelihood (const mrpt::obs::CSensoryFrame &sf) const
 Returns true if this map is able to compute a sensible likelihood function for this observation (i.e. More...
 
virtual void determineMatching2D (const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose2D &otherMapPose, mrpt::utils::TMatchingPairList &correspondences, const TMatchingParams &params, TMatchingExtraResults &extraResults) const
 Computes the matching between this and another 2D point map, which includes finding: More...
 
virtual void determineMatching3D (const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose3D &otherMapPose, mrpt::utils::TMatchingPairList &correspondences, const TMatchingParams &params, TMatchingExtraResults &extraResults) const
 Computes the matchings between this and another 3D points map - method used in 3D-ICP. More...
 
virtual float compute3DMatchingRatio (const mrpt::maps::CMetricMap *otherMap, const mrpt::poses::CPose3D &otherMapPose, const TMatchingRatioParams &params) 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. More...
 
virtual void auxParticleFilterCleanUp ()
 This method is called at the end of each "prediction-update-map insertion" cycle within "mrpt::slam::CMetricMapBuilderRBPF::processActionObservation". More...
 
virtual float squareDistanceToClosestCorrespondence (float x0, float y0) const
 Returns the square distance from the 2D point (x0,y0) to the closest correspondence in the map. More...
 
virtual const mrpt::maps::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. More...
 
virtual mrpt::maps::CSimplePointsMapgetAsSimplePointsMap ()
 
virtual mxArraywriteToMatlab () const
 Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class. More...
 
Direct access to octomap library methods
double getResolution () const
 
unsigned int getTreeDepth () const
 
size_t size () const
 
size_t memoryUsage () const
 
size_t memoryUsageNode () const
 
size_t memoryFullGrid () const
 
double volume ()
 
void getMetricSize (double &x, double &y, double &z)
 Size of OcTree (all known space) in meters for x, y and z dimension. More...
 
void getMetricSize (double &x, double &y, double &z) const
 Size of OcTree (all known space) in meters for x, y and z dimension. More...
 
void getMetricMin (double &x, double &y, double &z)
 minimum value of the bounding box of all known space in x, y, z More...
 
void getMetricMin (double &x, double &y, double &z) const
 minimum value of the bounding box of all known space in x, y, z More...
 
void getMetricMax (double &x, double &y, double &z)
 maximum value of the bounding box of all known space in x, y, z More...
 
void getMetricMax (double &x, double &y, double &z) const
 maximum value of the bounding box of all known space in x, y, z More...
 
size_t calcNumNodes () const
 Traverses the tree to calculate the total number of nodes. More...
 
size_t getNumLeafNodes () const
 Traverses the tree to calculate the total number of leaf nodes. More...
 
RTTI classes and functions
mrpt::utils::CObject::Ptr duplicateGetSmartPtr () const
 Returns a copy of the object, indepently of its class, as a smart pointer (the newly created object will exist as long as any copy of this smart pointer). More...
 

Static Public Member Functions

static voidoperator new (size_t size, void *ptr)
 

Public Attributes

TInsertionOptions insertionOptions
 The options used when inserting observations in the map. More...
 
TLikelihoodOptions likelihoodOptions
 
TRenderingOptions renderingOptions
 
TMapGenericParams genericMapParams
 Common params to all maps. More...
 

Protected Member Functions

bool internal_insertObservation (const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D *robotPose) override
 Internal method called by insertObservation() More...
 
virtual void internal_clear () override
 Internal method called by clear() More...
 
bool internal_build_PointCloud_for_observation (const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D *robotPose, octomap::point3d &point3d_sensorPt, octomap::Pointcloud &ptr_scan) const
 Builds the list of 3D points in global coordinates for a generic observation. More...
 
void publishEvent (const mrptEvent &e) const
 Called when you want this object to emit an event to all the observers currently subscribed to this object. More...
 
bool hasSubscribers () const
 Can be called by a derived class before preparing an event for publishing with publishEvent to determine if there is no one subscribed, so it can save the wasted time preparing an event that will be not read. More...
 
CSerializable virtual methods
void writeToStream (mrpt::utils::CStream &out, int *getVersion) const override
 Introduces a pure virtual method responsible for writing to a CStream. More...
 
void readFromStream (mrpt::utils::CStream &in, int version) override
 Introduces a pure virtual method responsible for loading from a CStream This can not be used directly be users, instead use "stream >> object;" for reading it from a stream or "stream >> object_ptr;" if the class is unknown apriori. More...
 

Protected Attributes

octomap::OcTree m_octomap
 The actual octo-map object. More...
 

RTTI stuff

using Ptr = std::shared_ptr< COctoMap >
 
using ConstPtr = std::shared_ptr< const COctoMap >
 
static mrpt::utils::CLASSINIT _init_COctoMap
 
static const mrpt::utils::TRuntimeClassId runtimeClassId
 
static constexpr const char * className = "COctoMap"
 
static const mrpt::utils::TRuntimeClassId_GetBaseClass ()
 
static const mrpt::utils::TRuntimeClassIdGetRuntimeClassIdStatic ()
 
static mrpt::utils::CObjectCreateObject ()
 
template<typename... Args>
static Ptr Create (Args &&... args)
 
virtual const mrpt::utils::TRuntimeClassIdGetRuntimeClass () const override
 Returns information about the class of an object in runtime. More...
 
virtual mrpt::utils::CObjectclone () const override
 Returns a deep copy (clone) of the object, indepently of its class. More...
 

Map Definition Interface stuff (see * mrpt::maps::TMetricMapInitializer) @{

static const size_t m_private_map_register_id = mrpt::maps::internal::TMetricMapTypesRegistry::Instance().doRegister( "COctoMap,octoMap" , & mrpt::maps::COctoMap ::MapDefinition, & mrpt::maps::COctoMap ::internal_CreateFromMapDefinition)
 ID used to initialize class registration (just ignore it) More...
 
static mrpt::maps::TMetricMapInitializerMapDefinition ()
 Returns default map definition initializer. More...
 
static COctoMapCreateFromMapDefinition (const mrpt::maps::TMetricMapInitializer &def)
 Constructor from a map definition structure: initializes the map and * its parameters accordingly. More...
 
static mrpt::maps::CMetricMapinternal_CreateFromMapDefinition (const mrpt::maps::TMetricMapInitializer &def)
 

Member Typedef Documentation

◆ ConstPtr

using mrpt::maps::COctoMap::ConstPtr = std::shared_ptr<const COctoMap >

Definition at line 35 of file COctoMap.h.

◆ myself_t

typedef COctoMapBase<octomap::OcTree , octomap::OcTreeNode > mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::myself_t
inherited

The type of this MRPT class.

Definition at line 52 of file COctoMapBase.h.

◆ octree_node_t

typedef octomap::OcTreeNode mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::octree_node_t
inherited

The type of nodes in the octree, in the "octomap" library.

Definition at line 56 of file COctoMapBase.h.

◆ octree_t

typedef octomap::OcTree mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::octree_t
inherited

The type of the octree class in the "octomap" library.

Definition at line 54 of file COctoMapBase.h.

◆ Ptr

using mrpt::maps::COctoMap::Ptr = std::shared_ptr< COctoMap >

A typedef for the associated smart pointer

Definition at line 35 of file COctoMap.h.

Constructor & Destructor Documentation

◆ COctoMap()

COctoMap::COctoMap ( const double  resolution = 0.10)

Default constructor.

Definition at line 74 of file COctoMap.cpp.

◆ ~COctoMap()

COctoMap::~COctoMap ( )
virtual

Destructor.

Definition at line 82 of file COctoMap.cpp.

Member Function Documentation

◆ _GetBaseClass()

static const mrpt::utils::TRuntimeClassId* mrpt::maps::COctoMap::_GetBaseClass ( )
staticprotected

◆ auxParticleFilterCleanUp()

virtual void mrpt::maps::CMetricMap::auxParticleFilterCleanUp ( )
inlinevirtualinherited

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.

Reimplemented in mrpt::maps::CLandmarksMap, and mrpt::maps::CMultiMetricMap.

Definition at line 289 of file CMetricMap.h.

◆ calcNumNodes()

size_t mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::calcNumNodes ( ) const
inlineinherited

Traverses the tree to calculate the total number of nodes.

Definition at line 451 of file COctoMapBase.h.

References mrpt::maps::COctoMapBase< OCTREE, OCTREE_NODE >::m_octomap.

◆ canComputeObservationLikelihood() [1/2]

bool CMetricMap::canComputeObservationLikelihood ( const mrpt::obs::CObservation obs) const
virtualinherited

Returns true if this map is able to compute a sensible likelihood function for this observation (i.e.

an occupancy grid map cannot with an image). See: Maps and observations compatibility matrix

Parameters
obsThe observation.
See also
computeObservationLikelihood, genericMapParams.enableObservationLikelihood

Definition at line 180 of file CMetricMap.cpp.

◆ canComputeObservationLikelihood() [2/2]

bool CMetricMap::canComputeObservationLikelihood ( const mrpt::obs::CObservation::Ptr obs) const
inherited

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 121 of file CMetricMap.cpp.

◆ canComputeObservationsLikelihood()

bool CMetricMap::canComputeObservationsLikelihood ( const mrpt::obs::CSensoryFrame sf) const
inherited

Returns true if this map is able to compute a sensible likelihood function for this observation (i.e.

an occupancy grid map cannot with an image). See: Maps and observations compatibility matrix

Parameters
sfThe observations.
See also
canComputeObservationLikelihood

Definition at line 86 of file CMetricMap.cpp.

References mrpt::obs::CSensoryFrame::begin(), and mrpt::obs::CSensoryFrame::end().

Here is the call graph for this function:

◆ castRay()

bool mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::castRay ( const mrpt::math::TPoint3D origin,
const mrpt::math::TPoint3D direction,
mrpt::math::TPoint3D end,
bool  ignoreUnknownCells = false,
double  maxRange = -1.0 
) const
inherited

Performs raycasting in 3d, similar to computeRay().

A ray is cast from origin with a given direction, the first occupied cell is returned (as center coordinate). If the starting coordinate is already occupied in the tree, this coordinate will be returned as a hit.

Parameters
originstarting coordinate of ray
directionA vector pointing in the direction of the raycast. Does not need to be normalized.
endreturns the center of the cell that was hit by the ray, if successful
ignoreUnknownCellswhether unknown cells are ignored. If false (default), the raycast aborts when an unkown cell is hit.
maxRangeMaximum range after which the raycast is aborted (<= 0: no limit, default)
Returns
whether or not an occupied cell was hit

Definition at line 238 of file COctoMapBase_impl.h.

References mrpt::math::TPoint3D::x, mrpt::math::TPoint3D::y, and mrpt::math::TPoint3D::z.

◆ clear()

void CMetricMap::clear ( )
inherited

◆ clone()

virtual mrpt::utils::CObject* mrpt::maps::COctoMap::clone ( ) const
overridevirtual

Returns a deep copy (clone) of the object, indepently of its class.

Implements mrpt::utils::CObject.

◆ compute3DMatchingRatio()

float CMetricMap::compute3DMatchingRatio ( const mrpt::maps::CMetricMap otherMap,
const mrpt::poses::CPose3D otherMapPose,
const TMatchingRatioParams params 
) const
virtualinherited

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".
params[IN] Matching parameters
Returns
The matching ratio [0,1]
See also
determineMatching2D

Reimplemented in mrpt::maps::COccupancyGridMap2D, mrpt::maps::CPointsMap, mrpt::maps::CMultiMetricMap, mrpt::maps::CRandomFieldGridMap2D, mrpt::maps::CLandmarksMap, mrpt::maps::CHeightGridMap2D, mrpt::maps::CBeaconMap, and mrpt::maps::CReflectivityGridMap2D.

Definition at line 157 of file CMetricMap.cpp.

References MRPT_END, MRPT_START, MRPT_UNUSED_PARAM, and THROW_EXCEPTION.

Referenced by mrpt::maps::CMultiMetricMap::compute3DMatchingRatio().

Here is the caller graph for this function:

◆ computeObservationLikelihood() [1/2]

double CMetricMap::computeObservationLikelihood ( const mrpt::obs::CObservation obs,
const mrpt::poses::CPose3D takenFrom 
)
inherited

Computes the log-likelihood of a given observation given an arbitrary robot 3D pose.

See: Maps and observations compatibility matrix

Parameters
takenFromThe robot's pose the observation is supposed to be taken from.
obsThe observation.
Returns
This method returns a log-likelihood.
See also
Used in particle filter algorithms, see: CMultiMetricMapPDF::update

Definition at line 189 of file CMetricMap.cpp.

Referenced by mrpt::maps::CMultiMetricMapPDF::PF_SLAM_computeObservationLikelihoodForParticle().

Here is the caller graph for this function:

◆ computeObservationLikelihood() [2/2]

double CMetricMap::computeObservationLikelihood ( const mrpt::obs::CObservation obs,
const mrpt::poses::CPose2D takenFrom 
)
inherited

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 77 of file CMetricMap.cpp.

◆ computeObservationsLikelihood()

double CMetricMap::computeObservationsLikelihood ( const mrpt::obs::CSensoryFrame sf,
const mrpt::poses::CPose2D takenFrom 
)
inherited

Returns the sum of the log-likelihoods of each individual observation within a mrpt::obs::CSensoryFrame.

See: Maps and observations compatibility matrix

Parameters
takenFromThe robot's pose the observation is supposed to be taken from.
sfThe set of observations in a CSensoryFrame.
Returns
This method returns a log-likelihood.
See also
canComputeObservationsLikelihood

Definition at line 67 of file CMetricMap.cpp.

References mrpt::obs::CSensoryFrame::begin(), and mrpt::obs::CSensoryFrame::end().

Referenced by mrpt::hmtslam::CLocalMetricHypothesis::auxiliarComputeObservationLikelihood().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Create()

template<typename... Args>
static Ptr mrpt::maps::COctoMap::Create ( Args &&...  args)
inlinestatic

Definition at line 35 of file COctoMap.h.

◆ CreateFromMapDefinition()

mrpt::maps::COctoMap * mrpt::maps::COctoMap::CreateFromMapDefinition ( const mrpt::maps::TMetricMapInitializer def)
static

Constructor from a map definition structure: initializes the map and * its parameters accordingly.

Definition at line 30 of file COctoMap.cpp.

◆ CreateObject()

static mrpt::utils::CObject* mrpt::maps::COctoMap::CreateObject ( )
static

◆ determineMatching2D()

void CMetricMap::determineMatching2D ( const mrpt::maps::CMetricMap otherMap,
const mrpt::poses::CPose2D otherMapPose,
mrpt::utils::TMatchingPairList correspondences,
const TMatchingParams params,
TMatchingExtraResults extraResults 
) const
virtualinherited

Computes the matching between this and another 2D point map, which includes finding:

  • The set of points pairs in each map
  • The mean squared distance between corresponding pairs.

The algorithm is:

  • For each point in "otherMap":
    • Transform the point according to otherMapPose
    • Search with a KD-TREE the closest correspondences in "this" map.
    • Add to the set of candidate matchings, if it passes all the thresholds in params.

This method is the most time critical one into ICP-like algorithms.

Parameters
otherMap[IN] The other map to compute the matching with.
otherMapPose[IN] The pose of the other map as seen from "this".
params[IN] Parameters for the determination of pairings.
correspondences[OUT] The detected matchings pairs.
extraResults[OUT] Other results.
See also
compute3DMatchingRatio

Reimplemented in mrpt::maps::COccupancyGridMap2D, mrpt::maps::CPointsMap, mrpt::maps::CMultiMetricMap, and mrpt::maps::CBeaconMap.

Definition at line 127 of file CMetricMap.cpp.

References MRPT_END, MRPT_START, MRPT_UNUSED_PARAM, and THROW_EXCEPTION.

Referenced by mrpt::slam::CICP::ICP_Method_Classic().

Here is the caller graph for this function:

◆ determineMatching3D()

void CMetricMap::determineMatching3D ( const mrpt::maps::CMetricMap otherMap,
const mrpt::poses::CPose3D otherMapPose,
mrpt::utils::TMatchingPairList correspondences,
const TMatchingParams params,
TMatchingExtraResults extraResults 
) const
virtualinherited

Computes the matchings between this and another 3D points map - method used in 3D-ICP.

This method finds the set of point pairs in each map.

The method is the most time critical one into ICP-like algorithms.

The algorithm is:

  • For each point in "otherMap":
    • Transform the point according to otherMapPose
    • Search with a KD-TREE the closest correspondences in "this" map.
    • Add to the set of candidate matchings, if it passes all the thresholds in params.
Parameters
otherMap[IN] The other map to compute the matching with.
otherMapPose[IN] The pose of the other map as seen from "this".
params[IN] Parameters for the determination of pairings.
correspondences[OUT] The detected matchings pairs.
extraResults[OUT] Other results.
See also
compute3DMatchingRatio

Reimplemented in mrpt::maps::CPointsMap.

Definition at line 142 of file CMetricMap.cpp.

References MRPT_END, MRPT_START, MRPT_UNUSED_PARAM, and THROW_EXCEPTION.

Referenced by mrpt::slam::CICP::ICP3D_Method_Classic().

Here is the caller graph for this function:

◆ getAs3DObject()

virtual void mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::getAs3DObject ( mrpt::opengl::CSetOfObjects::Ptr outObj) const
inlineoverridevirtualinherited

Returns a 3D object representing the map.

See also
renderingOptions

Implements mrpt::maps::CMetricMap.

Definition at line 318 of file COctoMapBase.h.

References mrpt::maps::COctoMapBase< OCTREE, OCTREE_NODE >::getAsOctoMapVoxels().

◆ getAsOctoMapVoxels()

void COctoMap::getAsOctoMapVoxels ( mrpt::opengl::COctoMapVoxels gl_obj) const
overridevirtual

◆ getAsSimplePointsMap() [1/2]

virtual const mrpt::maps::CSimplePointsMap* mrpt::maps::CMetricMap::getAsSimplePointsMap ( ) const
inlinevirtualinherited

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 in mrpt::maps::CPointsMap, mrpt::maps::CMultiMetricMap, and mrpt::maps::CSimplePointsMap.

Definition at line 301 of file CMetricMap.h.

Referenced by mrpt::maps::CPointsMap::compute3DMatchingRatio().

Here is the caller graph for this function:

◆ getAsSimplePointsMap() [2/2]

virtual mrpt::maps::CSimplePointsMap* mrpt::maps::CMetricMap::getAsSimplePointsMap ( )
inlinevirtualinherited

◆ getMetricMax() [1/2]

void mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::getMetricMax ( double &  x,
double &  y,
double &  z 
)
inlineinherited

maximum value of the bounding box of all known space in x, y, z

Definition at line 440 of file COctoMapBase.h.

References mrpt::maps::COctoMapBase< OCTREE, OCTREE_NODE >::m_octomap.

◆ getMetricMax() [2/2]

void mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::getMetricMax ( double &  x,
double &  y,
double &  z 
) const
inlineinherited

maximum value of the bounding box of all known space in x, y, z

Definition at line 445 of file COctoMapBase.h.

References mrpt::maps::COctoMapBase< OCTREE, OCTREE_NODE >::m_octomap.

◆ getMetricMin() [1/2]

void mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::getMetricMin ( double &  x,
double &  y,
double &  z 
)
inlineinherited

minimum value of the bounding box of all known space in x, y, z

Definition at line 430 of file COctoMapBase.h.

References mrpt::maps::COctoMapBase< OCTREE, OCTREE_NODE >::m_octomap.

◆ getMetricMin() [2/2]

void mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::getMetricMin ( double &  x,
double &  y,
double &  z 
) const
inlineinherited

minimum value of the bounding box of all known space in x, y, z

Definition at line 435 of file COctoMapBase.h.

References mrpt::maps::COctoMapBase< OCTREE, OCTREE_NODE >::m_octomap.

◆ getMetricSize() [1/2]

void mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::getMetricSize ( double &  x,
double &  y,
double &  z 
)
inlineinherited

Size of OcTree (all known space) in meters for x, y and z dimension.

Definition at line 420 of file COctoMapBase.h.

References mrpt::maps::COctoMapBase< OCTREE, OCTREE_NODE >::m_octomap.

◆ getMetricSize() [2/2]

void mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::getMetricSize ( double &  x,
double &  y,
double &  z 
) const
inlineinherited

Size of OcTree (all known space) in meters for x, y and z dimension.

Definition at line 425 of file COctoMapBase.h.

References mrpt::maps::COctoMapBase< OCTREE, OCTREE_NODE >::m_octomap.

◆ getNumLeafNodes()

size_t mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::getNumLeafNodes ( ) const
inlineinherited

Traverses the tree to calculate the total number of leaf nodes.

Definition at line 453 of file COctoMapBase.h.

References mrpt::maps::COctoMapBase< OCTREE, OCTREE_NODE >::m_octomap.

◆ getOctomap()

octomap::OcTree & mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::getOctomap ( )
inlineinherited

Get a reference to the internal octomap object.

Example:

...
octomap::OcTree &om = map.getOctomap();

Definition at line 74 of file COctoMapBase.h.

References mrpt::maps::COctoMapBase< OCTREE, OCTREE_NODE >::m_octomap.

◆ getPointOccupancy()

bool mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::getPointOccupancy ( const float  x,
const float  y,
const float  z,
double &  prob_occupancy 
) const
inherited

Get the occupancy probability [0,1] of a point.

Returns
false if the point is not mapped, in which case the returned "prob" is undefined.

Definition at line 204 of file COctoMapBase_impl.h.

◆ getResolution()

double mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::getResolution ( ) const
inlineinherited

◆ GetRuntimeClass()

virtual const mrpt::utils::TRuntimeClassId* mrpt::maps::COctoMap::GetRuntimeClass ( ) const
overridevirtual

Returns information about the class of an object in runtime.

Reimplemented from mrpt::maps::CMetricMap.

◆ GetRuntimeClassIdStatic()

static const mrpt::utils::TRuntimeClassId& mrpt::maps::COctoMap::GetRuntimeClassIdStatic ( )
static

◆ getTreeDepth()

unsigned int mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::getTreeDepth ( ) const
inlineinherited

◆ hasSubscribers()

bool mrpt::utils::CObservable::hasSubscribers ( ) const
inlineprotectedinherited

Can be called by a derived class before preparing an event for publishing with publishEvent to determine if there is no one subscribed, so it can save the wasted time preparing an event that will be not read.

Definition at line 57 of file CObservable.h.

References mrpt::utils::CObservable::m_subscribers.

Referenced by mrpt::gui::CWindowDialog::OnMouseDown(), mrpt::gui::CWindowDialog::OnMouseMove(), mrpt::gui::CWindowDialog::OnResize(), and mrpt::opengl::COpenGLViewport::render().

Here is the caller graph for this function:

◆ insertObservation()

bool CMetricMap::insertObservation ( const mrpt::obs::CObservation obs,
const mrpt::poses::CPose3D robotPose = NULL 
)
inherited

Insert the observation information into this map.

This method must be implemented in derived classes. See: Maps and observations compatibility matrix

Parameters
obsThe observation
robotPoseThe 3D pose of the robot mobile base in the map reference system, or NULL (default) if you want to use the origin.
See also
CObservation::insertObservationInto

Definition at line 95 of file CMetricMap.cpp.

Referenced by ICPTests::align2scans(), mrpt::maps::COccupancyGridMap2D::computeObservationLikelihood_likelihoodField_Thrun(), mrpt::opengl::CPlanarLaserScan::getBoundingBox(), mrpt::graphslam::deciders::CRangeScanOps< GRAPH_T >::getICPEdge(), CAngularObservationMesh_fnctr::operator()(), mrpt::opengl::CPlanarLaserScan::render_dl(), TEST(), and mrpt::graphslam::CGraphSlamEngine< GRAPH_T >::updateMapVisualization().

Here is the caller graph for this function:

◆ insertObservationPtr()

bool CMetricMap::insertObservationPtr ( const mrpt::obs::CObservation::Ptr obs,
const mrpt::poses::CPose3D robotPose = NULL 
)
inherited

A wrapper for smart pointers, just calls the non-smart pointer version.

See: Maps and observations compatibility matrix

Definition at line 109 of file CMetricMap.cpp.

References MRPT_END, MRPT_START, and THROW_EXCEPTION.

Referenced by mrpt::slam::CMetricMapBuilderICP::processObservation().

Here is the caller graph for this function:

◆ insertPointCloud()

void mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::insertPointCloud ( const CPointsMap ptMap,
const float  sensor_x,
const float  sensor_y,
const float  sensor_z 
)
inherited

Update the octomap with a 2D or 3D scan, given directly as a point cloud and the 3D location of the sensor (the origin of the rays) in this map's frame of reference.

Insertion parameters can be found in insertionOptions.

See also
The generic observation insertion method CMetricMap::insertObservation()

Definition at line 221 of file COctoMapBase_impl.h.

References mrpt::maps::CPointsMap::getPointsBuffer(), MRPT_END, and MRPT_START.

◆ insertRay()

void mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::insertRay ( const float  end_x,
const float  end_y,
const float  end_z,
const float  sensor_x,
const float  sensor_y,
const float  sensor_z 
)
inlineinherited

◆ internal_build_PointCloud_for_observation()

bool mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::internal_build_PointCloud_for_observation ( const mrpt::obs::CObservation obs,
const mrpt::poses::CPose3D robotPose,
octomap::point3d &  point3d_sensorPt,
octomap::Pointcloud &  ptr_scan 
) const
protectedinherited

◆ internal_clear()

virtual void mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::internal_clear ( )
inlineoverrideprotectedvirtualinherited

Internal method called by clear()

Implements mrpt::maps::CMetricMap.

Definition at line 457 of file COctoMapBase.h.

References mrpt::maps::COctoMapBase< OCTREE, OCTREE_NODE >::m_octomap.

◆ internal_CreateFromMapDefinition()

mrpt::maps::CMetricMap * COctoMap::internal_CreateFromMapDefinition ( const mrpt::maps::TMetricMapInitializer def)
static

◆ internal_insertObservation()

bool COctoMap::internal_insertObservation ( const mrpt::obs::CObservation obs,
const mrpt::poses::CPose3D robotPose 
)
overrideprotectedvirtual

Internal method called by insertObservation()

Implements mrpt::maps::CMetricMap.

Definition at line 145 of file COctoMap.cpp.

◆ isEmpty()

bool mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::isEmpty ( ) const
overridevirtualinherited

Returns true if the map is empty/no observation has been inserted.

Implements mrpt::maps::CMetricMap.

Definition at line 142 of file COctoMapBase_impl.h.

◆ isPointWithinOctoMap()

bool mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::isPointWithinOctoMap ( const float  x,
const float  y,
const float  z 
) const
inlineinherited

Check whether the given point lies within the volume covered by the octomap (that is, whether it is "mapped")

Definition at line 336 of file COctoMapBase.h.

References mrpt::maps::COctoMapBase< OCTREE, OCTREE_NODE >::m_octomap.

◆ loadFromProbabilisticPosesAndObservations()

void CMetricMap::loadFromProbabilisticPosesAndObservations ( const mrpt::maps::CSimpleMap Map)
inherited

Load the map contents from a CSimpleMap object, erasing all previous content of the map.

This is done invoking insertObservation() for each observation at the mean 3D robot pose of each pose-observations pair in the CSimpleMap object.

See also
insertObservation, CSimpleMap
Exceptions
std::exceptionSome internal steps in invoked methods can raise exceptions on invalid parameters, etc...

Definition at line 37 of file CMetricMap.cpp.

References ASSERTMSG_, mrpt::utils::clear(), mrpt::maps::CSimpleMap::get(), and mrpt::maps::CSimpleMap::size().

Referenced by mrpt::maps::CMetricMap::loadFromSimpleMap(), and run_test_pf_localization().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadFromSimpleMap()

void mrpt::maps::CMetricMap::loadFromSimpleMap ( const mrpt::maps::CSimpleMap Map)
inlineinherited

!

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 109 of file CMetricMap.h.

References mrpt::maps::CMetricMap::loadFromProbabilisticPosesAndObservations().

Referenced by mrpt::maps::CRandomFieldGridMap2D::internal_clear().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MapDefinition()

mrpt::maps::TMetricMapInitializer * mrpt::maps::COctoMap::MapDefinition ( )
static

Returns default map definition initializer.

See * mrpt::maps::TMetricMapInitializer

Definition at line 30 of file COctoMap.cpp.

◆ memoryFullGrid()

size_t mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::memoryFullGrid ( ) const
inlineinherited
Returns
Memory usage of a full grid of the same size as the OcTree in bytes (for comparison)

Definition at line 417 of file COctoMapBase.h.

References mrpt::maps::COctoMapBase< OCTREE, OCTREE_NODE >::m_octomap.

◆ memoryUsage()

size_t mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::memoryUsage ( ) const
inlineinherited
Returns
Memory usage of the complete octree in bytes (may vary between architectures)

Definition at line 412 of file COctoMapBase.h.

References mrpt::maps::COctoMapBase< OCTREE, OCTREE_NODE >::m_octomap.

◆ memoryUsageNode()

size_t mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::memoryUsageNode ( ) const
inlineinherited
Returns
Memory usage of the a single octree node

Definition at line 414 of file COctoMapBase.h.

References mrpt::maps::COctoMapBase< OCTREE, OCTREE_NODE >::m_octomap.

◆ operator delete() [1/3]

void mrpt::maps::COctoMap::operator delete ( void memory,
void ptr 
)
inlinenoexcept

Definition at line 35 of file COctoMap.h.

◆ operator delete() [2/3]

void mrpt::maps::COctoMap::operator delete ( void ptr)
inlinenoexcept

Definition at line 35 of file COctoMap.h.

◆ operator delete() [3/3]

void mrpt::maps::COctoMap::operator delete ( void ptr,
const std::nothrow_t &   
)
inlinenoexcept

Definition at line 35 of file COctoMap.h.

◆ operator delete[]()

void mrpt::maps::COctoMap::operator delete[] ( void ptr)
inlinenoexcept

Definition at line 35 of file COctoMap.h.

◆ operator new() [1/3]

static void* mrpt::maps::COctoMap::operator new ( size_t  size,
void ptr 
)
inlinestatic

Definition at line 35 of file COctoMap.h.

◆ operator new() [2/3]

void* mrpt::maps::COctoMap::operator new ( size_t  size,
const std::nothrow_t &   
)
inlinenoexcept

Definition at line 35 of file COctoMap.h.

◆ operator new() [3/3]

void* mrpt::maps::COctoMap::operator new ( size_t  size)
inline

Definition at line 35 of file COctoMap.h.

◆ operator new[]()

void* mrpt::maps::COctoMap::operator new[] ( size_t  size)
inline

Definition at line 35 of file COctoMap.h.

◆ publishEvent()

void CObservable::publishEvent ( const mrptEvent e) const
protectedinherited

◆ readFromStream()

void COctoMap::readFromStream ( mrpt::utils::CStream in,
int  version 
)
overrideprotectedvirtual

Introduces a pure virtual method responsible for loading from a CStream This can not be used directly be users, instead use "stream >> object;" for reading it from a stream or "stream >> object_ptr;" if the class is unknown apriori.

Parameters
inThe input binary stream where the object data must read from.
versionThe version of the object stored in the stream: use this version number in your code to know how to read the incoming data.
Exceptions
std::exceptionOn any error, see CStream::ReadBuffer
See also
CStream

Implements mrpt::utils::CSerializable.

Definition at line 113 of file COctoMap.cpp.

References mrpt::utils::clear(), mrpt::system::deleteFile(), mrpt::system::getTempFileName(), MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION, mrpt::utils::CMemoryChunk::readFromStream(), and THROW_EXCEPTION.

Here is the call graph for this function:

◆ saveMetricMapRepresentationToFile()

void mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::saveMetricMapRepresentationToFile ( const std::string filNamePrefix) const
overridevirtualinherited

This virtual method saves the map to a file "filNamePrefix"+< some_file_extension >, as an image or in any other applicable way (Notice that other methods to save the map may be implemented in classes implementing this virtual interface).

Implements mrpt::maps::CMetricMap.

Definition at line 148 of file COctoMapBase_impl.h.

References mrpt::opengl::COpenGLScene::insert(), MRPT_END, and MRPT_START.

◆ size()

size_t mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::size ( ) const
inlineinherited
Returns
The number of nodes in the tree

Definition at line 409 of file COctoMapBase.h.

References mrpt::maps::COctoMapBase< OCTREE, OCTREE_NODE >::m_octomap.

◆ squareDistanceToClosestCorrespondence()

float CMetricMap::squareDistanceToClosestCorrespondence ( float  x0,
float  y0 
) const
virtualinherited

Returns the square distance from the 2D point (x0,y0) to the closest correspondence in the map.

Reimplemented in mrpt::maps::CPointsMap.

Definition at line 170 of file CMetricMap.cpp.

References MRPT_END, MRPT_START, MRPT_UNUSED_PARAM, and THROW_EXCEPTION.

◆ updateVoxel()

void mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::updateVoxel ( const double  x,
const double  y,
const double  z,
bool  occupied 
)
inlineinherited

Manually updates the occupancy of the voxel at (x,y,z) as being occupied (true) or free (false), using the log-odds parameters in insertionOptions.

Definition at line 352 of file COctoMapBase.h.

References mrpt::maps::COctoMapBase< OCTREE, OCTREE_NODE >::m_octomap.

◆ volume()

double mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::volume ( )
inlineinherited

◆ writeToMatlab()

virtual mxArray* mrpt::utils::CSerializable::writeToMatlab ( ) const
inlinevirtualinherited

Introduces a pure virtual method responsible for writing to a mxArray Matlab object, typically a MATLAB struct whose contents are documented in each derived class.

Returns
A new mxArray (caller is responsible of memory freeing) or nullptr is class does not support conversion to MATLAB.

Definition at line 89 of file CSerializable.h.

◆ writeToStream()

void COctoMap::writeToStream ( mrpt::utils::CStream out,
int *  getVersion 
) const
overrideprotectedvirtual

Introduces a pure virtual method responsible for writing to a CStream.

This can not be used directly be users, instead use "stream << object;" for writing it to a stream.

Parameters
outThe output binary stream where object must be dumped.
getVersionIf nullptr, the object must be dumped. If not, only the version of the object dump must be returned in this pointer. This enables the versioning of objects dumping and backward compatibility with previously stored data.
Exceptions
std::exceptionOn any error, see CStream::WriteBuffer
See also
CStream

Implements mrpt::utils::CSerializable.

Definition at line 88 of file COctoMap.cpp.

References mrpt::system::deleteFile(), mrpt::system::getTempFileName(), mrpt::utils::CMemoryStream::loadBufferFromFile(), and mrpt::utils::CSerializable::writeToStream().

Here is the call graph for this function:

Member Data Documentation

◆ _init_COctoMap

mrpt::utils::CLASSINIT mrpt::maps::COctoMap::_init_COctoMap
staticprotected

Definition at line 35 of file COctoMap.h.

◆ className

constexpr const char* mrpt::maps::COctoMap::className = "COctoMap"
static

Definition at line 35 of file COctoMap.h.

◆ genericMapParams

TMapGenericParams mrpt::maps::CMetricMap::genericMapParams
inherited

◆ insertionOptions

TInsertionOptions mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::insertionOptions
inherited

The options used when inserting observations in the map.

Definition at line 242 of file COctoMapBase.h.

◆ likelihoodOptions

TLikelihoodOptions mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::likelihoodOptions
inherited

Definition at line 269 of file COctoMapBase.h.

◆ m_octomap

octomap::OcTree mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::m_octomap
protectedinherited

The actual octo-map object.

Definition at line 472 of file COctoMapBase.h.

◆ m_private_map_register_id

const size_t mrpt::maps::COctoMap::m_private_map_register_id = mrpt::maps::internal::TMetricMapTypesRegistry::Instance().doRegister( "COctoMap,octoMap" , & mrpt::maps::COctoMap ::MapDefinition, & mrpt::maps::COctoMap ::internal_CreateFromMapDefinition)
static

ID used to initialize class registration (just ignore it)

Definition at line 53 of file COctoMap.h.

◆ renderingOptions

TRenderingOptions mrpt::maps::COctoMapBase< octomap::OcTree , octomap::OcTreeNode >::renderingOptions
inherited

Definition at line 313 of file COctoMapBase.h.

◆ runtimeClassId

const mrpt::utils::TRuntimeClassId mrpt::maps::COctoMap::runtimeClassId
staticprotected

Definition at line 35 of file COctoMap.h.




Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019