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: one2onewiring.h,v $ 00023 * Revision 1.6 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.5 2008/04/17 14:54:45 martius 00033 * randomGen added, which is a random generator with long period and an 00034 * internal state. Each Agent has an instance and passed it to the controller 00035 * and the wiring. This is good for 00036 * a) repeatability on agent basis, 00037 * b) parallel execution as done in ode_robots 00038 * 00039 * Revision 1.4 2007/11/29 19:18:02 martius 00040 * blind channels 00041 * 00042 * Revision 1.3 2006/07/20 17:14:36 martius 00043 * removed std namespace from matrix.h 00044 * storable interface 00045 * abstract model and invertablemodel as superclasses for networks 00046 * 00047 * Revision 1.2 2006/07/14 12:24:02 martius 00048 * selforg becomes HEAD 00049 * 00050 * Revision 1.1.2.1 2005/11/16 11:24:28 martius 00051 * moved to selforg 00052 * 00053 * Revision 1.9 2005/10/28 12:05:54 martius 00054 * new inspectable interface 00055 * 00056 * Revision 1.8 2005/10/24 13:32:07 fhesse 00057 * comments adjusted and in doxygen style 00058 * 00059 * Revision 1.7 2005/10/06 17:11:37 martius 00060 * switched to stl lists 00061 * 00062 * Revision 1.6 2005/08/31 11:10:52 martius 00063 * noise -> noisevals 00064 * 00065 * Revision 1.5 2005/08/03 20:34:58 martius 00066 * use if Inspectable interface 00067 * 00068 * Revision 1.4 2005/07/21 15:14:47 martius 00069 * wireSensors and wireMotors get constant fields 00070 * 00071 * Revision 1.3 2005/07/18 14:44:27 martius 00072 * noise moved into wiring 00073 * 00074 * Revision 1.2 2005/07/18 10:15:03 martius 00075 * noise is added here 00076 * 00077 * Revision 1.1 2005/07/14 15:57:54 fhesse 00078 * now agent contains controller, robot and wiring, plotting ability included, therefore plotagent can be removed; ono2onewiring replaces one2oneagent 00079 * * 00080 * * 00081 ***************************************************************************/ 00082 #ifndef __ONE2ONEWIRING_H 00083 #define __ONE2ONEWIRING_H 00084 00085 #include "abstractwiring.h" 00086 00087 /** Implements one to one wireing of robot sensors to inputs of the controller 00088 and controller outputs to robot motors. 00089 */ 00090 class One2OneWiring :public AbstractWiring{ 00091 public: 00092 /** constructor 00093 @param noise NoiseGenerator that is used for adding noise to sensor values 00094 @param plotMode see AbstractWiring 00095 @param blind number of blind channels 00096 (additional sensors and motors coupled directly) 00097 */ 00098 One2OneWiring(NoiseGenerator* noise, int plotMode=Controller, int blind=0); 00099 00100 /** destructor 00101 */ 00102 virtual ~One2OneWiring(); 00103 00104 protected: 00105 00106 /** initializes the number of sensors and motors on robot side, calculate 00107 number of sensors and motors on controller side 00108 */ 00109 virtual bool initIntern(int robotsensornumber, int robotmotornumber, RandGen* randGen=0); 00110 00111 /** Realizes one to one wiring from robot sensors to controller sensors. 00112 @param rsensors pointer to array of sensorvalues from robot 00113 @param rsensornumber number of sensors from robot 00114 @param csensors pointer to array of sensorvalues for controller 00115 @param csensornumber number of sensors to controller 00116 @param noise size of the noise added to the sensors 00117 */ 00118 virtual bool wireSensorsIntern(const sensor* rsensors, int rsensornumber, 00119 sensor* csensors, int csensornumber, 00120 double noise); 00121 00122 /** Realizes one to one wiring from controller motor outputs to robot motors. 00123 @param rmotors pointer to array of motorvalues for robot 00124 @param rmotornumber number of robot motors 00125 @param cmotors pointer to array of motorvalues from controller 00126 @param cmotornumber number of motorvalues from controller 00127 */ 00128 virtual bool wireMotorsIntern(motor* rmotors, int rmotornumber, 00129 const motor* cmotors, int cmotornumber); 00130 00131 00132 protected: 00133 int blind; /// number of blind channels 00134 /// blind motor values 00135 motor* blindmotors; 00136 00137 }; 00138 00139 #endif