OcTreeStamped.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_STAMPED_H
35 #define OCTOMAP_OCTREE_STAMPED_H
36 
37 
38 #include <octomap/OcTreeNode.h>
40 #include <ctime>
41 
42 namespace octomap {
43 
44  // node definition
45  class OcTreeNodeStamped : public OcTreeNode {
46 
47  public:
49 
51 
52  bool operator==(const OcTreeNodeStamped& rhs) const{
53  return (rhs.value == value && rhs.timestamp == timestamp);
54  }
55 
56  void copyData(const OcTreeNodeStamped& from){
58  timestamp = from.getTimestamp();
59  }
60 
61  // timestamp
62  inline unsigned int getTimestamp() const { return timestamp; }
63  inline void updateTimestamp() { timestamp = (unsigned int) time(NULL);}
64  inline void setTimestamp(unsigned int timestamp) {this->timestamp = timestamp; }
65 
66  // update occupancy and timesteps of inner nodes
67  inline void updateOccupancyChildren() {
68  this->setLogOdds(this->getMaxChildLogOdds()); // conservative
70  }
71 
72  protected:
73  unsigned int timestamp;
74  };
75 
76 
77  // tree definition
78  class OcTreeStamped : public OccupancyOcTreeBase <OcTreeNodeStamped> {
79 
80  public:
82  OcTreeStamped(double resolution);
83 
86  OcTreeStamped* create() const {return new OcTreeStamped(resolution); }
87 
88  std::string getTreeType() const {return "OcTreeStamped";}
89 
91  unsigned int getLastUpdateTime();
92 
93  void degradeOutdatedNodes(unsigned int time_thres);
94 
95  virtual void updateNodeLogOdds(OcTreeNodeStamped* node, const float& update) const;
96  void integrateMissNoTime(OcTreeNodeStamped* node) const;
97 
98  protected:
107  public:
109  OcTreeStamped* tree = new OcTreeStamped(0.1);
110  tree->clearKeyRays();
112  }
113 
119  void ensureLinking() {};
120  };
123 
124  };
125 
126 } // end namespace
127 
128 #endif
static void registerTreeType(AbstractOcTree *tree)
T value
stored data (payload)
static StaticMemberInitializer ocTreeStampedMemberInit
to ensure static initialization (only once)
float getMaxChildLogOdds() const
Definition: OcTreeNode.cpp:76
void setLogOdds(float l)
sets log odds occupancy of node
Definition: OcTreeNode.h:70
void setTimestamp(unsigned int timestamp)
Definition: OcTreeStamped.h:64
OcTreeNodeStamped(const OcTreeNodeStamped &rhs)
Definition: OcTreeStamped.h:50
void copyData(const OcTreeDataNode &from)
OcTreeStamped * create() const
Definition: OcTreeStamped.h:86
void copyData(const OcTreeNodeStamped &from)
Definition: OcTreeStamped.h:56
bool operator==(const OcTreeNodeStamped &rhs) const
Definition: OcTreeStamped.h:52
unsigned int getTimestamp() const
Definition: OcTreeStamped.h:62
std::string getTreeType() const
returns actual class name as string for identification
Definition: OcTreeStamped.h:88


octomap
Author(s): Kai M. Wurm , Armin Hornung
autogenerated on Mon Feb 28 2022 22:58:06