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.1.2.1 2005/11/16 11:24:28 martius 00024 * moved to selforg 00025 * 00026 * Revision 1.9 2005/10/28 12:05:54 martius 00027 * new inspectable interface 00028 * 00029 * Revision 1.8 2005/10/24 13:32:07 fhesse 00030 * comments adjusted and in doxygen style 00031 * 00032 * Revision 1.7 2005/10/06 17:11:37 martius 00033 * switched to stl lists 00034 * 00035 * Revision 1.6 2005/08/31 11:10:52 martius 00036 * noise -> noisevals 00037 * 00038 * Revision 1.5 2005/08/03 20:34:58 martius 00039 * use if Inspectable interface 00040 * 00041 * Revision 1.4 2005/07/21 15:14:47 martius 00042 * wireSensors and wireMotors get constant fields 00043 * 00044 * Revision 1.3 2005/07/18 14:44:27 martius 00045 * noise moved into wiring 00046 * 00047 * Revision 1.2 2005/07/18 10:15:03 martius 00048 * noise is added here 00049 * 00050 * Revision 1.1 2005/07/14 15:57:54 fhesse 00051 * now agent contains controller, robot and wiring, plotting ability included, therefore plotagent can be removed; ono2onewiring replaces one2oneagent 00052 * * 00053 * * 00054 ***************************************************************************/ 00055 #ifndef __ONE2ONEWIRING_H 00056 #define __ONE2ONEWIRING_H 00057 00058 #include "abstractwiring.h" 00059 00060 /** Implements one to one wireing of robot sensors to inputs of the controller 00061 and controller outputs to robot motors. 00062 */ 00063 class One2OneWiring :public AbstractWiring{ 00064 public: 00065 /** constructor 00066 @param noise NoiseGenerator that is used for adding noise to sensor values 00067 @param plotNoise for plotting the noise values (to observe it from outside 00068 via getInternalParams() and guilogger) set it TRUE, for not plotting the noise set 00069 it to FALSE. 00070 */ 00071 One2OneWiring(NoiseGenerator* noise, bool plotNoise=false); 00072 00073 /** destructor 00074 */ 00075 virtual ~One2OneWiring(); 00076 00077 /** initializes the number of sensors and motors on robot side, calculate 00078 number of sensors and motors on controller side 00079 */ 00080 virtual bool init(int robotsensornumber, int robotmotornumber); 00081 00082 /** Realizes one to one wiring from robot sensors to controller sensors. 00083 @param rsensors pointer to array of sensorvalues from robot 00084 @param rsensornumber number of sensors from robot 00085 @param csensors pointer to array of sensorvalues for controller 00086 @param csensornumber number of sensors to controller 00087 @param noise size of the noise added to the sensors 00088 */ 00089 virtual bool wireSensors(const sensor* rsensors, int rsensornumber, 00090 sensor* csensors, int csensornumber, 00091 double noise); 00092 00093 /** Realizes one to one wiring from controller motor outputs to robot motors. 00094 @param rmotors pointer to array of motorvalues for robot 00095 @param rmotornumber number of robot motors 00096 @param cmotors pointer to array of motorvalues from controller 00097 @param cmotornumber number of motorvalues from controller 00098 */ 00099 virtual bool wireMotors(motor* rmotors, int rmotornumber, 00100 const motor* cmotors, int cmotornumber); 00101 00102 /** Returns the list of the names of all internal parameters. 00103 */ 00104 virtual list<iparamkey> getInternalParamNames() const; 00105 00106 /** The list of the values of all internal parameters given by getInternalParams(). 00107 (in the order given by getInternalParamNames()) 00108 */ 00109 virtual list<iparamval> getInternalParams() const; 00110 00111 protected: 00112 /// TRUE for plotting noise values, FALSE for not plotting 00113 bool plotNoise; 00114 /// for storing the noise values 00115 sensor* noisevals; 00116 00117 }; 00118 00119 #endif