Go to the documentation of this file.00001
00046 #ifndef MAPEXTRACTOR_H
00047 #define MAPEXTRACTOR_H
00048
00049 #include <octomap/OcTree.h>
00050
00051 namespace roboearth {
00052
00053 struct Orientation {
00054 double x;
00055 double y;
00056 double yaw;
00057 };
00058
00059 struct OccupancyGrid {
00060 unsigned int width;
00061 unsigned int height;
00062 double resolution;
00063 Orientation orientation;
00064 std::vector<char> data;
00065 };
00066
00067 class MapExtractor {
00068
00069 public:
00070 MapExtractor(const std::string& octomapFilename);
00071 virtual ~MapExtractor();
00072 bool save2dMap(const std::string& mapName, double z, bool filterSpeckles,
00073 double minSizeX = 0, double minSizeY = 0);
00074 bool save2dMap(const std::string& mapName, double minZ, double maxZ,
00075 bool filterSpeckles, double minSizeX = 0, double minSizeY = 0);
00076
00077 protected:
00078 void resetOctomap();
00079 bool isSpeckleNode(const octomap::OcTreeKey& nKey) const;
00080 bool calc2dSlice(double occupancyMinZ, double occupancyMaxZ,
00081 bool filterSpeckles, double minSizeX, double minSizeY);
00082
00083 OccupancyGrid *m_gridmap;
00084 octomap::OcTree *m_octoMap;
00085 double m_res;
00086 unsigned int m_treeDepth;
00087 };
00088
00089 }
00090
00091 #endif