Main Page   Hardware Class Hierarchy   Hardware API     Mapping Class Hierarchy  Mapping API 

grid.h

Go to the documentation of this file.
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: grid.h,v 1.1.1.1 2006/05/11 05:22:45 derek Exp $
00020 */
00021 
00022 #ifndef _GRID_H
00023 #define _GRID_H
00024 #include <cell.h>
00025 #include <pose_chain.h>
00026 #include <motion_chain.h>
00027 //const short BRANCHES = 8; // 4=traditional; 8=octagonal etc.
00028 // XXX specific motorola
00029 #include <types.h>
00031 
00056 class grid
00057 {
00058 public:
00059   grid(void); 
00060   grid(int x, int y); 
00061   CELL_STATE state(int x, int y) const; 
00062 
00063   CELL_STATE heading(int x, int y, atomic_rotation) const;
00064 //  atomic_rotation facing(int x, int y) const;
00066 
00075   void solve_maze(int cx, int cy, atomic_rotation face, const pose_chain& waypoints, int itarget, motion_chain& path, bool obstacles);
00077   void wall(int x, int y, CELL_STATE ctype);
00079   int height(void) const;
00081   int width(void) const;
00083   void save_rom_map(long ROM_ADDRESS) const;
00085   void load_rom_map(long ROM_ADDRESS);
00087   bool obstacles(void);
00089   void branches(short);
00090 private:
00091   CELL_TYPE value(int x, int y) const;
00092   void whipitgood(motion_chain& path);
00093   void generate_bellman_matrix(void);
00094   void update_frontiers(int,int, atomic_rotation);
00095   void process_frontiers(int,int);
00096   bool unique_frontier(int, int);
00097   void traverse_back2goal(motion_chain& path);
00098 //  bool check_heading(atomic_rotation AR,int x, int y, int& min, int& tx, int& ty, int dx, int dy, atomic_rotation& face);
00099   bool check_heading(atomic_rotation AR,int x, int y, int& imin);
00100   pose_chain _frontiers;
00101   pose_chain _visited;
00102   void init(void);
00103   void reinit(void);
00104   maze_cell _maze[22][22];
00105   int _starting_x;
00106   int _starting_y;
00107   int _starting_face;
00108   int _destination_x;
00109   int _destination_y;
00110   atomic_rotation _destination_face; // FACING
00111   atomic_rotation _new_face;    // FACING
00112   int _new_x;
00113   int _new_y;
00114 //  foo _init_function;
00115   int _size_x;
00116   int _size_y;
00117   bool _done;
00118   bool _obstacles;
00119   short BRANCHES;
00120 };
00121 
00122 #endif

Generated on Mon Oct 8 19:32:18 2007 for OOMRM Mapping API by doxygen1.3