demo_controller.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: demo_controller.h,v $ 00024 * Revision 1.1 2005/12/21 00:16:59 robot7 00025 * this is a pretty bad controller - but at least it works pretty well with 00026 * the nimm4-robot - so its good enough for demo reasons (thus the name). 00027 * 00028 * Revision 1.6 2005/11/15 14:23:44 robot3 00029 * raceground testet 00030 * 00031 * Revision 1.5 2005/10/17 13:17:10 martius 00032 * converted to new list's 00033 * 00034 * Revision 1.4 2005/10/17 13:07:57 robot3 00035 * std lists included 00036 * 00037 * Revision 1.3 2005/10/17 13:05:47 robot3 00038 * std lists included 00039 * 00040 * Revision 1.2 2005/08/09 11:06:30 robot1 00041 * camera module included 00042 * 00043 * Revision 1.1 2005/08/08 11:14:54 robot1 00044 * simple control for moving robot with keyboard 00045 * 00046 * * 00047 * * 00048 ***************************************************************************/ 00049 #ifndef __DEMO_CONTROLLER_H 00050 #define __DEMO_CONTROLLER_H 00051 00052 00053 #include <stdio.h> 00054 #include "abstractcontroller.h" 00055 00056 00057 /** 00058 * class for robot controll with sine and cosine 00059 * 00060 * 00061 */ 00062 class DemoController : public AbstractController { 00063 public: 00064 00065 DemoController(); 00066 00067 /** initialisation of the controller with the given sensor/ motornumber 00068 Must be called before use. 00069 */ 00070 virtual void init(int sensornumber, int motornumber); 00071 00072 /// returns the name of the object (with version number) 00073 // virtual constparamkey getName() const {return name; } 00074 virtual paramkey getName() const {return name; } 00075 00076 /// @return Number of sensors the controller was initialised with or 0 if not initialised 00077 virtual int getSensorNumber() const {return number_sensors;} 00078 00079 00080 /// @return Number of motors the controller was initialised with or 0 if not initialised 00081 virtual int getMotorNumber() const {return number_motors;} 00082 00083 /** performs one step (includes learning). 00084 Calculates motor commands from sensor inputs. 00085 @param sensor sensors inputs scaled to [-1,1] 00086 @param sensornumber length of the sensor array 00087 @param motor motors outputs. MUST have enough space for motor values! 00088 @param motornumber length of the provided motor array 00089 */ 00090 virtual void step(const sensor* sensors, int sensornumber, 00091 motor* motors, int motornumber); 00092 /** performs one step without learning. 00093 @see step 00094 */ 00095 virtual void stepNoLearning(const sensor* , int number_sensors, 00096 motor* , int number_motors); 00097 00098 /** The list of the names of all internal parameters given by getInternalParams(). 00099 @param: keylist (do NOT free it! It is a pointer to an internal structure) 00100 @return: length of the lists 00101 */ 00102 virtual list<iparamkey> getInternalParamNames() const {return list<iparamkey>();} 00103 00104 /** The list of the names of all internal parameters given by getInternalParams(). 00105 */ 00106 virtual list<iparamval> getInternalParams() const {return list<iparamval>();} 00107 00108 virtual paramval getParam(const paramkey& key) const; 00109 virtual bool setParam(const paramkey& key, paramval val); 00110 virtual paramlist getParamList() const ; 00111 00112 /** Initialises the registers the given callback functions. 00113 @param handling() is called every step that the camera gets new position 00114 and view. 00115 */ 00116 // virtual void setCameraHandling(void (*handling)()); 00117 // virtual void setCameraHandling() const; 00118 00119 00120 00121 00122 protected: 00123 string name; 00124 int t; 00125 int number_sensors; 00126 int number_motors; 00127 int cameraHandlingDefined; 00128 00129 paramval velocity; 00130 paramval leftRightShift; 00131 paramval decreaseFactorVelocity; 00132 paramval decreaseFactorShift; 00133 00134 }; 00135 00136 #endif

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