Main MRPT website > C++ reference for MRPT 1.4.0
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes
octomap::AbstractOccupancyOcTree Class Referenceabstract

Detailed Description

Interface class for all octree types that store occupancy.

This serves as a common base class e.g. for polymorphism and contains common code for reading and writing binary trees.

Definition at line 66 of file AbstractOccupancyOcTree.h.

#include <mrpt/otherlibs/octomap/AbstractOccupancyOcTree.h>

Inheritance diagram for octomap::AbstractOccupancyOcTree:
Inheritance graph

Public Member Functions

 AbstractOccupancyOcTree ()
 
virtual ~AbstractOccupancyOcTree ()
 
bool writeBinary (const std::string &filename)
 Writes OcTree to a binary file using writeBinary(). More...
 
bool writeBinary (std::ostream &s)
 Writes compressed maximum likelihood OcTree to a binary stream. More...
 
bool writeBinaryConst (const std::string &filename) const
 Writes OcTree to a binary file using writeBinaryConst(). More...
 
bool writeBinaryConst (std::ostream &s) const
 Writes the maximum likelihood OcTree to a binary stream (const variant). More...
 
virtual std::ostream & writeBinaryData (std::ostream &s) const =0
 Writes the actual data, implemented in OccupancyOcTreeBase::writeBinaryData() More...
 
bool readBinary (std::istream &s)
 Reads an OcTree from an input stream. More...
 
bool readBinary (const std::string &filename)
 Reads OcTree from a binary file. More...
 
virtual std::istream & readBinaryData (std::istream &s)=0
 Reads the actual data, implemented in OccupancyOcTreeBase::readBinaryData() More...
 
bool isNodeOccupied (const OcTreeNode *occupancyNode) const
 queries whether a node is occupied according to the tree's parameter for "occupancy" More...
 
bool isNodeOccupied (const OcTreeNode &occupancyNode) const
 queries whether a node is occupied according to the tree's parameter for "occupancy" More...
 
bool isNodeAtThreshold (const OcTreeNode *occupancyNode) const
 queries whether a node is at the clamping threshold according to the tree's parameter More...
 
bool isNodeAtThreshold (const OcTreeNode &occupancyNode) const
 queries whether a node is at the clamping threshold according to the tree's parameter More...
 
virtual OcTreeNodeupdateNode (const OcTreeKey &key, float log_odds_update, bool lazy_eval=false)=0
 Manipulate log_odds value of voxel directly. More...
 
virtual OcTreeNodeupdateNode (const point3d &value, float log_odds_update, bool lazy_eval=false)=0
 Manipulate log_odds value of voxel directly. More...
 
virtual OcTreeNodeupdateNode (const OcTreeKey &key, bool occupied, bool lazy_eval=false)=0
 Integrate occupancy measurement. More...
 
virtual OcTreeNodeupdateNode (const point3d &value, bool occupied, bool lazy_eval=false)=0
 Integrate occupancy measurement. More...
 
virtual void toMaxLikelihood ()=0
 
void setOccupancyThres (double prob)
 sets the threshold for occupancy (sensor model) More...
 
void setProbHit (double prob)
 sets the probablility for a "hit" (will be converted to logodds) - sensor model More...
 
void setProbMiss (double prob)
 sets the probablility for a "miss" (will be converted to logodds) - sensor model More...
 
void setClampingThresMin (double thresProb)
 sets the minimum threshold for occupancy clamping (sensor model) More...
 
void setClampingThresMax (double thresProb)
 sets the maximum threshold for occupancy clamping (sensor model) More...
 
double getOccupancyThres () const
 
float getOccupancyThresLog () const
 
double getProbHit () const
 
float getProbHitLog () const
 
double getProbMiss () const
 
float getProbMissLog () const
 
double getClampingThresMin () const
 
float getClampingThresMinLog () const
 
double getClampingThresMax () const
 
float getClampingThresMaxLog () const
 
virtual AbstractOcTreecreate () const =0
 virtual constructor: creates a new object of same type More...
 
virtual std::string getTreeType () const =0
 returns actual class name as string for identification More...
 
virtual double getResolution () const =0
 
virtual void setResolution (double res)=0
 
virtual size_t size () const =0
 
virtual size_t memoryUsage () const =0
 
virtual size_t memoryUsageNode () const =0
 
virtual void getMetricMin (double &x, double &y, double &z)=0
 
virtual void getMetricMin (double &x, double &y, double &z) const =0
 
