simplecontroller.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 * frankguettler@gmx.de * 00007 * * 00008 * This program is free software; you can redistribute it and/or modify * 00009 * it under the terms of the GNU General Public License as published by * 00010 * the Free Software Foundation; either version 2 of the License, or * 00011 * (at your option) any later version. * 00012 * * 00013 * This program is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00016 * GNU General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU General Public License * 00019 * along with this program; if not, write to the * 00020 * Free Software Foundation, Inc., * 00021 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00022 * * 00023 * $Log: simplecontroller.h,v $ 00024 * Revision 1.7 2006/07/14 12:23:46 martius 00025 * selforg becomes HEAD 00026 * 00027 * Revision 1.5.4.2 2006/03/30 12:35:03 martius 00028 * documentation updated 00029 * 00030 * Revision 1.5.4.1 2005/11/15 12:29:39 martius 00031 * new selforg structure and OdeAgent, OdeRobot ... 00032 * 00033 * Revision 1.5 2005/10/17 13:17:10 martius 00034 * converted to new list's 00035 * 00036 * Revision 1.4 2005/10/17 13:07:57 robot3 00037 * std lists included 00038 * 00039 * Revision 1.3 2005/10/17 13:05:47 robot3 00040 * std lists included 00041 * 00042 * Revision 1.2 2005/08/09 11:06:30 robot1 00043 * camera module included 00044 * 00045 * Revision 1.1 2005/08/08 11:14:54 robot1 00046 * simple control for moving robot with keyboard 00047 * 00048 * * 00049 * * 00050 ***************************************************************************/ 00051 #ifndef __SIMPLECONTROLLER_H 00052 #define __SIMPLECONTROLLER_H 00053 00054 00055 #include <stdio.h> 00056 #include <selforg/abstractcontroller.h> 00057 00058 00059 /** 00060 * class for robot controll with sine and cosine 00061 * 00062 * 00063 */ 00064 class SimpleController : public AbstractController { 00065 public: 00066 00067 SimpleController(); 00068 00069 /** initialisation of the controller with the given sensor/ motornumber 00070 Must be called before use. 00071 */ 00072 virtual void init(int sensornumber, int motornumber); 00073 00074 /// returns the name of the object (with version number) 00075 // virtual constparamkey getName() const {return name; } 00076 virtual paramkey getName() const {return name; } 00077 00078 /** @return Number of sensors the controller was initialised with or 0 if not initialised*/ 00079 virtual int getSensorNumber() const {return number_sensors;} 00080 00081 00082 /** @return Number of motors the controller was initialised with or 0 if not initialised */ 00083 virtual int getMotorNumber() const {return number_motors;} 00084 00085 /** performs one step (includes learning). 00086 Calculates motor commands from sensor inputs. 00087 @param sensor sensors inputs scaled to [-1,1] 00088 @param sensornumber length of the sensor array 00089 @param motor motors outputs. MUST have enough space for motor values! 00090 @param motornumber length of the provided motor array 00091 */ 00092 virtual void step(const sensor* sensors, int sensornumber, 00093 motor* motors, int motornumber); 00094 /** performs one step without learning. 00095 @see step 00096 */ 00097 virtual void stepNoLearning(const sensor* , int number_sensors, 00098 motor* , int number_motors); 00099 00100 /** The list of the names of all internal parameters given by getInternalParams(). 00101 @param keylist (do NOT free it! It is a pointer to an internal structure) 00102 @return length of the lists 00103 */ 00104 virtual list<iparamkey> getInternalParamNames() const {return list<iparamkey>();} 00105 00106 /** The list of the names of all internal parameters given by getInternalParams(). 00107 */ 00108 virtual list<iparamval> getInternalParams() const {return list<iparamval>();} 00109 00110 virtual paramval getParam(const paramkey& key) const; 00111 virtual bool setParam(const paramkey& key, paramval val); 00112 virtual paramlist getParamList() const ; 00113 00114 /** Initialises the registers the given callback functions. 00115 @param handling() is called every step that the camera gets new position 00116 and view. 00117 */ 00118 // virtual void setCameraHandling(void (*handling)()); 00119 // virtual void setCameraHandling() const; 00120 00121 00122 00123 protected: 00124 string name; 00125 int t; 00126 int number_sensors; 00127 int number_motors; 00128 int cameraHandlingDefined; 00129 00130 paramval velocity; 00131 paramval leftRightShift; 00132 paramval decreaseFactorVelocity; 00133 paramval decreaseFactorShift; 00134 00135 }; 00136 00137 #endif

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