Go to the documentation of this file.00001 #ifndef MAP_INFLATION_TOOL_H
00002 #define MAP_INFLATION_TOOL_H
00003
00004 #include <queue>
00005
00006 #include <ros/ros.h>
00007 #include <nav2d_navigator/GridMap.h>
00008
00009 class CellData
00010 {
00011 public:
00012 CellData(double d, double i, unsigned int sx, unsigned int sy);
00013 double distance;
00014 unsigned int index;
00015 unsigned int sx, sy;
00016 };
00017
00018 inline bool operator<(const CellData &a, const CellData &b)
00019 {
00020 return a.distance > b.distance;
00021 }
00022
00023
00024 class MapInflationTool
00025 {
00026 public:
00027 MapInflationTool();
00028 ~MapInflationTool();
00029
00030 void computeCaches(unsigned int radius);
00031 void inflateMap(GridMap* map);
00032
00033 private:
00034 void enqueueObstacle(unsigned int index, unsigned int sx, unsigned int sy);
00035 inline double distanceLookup(int mx, int my, int src_x, int src_y);
00036 inline char costLookup(int mx, int my, int src_x, int src_y);
00037
00038 GridMap* mGridMap;
00039
00040 unsigned int mCellInflationRadius;
00041 char** mCachedCosts;
00042 double ** mCachedDistances;
00043
00044 std::priority_queue<CellData> mInflationQueue;
00045 unsigned char* mInflationMarkers;
00046
00047 char mCostObstacle;
00048
00049 };
00050
00051 #endif