virtual void getMetricMax (double &x, double &y, double &z)=0
 
virtual void getMetricMax (double &x, double &y, double &z) const =0
 
virtual void getMetricSize (double &x, double &y, double &z)=0
 
virtual void prune ()=0
 
virtual void expand ()=0
 
virtual void clear ()=0
 
bool write (const std::string &filename) const
 Write file header and complete tree to file (serialization) More...
 
bool write (std::ostream &s) const
 Write file header and complete tree to stream (serialization) More...
 
virtual std::istream & readData (std::istream &s)=0
 Read all nodes from the input stream (without file header), for this the tree needs to be already created. More...
 
virtual std::ostream & writeData (std::ostream &s) const =0
 Write complete state of tree to stream (without file header) unmodified. More...
 

Static Public Member Functions

static AbstractOcTreecreateTree (const std::string id, double res)
 Creates a certain OcTree (factory pattern) More...
 
static AbstractOcTreeread (const std::string &filename)
 Read the file header, create the appropriate class and deserialize. More...
 
static AbstractOcTreeread (std::istream &s)
 Read the file header, create the appropriate class and deserialize. More...
 

Protected Member Functions

bool readBinaryLegacyHeader (std::istream &s, unsigned int &size, double &res)
 Try to read the old binary format for conversion, will be removed in the future. More...
 

Static Protected Member Functions

static bool readHeader (std::istream &s, std::string &id, unsigned &size, double &res)
 
static void registerTreeType (AbstractOcTree *tree)
 

Protected Attributes

float clamping_thres_min
 
float clamping_thres_max
 
float prob_hit_log
 
float prob_miss_log
 
float occ_prob_thres_log
 

Static Protected Attributes

static const std::string binaryFileHeader
 
static const std::string fileHeader
 

Constructor & Destructor Documentation

octomap::AbstractOccupancyOcTree::AbstractOccupancyOcTree ( )
virtual octomap::AbstractOccupancyOcTree::~AbstractOccupancyOcTree ( )
inlinevirtual

Member Function Documentation

virtual void octomap::AbstractOcTree::clear ( )
pure virtualinherited
virtual AbstractOcTree* octomap::AbstractOcTree::create ( ) const
pure virtualinherited
static AbstractOcTree* octomap::AbstractOcTree::createTree ( const std::string  id,
double  res 
)
staticinherited

Creates a certain OcTree (factory pattern)

Parameters
idunique ID of OcTree
resresolution of OcTree
Returns
pointer to newly created OcTree (empty). NULL if the ID is unknown!

Referenced by octomap::AbstractOcTree::~AbstractOcTree().

virtual void octomap::AbstractOcTree::expand ( )
pure virtualinherited
double octomap::AbstractOccupancyOcTree::getClampingThresMax ( ) const
inline
Returns
maximum threshold for occupancy clamping in the sensor model (probability)

Definition at line 231 of file AbstractOccupancyOcTree.h.

References clamping_thres_max, and octomap::probability().

float octomap::AbstractOccupancyOcTree::getClampingThresMaxLog ( ) const
inline
Returns
maximum threshold for occupancy clamping in the sensor model (logodds)

Definition at line 233 of file AbstractOccupancyOcTree.h.

References clamping_thres_max, readBinaryLegacyHeader(), and octomap::AbstractOcTree::size().

double octomap::AbstractOccupancyOcTree::getClampingThresMin ( ) const
inline
Returns
minimum threshold for occupancy clamping in the sensor model (probability)

Definition at line 227 of file AbstractOccupancyOcTree.h.

References clamping_thres_min, and octomap::probability().

float octomap::AbstractOccupancyOcTree::getClampingThresMinLog ( ) const
inline
Returns
minimum threshold for occupancy clamping in the sensor model (logodds)

Definition at line 229 of file AbstractOccupancyOcTree.h.

References clamping_thres_min.

virtual void octomap::AbstractOcTree::getMetricMax ( double &  x,
double &  y,
double &  z 
)
pure virtualinherited
virtual void octomap::AbstractOcTree::getMetricMax ( double &  x,
double &  y,
double &  z 
) const
pure virtualinherited
virtual void octomap::AbstractOcTree::getMetricMin ( double &  x,
double &  y,
double &  z 
)
pure virtualinherited
virtual void octomap::AbstractOcTree::getMetricMin ( double &  x,
double &  y,
double &  z 
) const
pure virtualinherited
virtual void octomap::AbstractOcTree::getMetricSize ( double &  x,
double &  y,
double &  z 
)
pure virtualinherited
double octomap::AbstractOccupancyOcTree::getOccupancyThres ( ) const
inline
Returns
threshold (probability) for occupancy - sensor model

