MRXT: The Multi-Robot eXploration Tool
Multi-Robot autonomous exploration and mapping simulator.
|
00001 00002 #ifndef __LOCAL_POTENTIAL_FIELD__ 00003 #define __LOCAL_POTENTIAL_FIELD__ 00004 00005 #include "matFuns.h" 00006 00007 /** 00008 * @brief Local Potential Fields for reactive navigation 00009 * 00010 */ 00011 00012 class localPotentialField{ 00013 00014 private: 00015 00016 int width; 00017 int height; 00018 00019 matrix m; 00020 00021 public: 00022 00023 localPotentialField(); 00024 localPotentialField(int width, int height); 00025 localPotentialField(const localPotentialField &lff); 00026 virtual ~localPotentialField(); 00027 00028 localPotentialField& operator=(const localPotentialField&); 00029 localPotentialField operator*(const float&); 00030 localPotentialField operator+(const localPotentialField&); 00031 localPotentialField& operator+=(const localPotentialField&); 00032 localPotentialField& operator*=(const float&); 00033 00034 void set(int i, int j, float val); 00035 float get(int i, int j); 00036 00037 int getWidth(); 00038 int getHeight(); 00039 00040 void reset(); 00041 00042 /// Save function 00043 void savePotentialAsImage(char* file); 00044 void normalize(); 00045 00046 }; 00047 00048 inline float localPotentialField::get(int i, int j) {return (i>=0 && i<width && j>=0 && j<height)? m.get(i,j) : 0.0f;} 00049 inline void localPotentialField::set(int i, int j, float val) {if(i>=0 && i<width && j>=0 && j<height) m.set(i,j,val);} 00050 inline int localPotentialField::getWidth() {return width;} 00051 inline int localPotentialField::getHeight() {return height;} 00052 00053 #endif