discretesizable.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  *    guettler@mis.mpg.de                                                  *
00007  *                                                                         *
00008  *   This program is free software; you can redistribute it and/or modify  *
00009  *   it under the terms of the GNU General Public License as published by  *
00010  *   the Free Software Foundation; either version 2 of the License, or     *
00011  *   (at your option) any later version.                                   *
00012  *                                                                         *
00013  *   This program is distributed in the hope that it will be useful,       *
00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00016  *   GNU General Public License for more details.                          *
00017  *                                                                         *
00018  *   You should have received a copy of the GNU General Public License     *
00019  *   along with this program; if not, write to the                         *
00020  *   Free Software Foundation, Inc.,                                       *
00021  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00022  *                                                                         *
00023  *   $Log: discretesizable.h,v $
00024  *   Revision 1.1  2007/03/22 08:19:51  robot3
00025  *   abstract class for getting support of discretesized sensor values. This is an early version and is still uncomplete..
00026  *
00027 
00028  *                                                                         *
00029  ***************************************************************************/
00030 #ifndef __DISCRETESIZABLE_H
00031 #define __DISCRETESIZABLE_H
00032 
00033 //#include <iostream>
00034 //#include <list>
00035 //#include <utility>
00036 //#include <string>
00037 //#include <map>
00038 //#include "stl_adds.h"
00039 
00040 
00041 
00042 /**
00043  * Abstact class for discretesizable controllers. Implements the methods
00044  * step(...) and stepNoLearning(...) and defines the methods dStep(...)
00045  * respectively dStepNoLearning(...), which are called from the implemented
00046  * one.
00047  *
00048  * Hint: Do not mistake dStep(...) for a method from the ODE.
00049  *
00050  * Additionally the controller implementing this interface must give the range
00051  * and intervalCount in the constructor of this interface for configuring the
00052  * discretization correctly.
00053  *
00054  * Note: This interface does only discretesize the sensor values.
00055  */
00056 class Discretesizable : public DiscreteControllerAdapter {
00057 public:
00058 
00059         /** Initializes the discretization.
00060          * @param intervalCount sets the number of intervals
00061          * @param mapToInteger if true, all intervals are mapped to 0..(intervalCount-1)
00062          * @param minSensorValue is neccessary if the sensor range is not in [-1,1]
00063          * @param maxSensorValue is neccessary if the sensor range is not in [-1,1]
00064          */
00065         Discretesizable(int intervalCount, boolean mapToInteger=true, double minSensorValue=-1.0, double maxSensorValue=1.0);
00066         
00067         virtual ~Discretesizable() {};
00068 
00069         /** performs one step (includes learning).
00070          * Calculates motor commands from sensor inputs.
00071          * @note This method cannot be overwritten, use @see dStep instead.
00072          * @param sensors sensors inputs scaled to [-1,1]
00073          * @param sensornumber length of the sensor array
00074          * @param motors motors outputs. MUST have enough space for motor values!
00075          * @param motornumber length of the provided motor array
00076          */
00077         void step(const sensor* sensors, int sensornumber, motor* motors, int motornumber) {
00078                 DiscreteControllerAdapter::step( sensors,sensornumber, motors, motornumber);
00079         }
00080         
00081         /** performs one step without learning.
00082          * @see step
00083          * @note This method cannot be overwritten, use @see dStepNoLearning
00084          * instead.
00085          */
00086         void stepNoLearning(const sensor* sensors , int sensornumber,
00087                             motor* motors, int motornumber) {
00088                                     DiscreteControllerAdapter::step( sensors,sensornumber, motors, motornumber);
00089                             }
00090         
00091 protected:
00092         ;
00093         
00094 private:
00095         
00096 };
00097 
00098 
00099 #endif

Generated on Fri Oct 30 16:29:01 2009 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.4.7