sinecontroller.h

Go to the documentation of this file.
00001 /*************************************************************************** 00002 * Copyright (C) 2005 by Robot Group Leipzig * 00003 * martius@informatik.uni-leipzig.de * 00004 * fhesse@informatik.uni-leipzig.de * 00005 * der@informatik.uni-leipzig.de * 00006 * * 00007 * This program is free software; you can redistribute it and/or modify * 00008 * it under the terms of the GNU General Public License as published by * 00009 * the Free Software Foundation; either version 2 of the License, or * 00010 * (at your option) any later version. * 00011 * * 00012 * This program is distributed in the hope that it will be useful, * 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00015 * GNU General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU General Public License * 00018 * along with this program; if not, write to the * 00019 * Free Software Foundation, Inc., * 00020 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00021 * * 00022 * $Log: sinecontroller.h,v $ 00023 * Revision 1.10 2006/11/29 16:22:43 martius 00024 * name is a variable of configurable and is used as such 00025 * 00026 * Revision 1.9 2006/08/02 09:32:03 martius 00027 * store and restore according to storable interface 00028 * 00029 * Revision 1.8 2006/07/14 12:23:59 martius 00030 * selforg becomes HEAD 00031 * 00032 * Revision 1.6.6.5 2006/06/25 21:56:08 martius 00033 * configureable has name and revision 00034 * 00035 * Revision 1.6.6.4 2006/06/25 16:51:36 martius 00036 * configureable has name and revision 00037 * a robot is configureable by default 00038 * 00039 * Revision 1.6.6.3 2006/03/30 12:35:13 martius 00040 * documentation updated 00041 * 00042 * Revision 1.6.6.2 2006/01/18 16:48:35 martius 00043 * stored and restore 00044 * 00045 * Revision 1.6.6.1 2005/11/14 15:38:17 martius 00046 * moved to selforg 00047 * 00048 * Revision 1.6 2005/11/14 12:46:19 martius 00049 * added number of controlled motors 00050 * 00051 * Revision 1.5 2005/11/09 13:56:34 martius 00052 * const in instspectable functions 00053 * 00054 * Revision 1.4 2005/10/06 17:06:57 martius 00055 * switched to stl lists 00056 * 00057 * Revision 1.3 2005/08/06 20:47:54 martius 00058 * Commented 00059 * 00060 * Revision 1.2 2005/07/07 10:25:47 martius 00061 * added Phaseshift 00062 * 00063 * Revision 1.1 2005/07/06 13:55:33 fhesse 00064 * initial version, realising sine and cosine outputs 00065 * * 00066 * * 00067 ***************************************************************************/ 00068 #ifndef __SINECONTROLLER_H 00069 #define __SINECONTROLLER_H 00070 00071 00072 #include <stdio.h> 00073 #include "abstractcontroller.h" 00074 00075 /** 00076 * class for robot control with sine and cosine 00077 * 00078 * 00079 */ 00080 class SineController : public AbstractController { 00081 public: 00082 00083 SineController(int number_controlled=-1); 00084 00085 /** initialisation of the controller with the given sensor/ motornumber 00086 Must be called before use. 00087 */ 00088 virtual void init(int sensornumber, int motornumber); 00089 00090 /** @return Number of sensors the controller was initialised 00091 with or 0 if not initialised */ 00092 virtual int getSensorNumber() const {return number_sensors;} 00093 00094 00095 /** @return Number of motors the controller was initialised 00096 with or 0 if not initialised */ 00097 virtual int getMotorNumber() const {return number_motors;} 00098 00099 /** performs one step (includes learning). 00100 Calculates motor commands from sensor inputs. 00101 @param sensors sensors inputs scaled to [-1,1] 00102 @param sensornumber length of the sensor array 00103 @param motors motors outputs. MUST have enough space for motor values! 00104 @param motornumber length of the provided motor array 00105 */ 00106 virtual void step(const sensor* sensors, int sensornumber, 00107 motor* motors, int motornumber); 00108 /** performs one step without learning. 00109 @see step 00110 */ 00111 virtual void stepNoLearning(const sensor* , int number_sensors, 00112 motor* , int number_motors); 00113 00114 00115 virtual std::list<iparamkey> getInternalParamNames()const { return std::list<iparamkey>(); } 00116 00117 virtual std::list<iparamval> getInternalParams() const { return std::list<iparamval>(); } 00118 00119 00120 virtual paramval getParam(const paramkey& key) const; 00121 virtual bool setParam(const paramkey& key, paramval val); 00122 virtual paramlist getParamList() const ; 00123 00124 /********* STORABLE INTERFACE ******/ 00125 /// @see Storable 00126 virtual bool store(FILE* f) const { return true;}; // FIXME: store Parameter 00127 00128 /// @see Storable 00129 virtual bool restore(FILE* f) { return true;}; // FIXME: restore Parameter 00130 00131 00132 protected: 00133 00134 int t; 00135 std::string name; 00136 int number_sensors; 00137 int number_motors; 00138 int number_controlled; // number of motors that are controlled. The remaining are set to 0; 00139 00140 paramval sineRate; 00141 paramval phaseShift; 00142 }; 00143 00144 #endif

Generated on Tue Jan 16 02:14:38 2007 for Robotsystem of the Robot Group Leipzig by doxygen 1.3.8