abstractcontroller.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: abstractcontroller.h,v $ 00023 * Revision 1.16 2006/08/04 15:16:13 martius 00024 * documentation 00025 * 00026 * Revision 1.15 2006/07/20 17:14:34 martius 00027 * removed std namespace from matrix.h 00028 * storable interface 00029 * abstract model and invertablemodel as superclasses for networks 00030 * 00031 * Revision 1.14 2006/07/14 12:23:57 martius 00032 * selforg becomes HEAD 00033 * 00034 * Revision 1.12.6.4 2006/06/25 21:56:06 martius 00035 * configureable has name and revision 00036 * 00037 * Revision 1.12.6.3 2006/03/30 12:35:12 martius 00038 * documentation updated 00039 * 00040 * Revision 1.12.6.2 2006/01/18 16:48:10 martius 00041 * configurables can be stored and reloaded 00042 * 00043 * Revision 1.12.6.1 2006/01/17 16:58:39 martius 00044 * loading and storing 00045 * 00046 * Revision 1.12 2005/08/06 20:47:54 martius 00047 * Commented 00048 * 00049 * Revision 1.11 2005/08/03 20:28:57 martius 00050 * inspectable interface 00051 * 00052 * Revision 1.10 2005/06/21 15:31:11 martius 00053 * getSensorNumber and getMotorMumber added controller interface 00054 * 00055 * Revision 1.9 2005/06/20 09:04:16 martius 00056 * init function added to controller-interface 00057 * 00058 * Revision 1.8 2005/06/17 10:45:22 martius 00059 * GPL added 00060 * * 00061 ***************************************************************************/ 00062 #ifndef __ABSTRACTCONTROLLER_H 00063 #define __ABSTRACTCONTROLLER_H 00064 00065 #include <stdio.h> 00066 #include "configurable.h" 00067 #include "inspectable.h" 00068 #include "storeable.h" 00069 00070 typedef double sensor; 00071 typedef double motor; 00072 00073 /** 00074 * Abstract class (interface) for robot controller. 00075 * The controller gets a number of input sensor values each timestep 00076 * and has to generate a number of output motor values. 00077 * 00078 * Interface assumes the following usage: 00079 * - init() is called first to initialise the dimension of sensor- and motor space 00080 * - each time step 00081 * either step() or stepNoLearning() is called to ask the controller for motor values. 00082 */ 00083 class AbstractController : public Configurable, public Inspectable, public Storeable { 00084 public: 00085 /// contructor (hint: use $ID$ for revision) 00086 AbstractController(const std::string& name, const std::string& revision) 00087 : Configurable(name, revision) {} 00088 00089 /** initialisation of the controller with the given sensor/ motornumber 00090 Must be called before use. 00091 */ 00092 virtual void init(int sensornumber, int motornumber) ABSTRACT; 00093 00094 /** @return Number of sensors the controller 00095 was initialised with or 0 if not initialised */ 00096 virtual int getSensorNumber() const ABSTRACT; 00097 00098 /** @return Number of motors the controller 00099 was initialised with or 0 if not initialised */ 00100 virtual int getMotorNumber() const ABSTRACT; 00101 00102 /** performs one step (includes learning). 00103 Calculates motor commands from sensor inputs. 00104 @param sensors sensors inputs scaled to [-1,1] 00105 @param sensornumber length of the sensor array 00106 @param motors motors outputs. MUST have enough space for motor values! 00107 @param motornumber length of the provided motor array 00108 */ 00109 virtual void step(const sensor* sensors, int sensornumber, 00110 motor* motors, int motornumber) ABSTRACT; 00111 /** performs one step without learning. 00112 @see step 00113 */ 00114 virtual void stepNoLearning(const sensor* , int number_sensors, 00115 motor* , int number_motors) ABSTRACT; 00116 00117 }; 00118 00119 #endif

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