Go to the documentation of this file.00001 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
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         
00076         void getDistanceAndClosestObstacle_unsafe(const octomap::point3d& p, float &distance, octomap::point3d& closestObstacle) const;
00077 
00078         
00079         float getDistance_unsafe(const octomap::point3d& p) const;
00080 
00081         
00082         float getDistance_unsafe(const octomap::OcTreeKey& k) const;
00083 
00084         
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