Definition at line 213 of file AbstractOccupancyOcTree.h.

References occ_prob_thres_log, and octomap::probability().

float octomap::AbstractOccupancyOcTree::getOccupancyThresLog ( ) const
inline
Returns
threshold (logodds) for occupancy - sensor model

Definition at line 215 of file AbstractOccupancyOcTree.h.

References occ_prob_thres_log.

double octomap::AbstractOccupancyOcTree::getProbHit ( ) const
inline
Returns
probablility for a "hit" in the sensor model (probability)

Definition at line 218 of file AbstractOccupancyOcTree.h.

References prob_hit_log, and octomap::probability().

float octomap::AbstractOccupancyOcTree::getProbHitLog ( ) const
inline
Returns
probablility for a "hit" in the sensor model (logodds)

Definition at line 220 of file AbstractOccupancyOcTree.h.

References prob_hit_log.

double octomap::AbstractOccupancyOcTree::getProbMiss ( ) const
inline
Returns
probablility for a "miss" in the sensor model (probability)

Definition at line 222 of file AbstractOccupancyOcTree.h.

References prob_miss_log, and octomap::probability().

float octomap::AbstractOccupancyOcTree::getProbMissLog ( ) const
inline
Returns
probablility for a "miss" in the sensor model (logodds)

Definition at line 224 of file AbstractOccupancyOcTree.h.

References prob_miss_log.

virtual double octomap::AbstractOcTree::getResolution ( ) const
pure virtualinherited
virtual std::string octomap::AbstractOcTree::getTreeType ( ) const
pure virtualinherited
bool octomap::AbstractOccupancyOcTree::isNodeAtThreshold ( const OcTreeNode occupancyNode) const
inline

queries whether a node is at the clamping threshold according to the tree's parameter

Definition at line 138 of file AbstractOccupancyOcTree.h.

References clamping_thres_max, clamping_thres_min, and octomap::OcTreeNode::getLogOdds().

bool octomap::AbstractOccupancyOcTree::isNodeAtThreshold ( const OcTreeNode occupancyNode) const
inline

queries whether a node is at the clamping threshold according to the tree's parameter

Definition at line 144 of file AbstractOccupancyOcTree.h.

References clamping_thres_max, clamping_thres_min, octomap::OcTreeNode::getLogOdds(), toMaxLikelihood(), and updateNode().

bool octomap::AbstractOccupancyOcTree::isNodeOccupied ( const OcTreeNode occupancyNode) const
inline

queries whether a node is occupied according to the tree's parameter for "occupancy"

Definition at line 128 of file AbstractOccupancyOcTree.h.

References octomap::OcTreeNode::getLogOdds(), and occ_prob_thres_log.

bool octomap::AbstractOccupancyOcTree::isNodeOccupied ( const OcTreeNode occupancyNode) const
inline

queries whether a node is occupied according to the tree's parameter for "occupancy"

Definition at line 133 of file AbstractOccupancyOcTree.h.

References octomap::OcTreeNode::getLogOdds(), and occ_prob_thres_log.

virtual size_t octomap::AbstractOcTree::memoryUsage ( ) const
pure virtualinherited
virtual size_t octomap::AbstractOcTree::memoryUsageNode ( ) const
pure virtualinherited
virtual void octomap::AbstractOcTree::prune ( )
pure virtualinherited
static AbstractOcTree* octomap::AbstractOcTree::read ( const std::string &  filename)
staticinherited

Read the file header, create the appropriate class and deserialize.

This creates a new octree which you need to delete yourself. If you expect or requre a specific kind of octree, use dynamic_cast afterwards:

AbstractOcTree* tree = AbstractOcTree::read("filename.ot");
OcTree* octree = dynamic_cast<OcTree*>(tree);

Referenced by octomap::AbstractOcTree::~AbstractOcTree().

static AbstractOcTree* octomap::AbstractOcTree::read ( std::istream &  s)
staticinherited

Read the file header, create the appropriate class and deserialize.

This creates a new octree which you need to delete yourself.

bool octomap::AbstractOccupancyOcTree::readBinary ( std::istream &  s)

Reads an OcTree from an input stream.

Existing nodes of the tree are deleted before the tree is read.

Returns
success of operation

Referenced by ~AbstractOccupancyOcTree().

bool octomap::AbstractOccupancyOcTree::readBinary ( const std::string &  filename)

