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: motion_chain.h,v 1.2 2007/01/20 17:40:19 derek Exp $ 00020 00021 Modifications: 00022 1. removed const from operater [] and added reference to return type "motion& ..." 00023 previously, it was read only, and this prevented one from doing _mc[i]._x = 3; as 00024 the [] operator returned a read only copy. 00025 This opens up possible side-effects, but the efficiency benefits outweight the risks. 00026 (2006.01.12) 00027 */ 00028 00029 #ifndef __MOTION_CHAIN 00030 #define __MOTION_CHAIN 00031 const int MOTION_CHAIN_MAX = 199; // maximum path for 4x4 grid_map. 00032 #include "motion.h" 00033 #include "chain.h" 00034 using namespace std; 00036 class motion_chain : public chain 00037 { 00038 public: 00039 motion_chain(void); 00040 bool append(const motion&); 00041 bool append(int x, int y, atomic_rotation face, MOTION imotion); 00042 const motion serve(void); 00043 // void compress(void); // Takes 45/90 degree turns and replaces with CIRCULAR path based turns. 00044 void transform_real(void); 00045 motion& operator[](int); 00046 #ifdef DOS 00047 void print(void); 00048 #endif 00049 private: 00050 motion _motion_chain[MOTION_CHAIN_MAX]; 00051 }; 00052 00053 #endif
1.3