OcTreeNode.h
Go to the documentation of this file.
1 /*
2  * OctoMap - An Efficient Probabilistic 3D Mapping Framework Based on Octrees
3  * http://octomap.github.com/
4  *
5  * Copyright (c) 2009-2013, K.M. Wurm and A. Hornung, University of Freiburg
6  * All rights reserved.
7  * License: New BSD
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the distribution.
17  * * Neither the name of the University of Freiburg nor the names of its
18  * contributors may be used to endorse or promote products derived from
19  * this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef OCTOMAP_OCTREE_NODE_H
35 #define OCTOMAP_OCTREE_NODE_H
36 
37 #include "octomap_types.h"
38 #include "octomap_utils.h"
39 #include "OcTreeDataNode.h"
40 #include <limits>
41 
42 namespace octomap {
43 
55  class OcTreeNode : public OcTreeDataNode<float> {
56 
57  public:
58  OcTreeNode();
59  ~OcTreeNode();
60 
61  bool createChild(unsigned int i);
62 
63  // overloaded, so that the return type is correct:
64  inline OcTreeNode* getChild(unsigned int i) {
65  return static_cast<OcTreeNode*> (OcTreeDataNode<float>::getChild(i));
66  }
67  inline const OcTreeNode* getChild(unsigned int i) const {
68  return static_cast<const OcTreeNode*> (OcTreeDataNode<float>::getChild(i));
69  }
70 
71  // -- node occupancy ----------------------------
72 
74  inline double getOccupancy() const { return probability(value); }
75 
77  inline float getLogOdds() const{ return value; }
79  inline void setLogOdds(float l) { value = l; }
80 
84  double getMeanChildLogOdds() const;
85 
89  float getMaxChildLogOdds() const;
90 
92  inline void updateOccupancyChildren() {
93  this->setLogOdds(this->getMaxChildLogOdds()); // conservative
94  }
95 
97  void addValue(const float& p);
98 
99 
100  protected:
101  // "value" stores log odds occupancy probability
102  };
103 
104 } // end namespace
105 
106 #endif
const OcTreeNode * getChild(unsigned int i) const
Definition: OcTreeNode.h:67
float value
stored data (payload)
OcTreeDataNode< T > * getChild(unsigned int i)
OcTreeNode * getChild(unsigned int i)
Definition: OcTreeNode.h:64
float getMaxChildLogOdds() const
Definition: OcTreeNode.cpp:82
double probability(double logodds)
compute probability from logodds:
Definition: octomap_utils.h:47
void updateOccupancyChildren()
update this node&#39;s occupancy according to its children&#39;s maximum occupancy
Definition: OcTreeNode.h:92
bool createChild(unsigned int i)
Definition: OcTreeNode.cpp:54
void addValue(const float &p)
adds p to the node&#39;s logOdds value (with no boundary / threshold checking!)
Definition: OcTreeNode.cpp:94
void setLogOdds(float l)
sets log odds occupancy of node
Definition: OcTreeNode.h:79
float getLogOdds() const
Definition: OcTreeNode.h:77
double getMeanChildLogOdds() const
Definition: OcTreeNode.cpp:67
double getOccupancy() const
Definition: OcTreeNode.h:74


octomap
Author(s): Kai M. Wurm , Armin Hornung
autogenerated on Mon Jun 10 2019 14:00:13