Reads OcTree from a binary file.

Existing nodes of the tree are deleted before the tree is read.

Returns
success of operation
virtual std::istream& octomap::AbstractOccupancyOcTree::readBinaryData ( std::istream &  s)
pure virtual
bool octomap::AbstractOccupancyOcTree::readBinaryLegacyHeader ( std::istream &  s,
unsigned int &  size,
double &  res 
)
protected

Try to read the old binary format for conversion, will be removed in the future.

Referenced by getClampingThresMaxLog().

virtual std::istream& octomap::AbstractOcTree::readData ( std::istream &  s)
pure virtualinherited
static bool octomap::AbstractOcTree::readHeader ( std::istream &  s,
std::string &  id,
unsigned &  size,
double &  res 
)
staticprotectedinherited
static void octomap::AbstractOcTree::registerTreeType ( AbstractOcTree tree)
staticprotectedinherited
void octomap::AbstractOccupancyOcTree::setClampingThresMax ( double  thresProb)
inline

sets the maximum threshold for occupancy clamping (sensor model)

Definition at line 210 of file AbstractOccupancyOcTree.h.

References clamping_thres_max, and octomap::logodds().

void octomap::AbstractOccupancyOcTree::setClampingThresMin ( double  thresProb)
inline

sets the minimum threshold for occupancy clamping (sensor model)

Definition at line 208 of file AbstractOccupancyOcTree.h.

References clamping_thres_min, and octomap::logodds().

void octomap::AbstractOccupancyOcTree::setOccupancyThres ( double  prob)
inline

sets the threshold for occupancy (sensor model)

Definition at line 202 of file AbstractOccupancyOcTree.h.

References octomap::logodds(), and occ_prob_thres_log.

void octomap::AbstractOccupancyOcTree::setProbHit ( double  prob)
inline

sets the probablility for a "hit" (will be converted to logodds) - sensor model

Definition at line 204 of file AbstractOccupancyOcTree.h.

References octomap::logodds(), and prob_hit_log.

void octomap::AbstractOccupancyOcTree::setProbMiss ( double  prob)
inline

sets the probablility for a "miss" (will be converted to logodds) - sensor model

Definition at line 206 of file AbstractOccupancyOcTree.h.

References octomap::logodds(), and prob_miss_log.

virtual void octomap::AbstractOcTree::setResolution ( double  res)
pure virtualinherited
virtual size_t octomap::AbstractOcTree::size ( ) const
pure virtualinherited
virtual void octomap::AbstractOccupancyOcTree::toMaxLikelihood ( )
pure virtual
virtual OcTreeNode* octomap::AbstractOccupancyOcTree::updateNode ( const OcTreeKey key,
float  log_odds_update,
bool  lazy_eval = false 
)
pure virtual

Manipulate log_odds value of voxel directly.

Parameters
keyof the NODE that is to be updated
log_odds_updatevalue to be added (+) to log_odds value of node
lazy_evalwhether update of inner nodes is omitted after the update (default: false). This speeds up the insertion, but you need to call updateInnerOccupancy() when done.
Returns
pointer to the updated NODE

Implemented in octomap::OccupancyOcTreeBase< NODE >, octomap::OccupancyOcTreeBase< ColorOcTreeNode >, octomap::OccupancyOcTreeBase< OcTreeNode >, and octomap::OccupancyOcTreeBase< OcTreeNodeStamped >.

Referenced by isNodeAtThreshold().

virtual OcTreeNode* octomap::AbstractOccupancyOcTree::updateNode ( const point3d value,
float  log_odds_update,
bool  lazy_eval = false 
)
pure virtual

Manipulate log_odds value of voxel directly.

Looks up the OcTreeKey corresponding to the coordinate and then calls udpateNode() with it.

Parameters
value3d coordinate of the NODE that is to be updated
log_odds_updatevalue to be added (+) to log_odds value of node
lazy_evalwhether update of inner nodes is omitted after the update (default: false). This speeds up the insertion, but you need to call updateInnerOccupancy() when done.
Returns
pointer to the updated NODE

Implemented in octomap::OccupancyOcTreeBase< NODE >, octomap::OccupancyOcTreeBase< ColorOcTreeNode >, octomap::OccupancyOcTreeBase< OcTreeNode >, and octomap::OccupancyOcTreeBase< OcTreeNodeStamped >.

virtual OcTreeNode* octomap::AbstractOccupancyOcTree::updateNode ( const OcTreeKey key,
bool  occupied,
bool  lazy_eval = false 
)
pure virtual

