Robot Simulator of the Robotics Group for Self-Organization of Control: discretesizable.h Source File

# discretesizable.h

Go to the documentation of this file.

    00001 /***************************************************************************
    00002  *   Copyright (C) 2005-2011 LpzRobots development team                    *
    00003  *    Georg Martius  <georg dot martius at web dot de>                     *
    00004  *    Frank Guettler <guettler at informatik dot uni-leipzig dot de        *
    00005  *    Frank Hesse    <frank at nld dot ds dot mpg dot de>                  *
    00006  *    Ralf Der       <ralfder at mis dot mpg dot 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  ***************************************************************************/
    00024 #ifndef __DISCRETESIZABLE_H
    00025 #define __DISCRETESIZABLE_H
    00026
    00027 //#include <iostream>
    00028 //#include <list>
    00029 //#include <utility>
    00030 //#include <string>
    00031 //#include <map>
    00032 //#include "stl_adds.h"
    00033
    00034
    00035
    00036 /**
    00037  * Abstact class for discretesizable controllers. Implements the methods
    00038  * step(...) and stepNoLearning(...) and defines the methods dStep(...)
    00039  * respectively dStepNoLearning(...), which are called from the implemented
    00040  * one.
    00041  *
    00042  * Hint: Do not mistake dStep(...) for a method from the ODE.
    00043  *
    00044  * Additionally the controller implementing this interface must give the range
    00045  * and intervalCount in the constructor of this interface for configuring the
    00046  * discretization correctly.
    00047  *
    00048  * Note: This interface does only discretesize the sensor values.
    00049  */
    00050 class Discretesizable : public DiscreteControllerAdapter {
    00051 public:
    00052
    00053         /** Initializes the discretization.
    00054          * @param intervalCount sets the number of intervals
    00055          * @param mapToInteger if true, all intervals are mapped to 0..(intervalCount-1)
    00056          * @param minSensorValue is neccessary if the sensor range is not in [-1,1]
    00057          * @param maxSensorValue is neccessary if the sensor range is not in [-1,1]
    00058          */
    00059         Discretesizable(int intervalCount, boolean mapToInteger=true, double minSensorValue=-1.0, double maxSensorValue=1.0);
    00060
    00061         virtual ~Discretesizable() {};
    00062
    00063         /** performs one step (includes learning).
    00064          * Calculates motor commands from sensor inputs.
    00065          * @note This method cannot be overwritten, use @see dStep instead.
    00066          * @param sensors sensors inputs scaled to [-1,1]
    00067          * @param sensornumber length of the sensor array
    00068          * @param motors motors outputs. MUST have enough space for motor values!
    00069          * @param motornumber length of the provided motor array
    00070          */
    00071         void step(const sensor* sensors, int sensornumber, motor* motors, int motornumber) {
    00072                 DiscreteControllerAdapter::step( sensors,sensornumber, motors, motornumber);
    00073         }
    00074
    00075         /** performs one step without learning.
    00076          * @see step
    00077          * @note This method cannot be overwritten, use @see dStepNoLearning
    00078          * instead.
    00079          */
    00080         void stepNoLearning(const sensor* sensors , int sensornumber,
    00081                             motor* motors, int motornumber) {
    00082                                     DiscreteControllerAdapter::step( sensors,sensornumber, motors, motornumber);
    00083                             }
    00084
    00085 protected:
    00086         ;
    00087
    00088 private:
    00089
    00090 };
    00091
    00092
    00093 #endif