dynamicEDTOctomap.h
Go to the documentation of this file.
00001 
00009 /*
00010  * Copyright (c) 2011-2012, C. Sprunk, B. Lau, W. Burgard, University of Freiburg
00011  * All rights reserved.
00012  *
00013  * Redistribution and use in source and binary forms, with or without
00014  * modification, are permitted provided that the following conditions are met:
00015  *
00016  *     * Redistributions of source code must retain the above copyright
00017  *       notice, this list of conditions and the following disclaimer.
00018  *     * Redistributions in binary form must reproduce the above copyright
00019  *       notice, this list of conditions and the following disclaimer in the
00020  *       documentation and/or other materials provided with the distribution.
00021  *     * Neither the name of the University of Freiburg nor the names of its
00022  *       contributors may be used to endorse or promote products derived from
00023  *       this software without specific prior written permission.
00024  *
00025  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00026  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00027  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00028  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00029  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00030  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00031  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00032  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00033  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00034  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00035  * POSSIBILITY OF SUCH DAMAGE.
00036  */
00037 
00038 #ifndef DYNAMICEDTOCTOMAP_H_
00039 #define DYNAMICEDTOCTOMAP_H_
00040 
00041 #include "dynamicEDT3D.h"
00042 #include <octomap/OcTree.h>
00043 
00045 class DynamicEDTOctomap: private DynamicEDT3D {
00046 public:
00054         DynamicEDTOctomap(float maxdist, octomap::OcTree* _octree, octomap::point3d bbxMin, octomap::point3d bbxMax, bool treatUnknownAsOccupied);
00055 
00056         virtual ~DynamicEDTOctomap();
00057 
00060         virtual void update(bool updateRealDist=true);
00061 
00064         void getDistanceAndClosestObstacle(const octomap::point3d& p, float &distance, octomap::point3d& closestObstacle) const;
00065 
00067         float getDistance(const octomap::point3d& p) const;
00068 
00070         float getDistance(const octomap::OcTreeKey& k) const;
00071 
00073         int getSquaredDistanceInCells(const octomap::point3d& p) const;
00074 
00075         //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.
00076         void getDistanceAndClosestObstacle_unsafe(const octomap::point3d& p, float &distance, octomap::point3d& closestObstacle) const;
00077 
00078         //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.
00079         float getDistance_unsafe(const octomap::point3d& p) const;
00080 
00081         //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.
00082         float getDistance_unsafe(const octomap::OcTreeKey& k) const;
00083 
00084         //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.
00085         int getSquaredDistanceInCells_unsafe(const octomap::point3d& p) const;
00086 
00088         float getMaxDist() const {
00089           return maxDist*octree->getResolution();
00090         }
00091 
00093         int getSquaredMaxDistCells() const {
00094           return maxDist_squared;
00095         }
00096 
00098         bool checkConsistency() const;
00099 
00101         static float distanceValue_Error;
00103         static int distanceInCellsValue_Error;
00104 
00105 private:
00106         void initializeOcTree(octomap::point3d bbxMin, octomap::point3d bbxMax);
00107         void insertMaxDepthLeafAtInitialize(octomap::OcTreeKey key);
00108         void updateMaxDepthLeaf(octomap::OcTreeKey& key, bool occupied);
00109 
00110         void worldToMap(const octomap::point3d &p, int &x, int &y, int &z) const;
00111         void mapToWorld(int x, int y, int z, octomap::point3d &p) const;
00112         void mapToWorld(int x, int y, int z, octomap::OcTreeKey &key) const;
00113 
00114         octomap::OcTree* octree;
00115         bool unknownOccupied;
00116         int treeDepth;
00117         double treeResolution;
00118         octomap::OcTreeKey boundingBoxMinKey;
00119         octomap::OcTreeKey boundingBoxMaxKey;
00120         int offsetX, offsetY, offsetZ;
00121 };
00122 
00123 #endif /* DYNAMICEDTOCTOMAP_H_ */


dynamicEDT3D
Author(s): Christoph Sprunk
autogenerated on Thu Feb 11 2016 23:51:18