octomap 1.9.8
Loading...
Searching...
No Matches
octomap::AbstractOccupancyOcTree Class Referenceabstract

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

#include <AbstractOccupancyOcTree.h>

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) const =0
virtual void getMetricMax (double &x, double &y, double &z)=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 probability for a "hit" (will be converted to logodds) - sensor model
void setProbMiss (double prob)
 sets the probability 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 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.
virtual OcTreeNodeupdateNode (const point3d &value, float log_odds_update, bool lazy_eval=false)=0
 Manipulate log_odds value of voxel directly.
bool write (const std::string &filename) const
 Write file header and complete tree to file (serialization)
bool write (std::ostream &s) const
 Write file header and complete tree to stream (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 (const std::string &filename) const
 Writes OcTree to a binary file using writeBinaryConst().
bool writeBinaryConst (std::ostream &s) const
 Writes the maximum likelihood OcTree to a binary stream (const variant).
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. Pruning the tree first produces smaller files (lossless compression)
virtual ~AbstractOccupancyOcTree ()

Static Public Member Functions

static AbstractOcTreecreateTree (const std::string id, double res)
 Creates a certain OcTree (factory pattern)
static AbstractOcTreeread (const std::string &filename)
 Read the file header, create the appropriate class and deserialize.
static AbstractOcTreeread (std::istream &s)
 Read the file header, create the appropriate class and deserialize. This creates a new octree which you need to delete yourself.

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

◆ AbstractOccupancyOcTree()

octomap::AbstractOccupancyOcTree::AbstractOccupancyOcTree ( )

◆ ~AbstractOccupancyOcTree()

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

Member Function Documentation

◆ clear()

◆ create()

virtual AbstractOcTree * octomap::AbstractOcTree::create ( ) const
pure virtualinherited

virtual constructor: creates a new object of same type

Implemented in octomap::ColorOcTree, octomap::OcTree, octomap::OcTreeBase< NODE >, octomap::OcTreeBase< CountingOcTreeNode >, and octomap::OcTreeStamped.

References AbstractOcTree().

◆ createTree()

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!

References AbstractOcTree(), OCTOMAP_ERROR, and setResolution().

◆ expand()

◆ getClampingThresMax()

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

References clamping_thres_max, and octomap::probability().

Referenced by main().

◆ getClampingThresMaxLog()

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

References clamping_thres_max.

◆ getClampingThresMin()

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

References clamping_thres_min, and octomap::probability().

Referenced by main().

◆ getClampingThresMinLog()

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

References clamping_thres_min.

◆ getMetricMax() [1/2]

virtual void octomap::AbstractOcTree::getMetricMax ( double & x,
double & y,
double & z ) const
pure virtualinherited

◆ getMetricMax() [2/2]

◆ getMetricMin() [1/2]

virtual void octomap::AbstractOcTree::getMetricMin ( double & x,
double & y,
double & z ) const
pure virtualinherited

◆ getMetricMin() [2/2]

◆ getMetricSize()

◆ getOccupancyThres()

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

References occ_prob_thres_log, and octomap::probability().

◆ getOccupancyThresLog()

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

References occ_prob_thres_log.

◆ getProbHit()

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

References prob_hit_log, and octomap::probability().

Referenced by main().

◆ getProbHitLog()

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

References prob_hit_log.

◆ getProbMiss()

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

References prob_miss_log, and octomap::probability().

Referenced by main().

◆ getProbMissLog()

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

References prob_miss_log.

◆ getResolution()

◆ getTreeType()

◆ isNodeAtThreshold() [1/2]

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 octomap::OcTreeNode::getLogOdds().

◆ isNodeAtThreshold() [2/2]

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 octomap::OcTreeNode::getLogOdds().

Referenced by calcThresholdedNodes().

◆ isNodeOccupied() [1/2]

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

◆ isNodeOccupied() [2/2]

◆ memoryUsage()

◆ memoryUsageNode()

◆ prune()

◆ read() [1/2]

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);
AbstractOcTree()
Definition AbstractOcTree.cpp:41
static AbstractOcTree * read(const std::string &filename)
Read the file header, create the appropriate class and deserialize.
Definition AbstractOcTree.cpp:74
octomap main map data structure, stores 3D occupancy grid map in an OcTree.
Definition OcTree.h:49

References AbstractOcTree(), OCTOMAP_ERROR_STR, and read().

Referenced by main(), main(), and read().

◆ read() [2/2]

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.

References AbstractOcTree(), fileHeader, OCTOMAP_DEBUG_STR, OCTOMAP_ERROR_STR, readHeader(), and size().

◆ readBinary() [1/2]

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

◆ readBinary() [2/2]

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

◆ readBinaryData()

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

◆ readBinaryLegacyHeader()

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::size().

Referenced by readBinary().

◆ readData()

virtual std::istream & octomap::AbstractOcTree::readData ( std::istream & s)
pure virtualinherited

◆ readHeader()

bool octomap::AbstractOcTree::readHeader ( std::istream & s,
std::string & id,
unsigned & size,
double & res )
staticprotectedinherited

◆ registerTreeType()

◆ setClampingThresMax()

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(), and main().

◆ setClampingThresMin()

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(), and main().

◆ setOccupancyThres()

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(), and main().

◆ setProbHit()

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

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

References octomap::logodds(), and prob_hit_log.

Referenced by AbstractOccupancyOcTree(), and main().

◆ setProbMiss()

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

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

References octomap::logodds(), and prob_miss_log.

Referenced by AbstractOccupancyOcTree(), and main().

◆ setResolution()

◆ size()

◆ toMaxLikelihood()

◆ updateNode() [1/4]

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

◆ updateNode() [2/4]

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

◆ updateNode() [3/4]

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

◆ updateNode() [4/4]

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

◆ write() [1/2]

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

Write file header and complete tree to file (serialization)

References OCTOMAP_ERROR_STR, and write().

Referenced by main(), main(), and write().

◆ write() [2/2]

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

Write file header and complete tree to stream (serialization)

References fileHeader, getResolution(), getTreeType(), size(), and writeData().

◆ writeBinary() [1/2]

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, and writeBinary().

Referenced by main(), main(), and writeBinary().

◆ writeBinary() [2/2]

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

◆ writeBinaryConst() [1/2]

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 writeBinary().

◆ writeBinaryConst() [2/2]

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

◆ writeBinaryData()

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

◆ writeData()

virtual std::ostream & octomap::AbstractOcTree::writeData ( std::ostream & s) const
pure virtualinherited

Field Documentation

◆ binaryFileHeader

const std::string octomap::AbstractOccupancyOcTree::binaryFileHeader = "# Octomap OcTree binary file"
staticprotected

Referenced by readBinary().

◆ clamping_thres_max

◆ clamping_thres_min

◆ fileHeader

const std::string octomap::AbstractOcTree::fileHeader = "# Octomap OcTree file"
staticprotectedinherited

Referenced by read(), and write().

◆ occ_prob_thres_log

float octomap::AbstractOccupancyOcTree::occ_prob_thres_log
protected

◆ prob_hit_log

◆ prob_miss_log


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