octomap 1.5.0
octomap::AbstractOccupancyOcTree Class Reference

Interface class for all octree types that store occupancy. More...

Inheritance diagram for octomap::AbstractOccupancyOcTree:
Collaboration diagram for octomap::AbstractOccupancyOcTree:

Public Member Functions

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

Static Public Member Functions

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

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.

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_max
float clamping_thres_min
float occ_prob_thres_log
float prob_hit_log
float prob_miss_log

Static Protected Attributes

static const std::string binaryFileHeader = "# Octomap OcTree binary file"
static const std::string fileHeader = "# Octomap OcTree file"

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.


Constructor & Destructor Documentation

octomap::AbstractOccupancyOcTree::AbstractOccupancyOcTree ( )
virtual octomap::AbstractOccupancyOcTree::~AbstractOccupancyOcTree ( ) [inline, virtual]

Member Function Documentation

virtual AbstractOcTree* octomap::AbstractOcTree::create ( ) const [pure virtual, inherited]

virtual constructor: creates a new object of same type

Implemented in octomap::OcTreeBase< NODE >.

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

AbstractOcTree * octomap::AbstractOcTree::createTree ( const std::string  id,
double  res 
) [static, inherited]

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!

References octomap::AbstractOcTree::create(), OCTOMAP_ERROR, and octomap::AbstractOcTree::setResolution().

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

double octomap::AbstractOccupancyOcTree::getClampingThresMax ( ) const [inline]
Returns:
maximum threshold for occupancy clamping in the sensor model (probability)

References clamping_thres_max, and octomap::probability().

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

References clamping_thres_max.

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

References clamping_thres_min, and octomap::probability().

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

References clamping_thres_min.

double octomap::AbstractOccupancyOcTree::getOccupancyThres ( ) const [inline]
Returns:
threshold (probability) for occupancy - sensor model

References occ_prob_thres_log, and octomap::probability().

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

References occ_prob_thres_log.

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

References prob_hit_log, and octomap::probability().

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

References prob_hit_log.

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

References prob_miss_log, and octomap::probability().

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

References prob_miss_log.

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

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

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

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

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

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

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"

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

AbstractOcTree * octomap::AbstractOcTree::read ( std::istream &  s) [static, inherited]

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

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

References octomap::AbstractOcTree::createTree(), octomap::AbstractOcTree::fileHeader, OCTOMAP_DEBUG_STR, OCTOMAP_ERROR_STR, octomap::AbstractOcTree::readData(), octomap::AbstractOcTree::readHeader(), and octomap::AbstractOcTree::size().

AbstractOcTree * octomap::AbstractOcTree::read ( const std::string &  filename) [static, inherited]

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);

References OCTOMAP_ERROR_STR.

bool octomap::AbstractOccupancyOcTree::readBinary ( std::istream &  s)
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

References OCTOMAP_ERROR_STR, and readBinary().

virtual std::istream& octomap::AbstractOccupancyOcTree::readBinaryData ( std::istream &  s) [pure virtual]

Reads the actual data, implemented in OccupancyOcTreeBase::readBinaryData()

Implemented in octomap::OccupancyOcTreeBase< NODE >.

Referenced by readBinary().

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.

References octomap::AbstractOcTree::clear(), OCTOMAP_ERROR, OCTOMAP_ERROR_STR, and OCTOMAP_WARNING_STR.

Referenced by readBinary().

virtual std::istream& octomap::AbstractOcTree::readData ( std::istream &  s) [pure virtual, inherited]
bool octomap::AbstractOcTree::readHeader ( std::istream &  s,
std::string &  id,
unsigned &  size,
double &  res 
) [static, protected, inherited]
void octomap::AbstractOccupancyOcTree::setClampingThresMax ( double  thresProb) [inline]

sets the maximum threshold for occupancy clamping (sensor model)

References clamping_thres_max, and octomap::logodds().

Referenced by AbstractOccupancyOcTree().

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

sets the minimum threshold for occupancy clamping (sensor model)

References clamping_thres_min, and octomap::logodds().

Referenced by AbstractOccupancyOcTree().

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

sets the threshold for occupancy (sensor model)

References octomap::logodds(), and occ_prob_thres_log.

Referenced by AbstractOccupancyOcTree().

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

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

References octomap::logodds(), and prob_hit_log.

Referenced by AbstractOccupancyOcTree().

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

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

References octomap::logodds(), and prob_miss_log.

Referenced by AbstractOccupancyOcTree().

virtual void octomap::AbstractOccupancyOcTree::toMaxLikelihood ( ) [pure virtual]

Implemented in octomap::OccupancyOcTreeBase< NODE >.

Referenced by writeBinary().

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 >.

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 >.

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 >.

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 >.

bool octomap::AbstractOcTree::write ( std::ostream &  s) const [inherited]
bool octomap::AbstractOcTree::write ( const std::string &  filename) const [inherited]

Write file header and complete tree to file (serialization)

References OCTOMAP_ERROR_STR.

Referenced by main().

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

References octomap::AbstractOcTree::prune(), toMaxLikelihood(), and writeBinaryConst().

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

References OCTOMAP_ERROR_STR.

Referenced by main().

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

References binaryFileHeader, octomap::AbstractOcTree::getResolution(), octomap::AbstractOcTree::getTreeType(), OCTOMAP_DEBUG, OCTOMAP_WARNING_STR, octomap::AbstractOcTree::size(), and writeBinaryData().

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

References OCTOMAP_ERROR_STR.

Referenced by writeBinary().

virtual std::ostream& octomap::AbstractOccupancyOcTree::writeBinaryData ( std::ostream &  s) const [pure virtual]

Writes the actual data, implemented in OccupancyOcTreeBase::writeBinaryData()

Implemented in octomap::OccupancyOcTreeBase< NODE >.

Referenced by writeBinaryConst().

virtual std::ostream& octomap::AbstractOcTree::writeData ( std::ostream &  s) const [pure virtual, inherited]

Field Documentation

const std::string octomap::AbstractOccupancyOcTree::binaryFileHeader = "# Octomap OcTree binary file" [static, protected]

Referenced by readBinary(), and writeBinaryConst().

const std::string octomap::AbstractOcTree::fileHeader = "# Octomap OcTree file" [static, protected, inherited]

The documentation for this class was generated from the following files: