Robotsystem of the Robot Group Leipzig: one2onewiring.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages
- Examples

- Search for |

- File List
- File Members

# one2onewiring.h

Go to the documentation of this file.

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