00001 /*************************************************************************** 00002 * Copyright (C) 2007 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: wiringsequence.h,v $ 00023 * Revision 1.4 2009/08/05 22:32:21 martius 00024 * big change: 00025 * abstractwiring is responsable for providing sensors and motors 00026 * and noise to the inspectable interface. 00027 * external interface: unchanged except plotMode in constructor 00028 * internal interface: all subclasses have to overload 00029 * initIntern, wireSensorsIntern, wireMotorsIntern 00030 * All existing implementation are changed 00031 * 00032 * Revision 1.3 2008/04/28 11:14:54 guettler 00033 * removed include "abstractrobot.h" (not needed) 00034 * 00035 * Revision 1.2 2008/04/17 14:54:45 martius 00036 * randomGen added, which is a random generator with long period and an 00037 * internal state. Each Agent has an instance and passed it to the controller 00038 * and the wiring. This is good for 00039 * a) repeatability on agent basis, 00040 * b) parallel execution as done in ode_robots 00041 * 00042 * Revision 1.1 2007/11/29 19:18:33 martius 00043 * sequence of wirings 00044 * 00045 * Revision 1.1 2007/11/28 10:30:56 martius 00046 * wiring with feedback connections 00047 * 00048 * * 00049 * * 00050 ***************************************************************************/ 00051 #ifndef __WIRINGSEQUENCE_H 00052 #define __WIRINGSEQUENCE_H 00053 00054 #include "abstractwiring.h" 00055 #include <vector> 00056 00057 /** Implements a sequence of wirings 00058 */ 00059 class WiringSequence :public AbstractWiring{ 00060 public: 00061 00062 /** constructor: The wirings given in the list 00063 are applied in the sequence. For the sensors in normal order and 00064 for the motors in reverse order*/ 00065 WiringSequence(std::list<AbstractWiring*>); 00066 /** constructor provided for convinience, essentially calls addWiring(w1);addWiring(w2) 00067 */ 00068 WiringSequence(AbstractWiring* w1, AbstractWiring* w2); 00069 00070 virtual ~WiringSequence(); 00071 00072 protected: 00073 virtual bool initIntern(int robotsensornumber, int robotmotornumber, RandGen* randGen=0); 00074 00075 virtual bool wireSensorsIntern(const sensor* rsensors, int rsensornumber, 00076 sensor* csensors, int csensornumber, 00077 double noise); 00078 00079 virtual bool wireMotorsIntern(motor* rmotors, int rmotornumber, 00080 const motor* cmotors, int cmotornumber); 00081 00082 00083 public: 00084 00085 /** adds a wiring to the list of wirings*/ 00086 virtual void addWiring(AbstractWiring* wiring); 00087 00088 00089 /** pass through of first wiring 00090 */ 00091 virtual iparamkeylist getInternalParamNames() const; 00092 00093 /** pass through of first wiring 00094 */ 00095 virtual iparamvallist getInternalParams() const; 00096 00097 protected: 00098 std::vector<AbstractWiring*> wirings; 00099 bool initialised; 00100 00101 }; 00102 00103 #endif