dynamicEDTOctomap.h
Go to the documentation of this file.
1 
9 /*
10  * Copyright (c) 2011-2012, C. Sprunk, B. Lau, W. Burgard, University of Freiburg
11  * All rights reserved.
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions are met:
15  *
16  * * Redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer.
18  * * Redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution.
21  * * Neither the name of the University of Freiburg nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35  * POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #ifndef DYNAMICEDTOCTOMAP_H_
39 #define DYNAMICEDTOCTOMAP_H_
40 
41 #include "dynamicEDT3D.h"
42 #include <octomap/OcTree.h>
43 #include <octomap/OcTreeStamped.h>
44 
46 template <class TREE>
48 public:
56  DynamicEDTOctomapBase(float maxdist, TREE* _octree, octomap::point3d bbxMin, octomap::point3d bbxMax, bool treatUnknownAsOccupied);
57 
58  virtual ~DynamicEDTOctomapBase();
59 
62  virtual void update(bool updateRealDist=true);
63 
66  void getDistanceAndClosestObstacle(const octomap::point3d& p, float &distance, octomap::point3d& closestObstacle) const;
67 
69  float getDistance(const octomap::point3d& p) const;
70 
72  float getDistance(const octomap::OcTreeKey& k) const;
73 
75  int getSquaredDistanceInCells(const octomap::point3d& p) const;
76 
77  //variant of getDistanceAndClosestObstacle that ommits the check whether p is inside the area of the distance map. Use only if you are certain that p is covered by the distance map and if you need to save the time of the check.
78  void getDistanceAndClosestObstacle_unsafe(const octomap::point3d& p, float &distance, octomap::point3d& closestObstacle) const;
79 
80  //variant of getDistance that ommits the check whether p is inside the area of the distance map. Use only if you are certain that p is covered by the distance map and if you need to save the time of the check.
81  float getDistance_unsafe(const octomap::point3d& p) const;
82 
83  //variant of getDistance that ommits the check whether p is inside the area of the distance map. Use only if you are certain that p is covered by the distance map and if you need to save the time of the check.
84  float getDistance_unsafe(const octomap::OcTreeKey& k) const;
85 
86  //variant of getSquaredDistanceInCells that ommits the check whether p is inside the area of the distance map. Use only if you are certain that p is covered by the distance map and if you need to save the time of the check.
88 
90  float getMaxDist() const {
91  return maxDist*octree->getResolution();
92  }
93 
95  int getSquaredMaxDistCells() const {
96  return maxDist_squared;
97  }
98 
100  bool checkConsistency() const;
101 
103  static float distanceValue_Error;
106 
107 private:
111 
112  void worldToMap(const octomap::point3d &p, int &x, int &y, int &z) const;
113  void mapToWorld(int x, int y, int z, octomap::point3d &p) const;
114  void mapToWorld(int x, int y, int z, octomap::OcTreeKey &key) const;
115 
116  TREE* octree;
123 };
124 
127 
128 #include "dynamicEDTOctomap.hxx"
129 
130 #endif /* DYNAMICEDTOCTOMAP_H_ */
DynamicEDTOctomapBase::getDistance
float getDistance(const octomap::point3d &p) const
retrieves distance at point. Returns DynamicEDTOctomapBase::distanceValue_Error if point is outside t...
DynamicEDTOctomapBase::distanceInCellsValue_Error
static int distanceInCellsValue_Error
distance value returned when requesting distance in cell units for a cell outside the map
Definition: dynamicEDTOctomap.h:105
DynamicEDTOctomapBase::offsetX
int offsetX
Definition: dynamicEDTOctomap.h:122
DynamicEDTOctomapBase::~DynamicEDTOctomapBase
virtual ~DynamicEDTOctomapBase()
DynamicEDTOctomapBase::treeResolution
double treeResolution
Definition: dynamicEDTOctomap.h:119
DynamicEDTOctomapStamped
DynamicEDTOctomapBase< octomap::OcTreeStamped > DynamicEDTOctomapStamped
Definition: dynamicEDTOctomap.h:126
DynamicEDTOctomapBase::getSquaredMaxDistCells
int getSquaredMaxDistCells() const
retrieve squared maximum distance value in grid cells
Definition: dynamicEDTOctomap.h:95
DynamicEDTOctomapBase::getMaxDist
float getMaxDist() const
retrieve maximum distance value
Definition: dynamicEDTOctomap.h:90
DynamicEDTOctomapBase::updateMaxDepthLeaf
void updateMaxDepthLeaf(octomap::OcTreeKey &key, bool occupied)
DynamicEDTOctomapBase::getSquaredDistanceInCells
int getSquaredDistanceInCells(const octomap::point3d &p) const
retrieves squared distance in cells at point. Returns DynamicEDTOctomapBase::distanceInCellsValue_Err...
DynamicEDTOctomap
DynamicEDTOctomapBase< octomap::OcTree > DynamicEDTOctomap
Definition: dynamicEDTOctomap.h:125
DynamicEDTOctomapBase::distanceValue_Error
static float distanceValue_Error
distance value returned when requesting distance for a cell outside the map
Definition: dynamicEDTOctomap.h:103
DynamicEDTOctomapBase::getSquaredDistanceInCells_unsafe
int getSquaredDistanceInCells_unsafe(const octomap::point3d &p) const
DynamicEDT3D::maxDist_squared
int maxDist_squared
Definition: dynamicEDT3D.h:146
OcTree.h
octomath::Vector3
DynamicEDTOctomapBase::getDistance_unsafe
float getDistance_unsafe(const octomap::point3d &p) const
DynamicEDTOctomapBase::mapToWorld
void mapToWorld(int x, int y, int z, octomap::point3d &p) const
DynamicEDTOctomapBase::boundingBoxMinKey
octomap::OcTreeKey boundingBoxMinKey
Definition: dynamicEDTOctomap.h:120
DynamicEDTOctomapBase::offsetY
int offsetY
Definition: dynamicEDTOctomap.h:122
DynamicEDTOctomapBase::insertMaxDepthLeafAtInitialize
void insertMaxDepthLeafAtInitialize(octomap::OcTreeKey key)
DynamicEDT3D::maxDist
double maxDist
Definition: dynamicEDT3D.h:145
octomap::OcTreeKey
DynamicEDTOctomapBase
A DynamicEDTOctomapBase object connects a DynamicEDT3D object to an octomap.
Definition: dynamicEDTOctomap.h:47
DynamicEDTOctomapBase::getDistanceAndClosestObstacle
void getDistanceAndClosestObstacle(const octomap::point3d &p, float &distance, octomap::point3d &closestObstacle) const
DynamicEDT3D::occupied
@ occupied
Definition: dynamicEDT3D.h:104
dynamicEDT3D.h
DynamicEDTOctomapBase::DynamicEDTOctomapBase
DynamicEDTOctomapBase(float maxdist, TREE *_octree, octomap::point3d bbxMin, octomap::point3d bbxMax, bool treatUnknownAsOccupied)
DynamicEDTOctomapBase::initializeOcTree
void initializeOcTree(octomap::point3d bbxMin, octomap::point3d bbxMax)
OcTreeStamped.h
DynamicEDTOctomapBase::treeDepth
int treeDepth
Definition: dynamicEDTOctomap.h:118
DynamicEDT3D
A DynamicEDT3D object computes and updates a 3D distance map.
Definition: dynamicEDT3D.h:47
DynamicEDTOctomapBase::update
virtual void update(bool updateRealDist=true)
DynamicEDTOctomapBase::offsetZ
int offsetZ
Definition: dynamicEDTOctomap.h:122
DynamicEDTOctomapBase::worldToMap
void worldToMap(const octomap::point3d &p, int &x, int &y, int &z) const
DynamicEDTOctomapBase::getDistanceAndClosestObstacle_unsafe
void getDistanceAndClosestObstacle_unsafe(const octomap::point3d &p, float &distance, octomap::point3d &closestObstacle) const
DynamicEDTOctomapBase::unknownOccupied
bool unknownOccupied
Definition: dynamicEDTOctomap.h:117
DynamicEDTOctomapBase::boundingBoxMaxKey
octomap::OcTreeKey boundingBoxMaxKey
Definition: dynamicEDTOctomap.h:121
DynamicEDTOctomapBase::octree
TREE * octree
Definition: dynamicEDTOctomap.h:116
DynamicEDTOctomapBase::checkConsistency
bool checkConsistency() const
Brute force method used for debug purposes. Checks occupancy state consistency between octomap and in...


dynamicEDT3D
Author(s): Christoph Sprunk
autogenerated on Tue Dec 12 2023 03:39:46