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.7 2010/01/26 09:50:19 martius 00024 * comments 00025 * 00026 * Revision 1.6 2009/08/05 22:32:21 martius 00027 * big change: 00028 * abstractwiring is responsable for providing sensors and motors 00029 * and noise to the inspectable interface. 00030 * external interface: unchanged except plotMode in constructor 00031 * internal interface: all subclasses have to overload 00032 * initIntern, wireSensorsIntern, wireMotorsIntern 00033 * All existing implementation are changed 00034 * 00035 * Revision 1.5 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.4 2007/11/29 19:18:02 martius 00043 * blind channels 00044 * 00045 * Revision 1.3 2006/07/20 17:14:36 martius 00046 * removed std namespace from matrix.h 00047 * storable interface 00048 * abstract model and invertablemodel as superclasses for networks 00049 * 00050 * Revision 1.2 2006/07/14 12:24:02 martius 00051 * selforg becomes HEAD 00052 * 00053 * Revision 1.1.2.1 2005/11/16 11:24:28 martius 00054 * moved to selforg 00055 * 00056 * Revision 1.9 2005/10/28 12:05:54 martius 00057 * new inspectable interface 00058 * 00059 * Revision 1.8 2005/10/24 13:32:07 fhesse 00060 * comments adjusted and in doxygen style 00061 * 00062 * Revision 1.7 2005/10/06 17:11:37 martius 00063 * switched to stl lists 00064 * 00065 * Revision 1.6 2005/08/31 11:10:52 martius 00066 * noise -> noisevals 00067 * 00068 * Revision 1.5 2005/08/03 20:34:58 martius 00069 * use if Inspectable interface 00070 * 00071 * Revision 1.4 2005/07/21 15:14:47 martius 00072 * wireSensors and wireMotors get constant fields 00073 * 00074 * Revision 1.3 2005/07/18 14:44:27 martius 00075 * noise moved into wiring 00076 * 00077 * Revision 1.2 2005/07/18 10:15:03 martius 00078 * noise is added here 00079 * 00080 * Revision 1.1 2005/07/14 15:57:54 fhesse 00081 * now agent contains controller, robot and wiring, plotting ability included, therefore plotagent can be removed; ono2onewiring replaces one2oneagent 00082 * * 00083 * * 00084 ***************************************************************************/ 00085 #ifndef __ONE2ONEWIRING_H 00086 #define __ONE2ONEWIRING_H 00087 00088 #include "abstractwiring.h" 00089 00090 /** Implements one to one wiring of robot sensors to inputs of the controller 00091 and controller outputs to robot motors. 00092 */ 00093 class One2OneWiring :public AbstractWiring{ 00094 public: 00095 /** constructor 00096 @param noise NoiseGenerator that is used for adding noise to sensor values 00097 @param plotMode see AbstractWiring 00098 @param blind number of blind channels 00099 (additional sensors and motors coupled directly) 00100 */ 00101 One2OneWiring(NoiseGenerator* noise, int plotMode=Controller, int blind=0); 00102 00103 /** destructor 00104 */ 00105 virtual ~One2OneWiring(); 00106 00107 protected: 00108 00109 /** initializes the number of sensors and motors on robot side, calculate 00110 number of sensors and motors on controller side 00111 */ 00112 virtual bool initIntern(int robotsensornumber, int robotmotornumber, RandGen* randGen=0); 00113 00114 /** Realizes one to one wiring from robot sensors to controller sensors. 00115 @param rsensors pointer to array of sensorvalues from robot 00116 @param rsensornumber number of sensors from robot 00117 @param csensors pointer to array of sensorvalues for controller 00118 @param csensornumber number of sensors to controller 00119 @param noise size of the noise added to the sensors 00120 */ 00121 virtual bool wireSensorsIntern(const sensor* rsensors, int rsensornumber, 00122 sensor* csensors, int csensornumber, 00123 double noise); 00124 00125 /** Realizes one to one wiring from controller motor outputs to robot motors. 00126 @param rmotors pointer to array of motorvalues for robot 00127 @param rmotornumber number of robot motors 00128 @param cmotors pointer to array of motorvalues from controller 00129 @param cmotornumber number of motorvalues from controller 00130 */ 00131 virtual bool wireMotorsIntern(motor* rmotors, int rmotornumber, 00132 const motor* cmotors, int cmotornumber); 00133 00134 00135 protected: 00136 int blind; /// number of blind channels 00137 /// blind motor values 00138 motor* blindmotors; 00139 00140 }; 00141 00142 #endif