00001 /*************************************************************************** 00002 * Copyright (C) 2005-2011 LpzRobots development team * 00003 * Georg Martius <georg dot martius at web dot de> * 00004 * Frank Guettler <guettler at informatik dot uni-leipzig dot de * 00005 * Frank Hesse <frank at nld dot ds dot mpg dot de> * 00006 * Ralf Der <ralfder at mis dot mpg dot 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 ***************************************************************************/ 00024 #ifndef __ONEACTIVEMULTIPASSIVECONTROLLER_H 00025 #define __ONEACTIVEMULTIPASSIVECONTROLLER_H 00026 00027 #include "abstractmulticontroller.h" 00028 00029 /** 00030 * class (interface) for using multiple controller, the first one is 00031 * the active one, which generates motor values. The other controllers 00032 * are passive and cannot affect the motor values. 00033 * 00034 */ 00035 class OneActiveMultiPassiveController : public AbstractMultiController { 00036 public: 00037 00038 /// contructor (hint: use $ID$ for revision) 00039 OneActiveMultiPassiveController(AbstractController* controller, const std::string& name = "1ActXPassController", const std::string& revision = "$ID$"); 00040 00041 virtual ~OneActiveMultiPassiveController(); 00042 00043 /****************************************************************************/ 00044 /* AbstractMultiController should implement the following classes: */ 00045 /* AbstractController, Configurable, Inspectable, Storeable */ 00046 /****************************************************************************/ 00047 00048 00049 /****************************************************************************/ 00050 /* BEGIN methods of AbstractController */ 00051 /****************************************************************************/ 00052 00053 /** initialisation of the controller with the given sensor/ motornumber 00054 * Must NORMALLY be called before use. For all multicontroller 00055 * call first AbstractMultiController::init(sensornumber,motornumber) 00056 * if you overwrite this method 00057 */ 00058 virtual void init(int sensornumber, int motornumber, RandGen* randGen = 0); 00059 00060 00061 /** performs one step (includes learning). 00062 Calculates motor commands from sensor inputs. 00063 @param sensors sensors inputs scaled to [-1,1] 00064 @param sensornumber length of the sensor array 00065 @param motors motors outputs. MUST have enough space for motor values! 00066 @param motornumber length of the provided motor array 00067 */ 00068 virtual void step(const sensor* sensors, int sensornumber, 00069 motor* motors, int motornumber); 00070 00071 /** performs one step without learning. 00072 @see step 00073 */ 00074 virtual void stepNoLearning(const sensor* sensors , int sensornumber, 00075 motor* motors, int motornumber); 00076 00077 00078 /****************************************************************************/ 00079 /* END methods of AbstractController */ 00080 /****************************************************************************/ 00081 00082 00083 00084 /****************************************************************************/ 00085 /* BEGIN methods of Configurable */ 00086 /****************************************************************************/ 00087 00088 /****************************************************************************/ 00089 /* END methods of Configurable */ 00090 /****************************************************************************/ 00091 00092 00093 00094 /****************************************************************************/ 00095 /* BEGIN methods of Inspectable */ 00096 /****************************************************************************/ 00097 00098 /****************************************************************************/ 00099 /* END methods of Inspectable */ 00100 /****************************************************************************/ 00101 00102 00103 00104 /****************************************************************************/ 00105 /* BEGIN methods of Storeable */ 00106 /****************************************************************************/ 00107 00108 /****************************************************************************/ 00109 /* END methods of Storeable */ 00110 /****************************************************************************/ 00111 00112 00113 protected: 00114 motor* passiveMotors; 00115 }; 00116 00117 #endif