Integrate occupancy measurement.

Parameters
keyof the NODE that is to be updated
occupiedtrue if the node was measured occupied, else false
lazy_evalwhether update of inner nodes is omitted after the update (default: false). This speeds up the insertion, but you need to call updateInnerOccupancy() when done.
Returns
pointer to the updated NODE

Implemented in octomap::OccupancyOcTreeBase< NODE >, octomap::OccupancyOcTreeBase< ColorOcTreeNode >, octomap::OccupancyOcTreeBase< OcTreeNode >, and octomap::OccupancyOcTreeBase< OcTreeNodeStamped >.

virtual OcTreeNode* octomap::AbstractOccupancyOcTree::updateNode ( const point3d value,
bool  occupied,
bool  lazy_eval = false 
)
pure virtual

Integrate occupancy measurement.

Looks up the OcTreeKey corresponding to the coordinate and then calls udpateNode() with it.

Parameters
value3d coordinate of the NODE that is to be updated
occupiedtrue if the node was measured occupied, else false
lazy_evalwhether update of inner nodes is omitted after the update (default: false). This speeds up the insertion, but you need to call updateInnerOccupancy() when done.
Returns
pointer to the updated NODE

Implemented in octomap::OccupancyOcTreeBase< NODE >, octomap::OccupancyOcTreeBase< ColorOcTreeNode >, octomap::OccupancyOcTreeBase< OcTreeNode >, and octomap::OccupancyOcTreeBase< OcTreeNodeStamped >.

bool octomap::AbstractOcTree::write ( const std::string &  filename) const
inherited

Write file header and complete tree to file (serialization)

Referenced by octomap::AbstractOcTree::~AbstractOcTree().

bool octomap::AbstractOcTree::write ( std::ostream &  s) const
inherited

Write file header and complete tree to stream (serialization)

bool octomap::AbstractOccupancyOcTree::writeBinary ( const std::string &  filename)

Writes OcTree to a binary file using writeBinary().

The OcTree is first converted to the maximum likelihood estimate and pruned.

Returns
success of operation

Referenced by ~AbstractOccupancyOcTree().

bool octomap::AbstractOccupancyOcTree::writeBinary ( std::ostream &  s)

Writes compressed maximum likelihood OcTree to a binary stream.

The OcTree is first converted to the maximum likelihood estimate and pruned for maximum compression.

Returns
success of operation
bool octomap::AbstractOccupancyOcTree::writeBinaryConst ( const std::string &  filename) const

Writes OcTree to a binary file using writeBinaryConst().

The OcTree is not changed, in particular not pruned first. Files will be smaller when the tree is pruned first or by using writeBinary() instead.

Returns
success of operation

Referenced by ~AbstractOccupancyOcTree().

bool octomap::AbstractOccupancyOcTree::writeBinaryConst ( std::ostream &  s) const

Writes the maximum likelihood OcTree to a binary stream (const variant).

Files will be smaller when the tree is pruned first or by using writeBinary() instead.

Returns
success of operation
virtual std::ostream& octomap::AbstractOccupancyOcTree::writeBinaryData ( std::ostream &  s) const
pure virtual
virtual std::ostream& octomap::AbstractOcTree::writeData ( std::ostream &  s) const
pure virtualinherited

Member Data Documentation

const std::string octomap::AbstractOccupancyOcTree::binaryFileHeader
staticprotected

Definition at line 249 of file AbstractOccupancyOcTree.h.

float octomap::AbstractOccupancyOcTree::clamping_thres_max
protected
float octomap::AbstractOccupancyOcTree::clamping_thres_min
protected
const std::string octomap::AbstractOcTree::fileHeader
staticprotectedinherited

Definition at line 169 of file AbstractOcTree.h.

float octomap::AbstractOccupancyOcTree::occ_prob_thres_log
protected
float octomap::AbstractOccupancyOcTree::prob_hit_log
protected

Definition at line 245 of file AbstractOccupancyOcTree.h.

Referenced by getProbHit(), getProbHitLog(), and setProbHit().

float octomap::AbstractOccupancyOcTree::prob_miss_log
protected

Definition at line 246 of file AbstractOccupancyOcTree.h.

Referenced by getProbMiss(), getProbMissLog(), and setProbMiss().




Page generated by Doxygen 1.8.11 for MRPT 1.4.0 SVN:Unversioned directory at Mon Jul 4 10:31:07 UTC 2016