00001 /* 00002 Object Oriented Mobile Robot Model (OOMRM) C++ Library Copyright (C) 2002-2005 Derek Jones 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Lesser General Public 00006 License as published by the Free Software Foundation; either 00007 version 2.1 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Lesser General Public License for more details. 00013 00014 You should have received a copy of the GNU Lesser General Public 00015 License along with this library; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 00019 * $Id: occupancy_grid.h,v 1.2 2006/07/16 06:11:15 derek Exp $ 00020 */ 00021 00022 #ifndef OCCUPANCY_GRID 00023 #define OCCUPANCY_GRID 00024 #include <types.h> 00025 //#include <circle_obstacle_chain.h> 00026 // 30x350 with 4" cells gives about 10'x 116' 00027 // 35x3"= 8.75' x 00028 // 440 x3" = 110' 00029 //#define GRIDX 35 00030 //#define GRIDY 440 00031 //#define MAPCELL(i,j) ((j*GRIDX+i)/2) 00032 /* 00033 struct ONode 00034 { 00035 //public: 00036 uint8 _obstacle; 00038 uint8 _layer; 00039 }; 00040 struct map_grid 00041 { 00042 ONode get(int ix,int iy); 00043 ONode cell[GRIDX][GRIDY]; 00044 }; 00045 */ 00047 00056 class OGrid 00057 { 00058 public: 00059 OGrid(void); 00060 static void map_reset(short iwidth, short iheight); 00061 static uint8 obstacle(int i, int j); 00062 static uint8 layer(int i, int j); 00063 static void wall(int x, int y, uint8 ctype, uint8 layer=0); 00064 static void initialize(void); 00065 static int debug(int i, int j); 00066 static int get_debug(int); 00067 static void set_debug(int, int); 00068 // Returns whether cell contained within path area. 00069 static uint8 pathflag(int x, int y); 00071 static void pathflag(int x, int y, uint8 v); 00073 static void clear_pathflag(void); 00074 #ifdef DOS 00075 00076 static void path(int x, int y, uint8 v); 00077 static uint8 path(int x, int y); 00078 #endif 00079 // for optimization. Can be dynamically reset, but not persistent. 00080 static short _map_width; 00081 static short _map_height; 00082 private: 00083 }; 00084 00085 #endif
1.3