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

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

- Search for |

- File List
- File Members

# sinecontroller.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: sinecontroller.h,v $
    00023  *   Revision 1.9  2006/08/02 09:32:03  martius
    00024  *   store and restore according to storable interface
    00025  *
    00026  *   Revision 1.8  2006/07/14 12:23:59  martius
    00027  *   selforg becomes HEAD
    00028  *
    00029  *   Revision 1.6.6.5  2006/06/25 21:56:08  martius
    00030  *   configureable has name and revision
    00031  *
    00032  *   Revision 1.6.6.4  2006/06/25 16:51:36  martius
    00033  *   configureable has name and revision
    00034  *   a robot is configureable by default
    00035  *
    00036  *   Revision 1.6.6.3  2006/03/30 12:35:13  martius
    00037  *   documentation updated
    00038  *
    00039  *   Revision 1.6.6.2  2006/01/18 16:48:35  martius
    00040  *   stored and restore
    00041  *
    00042  *   Revision 1.6.6.1  2005/11/14 15:38:17  martius
    00043  *   moved to selforg
    00044  *
    00045  *   Revision 1.6  2005/11/14 12:46:19  martius
    00046  *   added number of controlled motors
    00047  *
    00048  *   Revision 1.5  2005/11/09 13:56:34  martius
    00049  *   const in instspectable functions
    00050  *
    00051  *   Revision 1.4  2005/10/06 17:06:57  martius
    00052  *   switched to stl lists
    00053  *
    00054  *   Revision 1.3  2005/08/06 20:47:54  martius
    00055  *   Commented
    00056  *
    00057  *   Revision 1.2  2005/07/07 10:25:47  martius
    00058  *   added Phaseshift
    00059  *
    00060  *   Revision 1.1  2005/07/06 13:55:33  fhesse
    00061  *   initial version, realising sine and cosine outputs
    00062  *                                            *
    00063  *                                                                         *
    00064  ***************************************************************************/
    00065 #ifndef __SINECONTROLLER_H
    00066 #define __SINECONTROLLER_H
    00067
    00068
    00069 #include <stdio.h>
    00070 #include "abstractcontroller.h"
    00071
    00072 /**
    00073  * class for robot control with sine and cosine
    00074  *
    00075  *
    00076  */
    00077 class SineController : public AbstractController {
    00078 public:
    00079
    00080   SineController(int number_controlled=-1);
    00081
    00082   /** initialisation of the controller with the given sensor/ motornumber
    00083       Must be called before use.
    00084   */
    00085   virtual void init(int sensornumber, int motornumber);
    00086
    00087   /** @return Number of sensors the controller was initialised
    00088       with or 0 if not initialised */
    00089   virtual int getSensorNumber() const {return number_sensors;}
    00090
    00091
    00092   /** @return Number of motors the controller was initialised
    00093       with or 0 if not initialised */
    00094   virtual int getMotorNumber() const {return number_motors;}
    00095
    00096   /** performs one step (includes learning).
    00097       Calculates motor commands from sensor inputs.
    00098       @param sensors sensors inputs scaled to [-1,1]
    00099       @param sensornumber length of the sensor array
    00100       @param motors motors outputs. MUST have enough space for motor values!
    00101       @param motornumber length of the provided motor array
    00102   */
    00103   virtual void step(const sensor* sensors, int sensornumber,
    00104                     motor* motors, int motornumber);
    00105   /** performs one step without learning.
    00106       @see step
    00107   */
    00108   virtual void stepNoLearning(const sensor* , int number_sensors,
    00109                               motor* , int number_motors);
    00110
    00111
    00112   /** The list of the names of all internal parameters given by getInternalParams().
    00113       @return list of names
    00114    */
    00115   virtual std::list<iparamkey> getInternalParamNames()const  { return std::list<iparamkey>(); }
    00116
    00117   /** The list of the names of all internal parameters given by getInternalParams().
    00118    */
    00119   virtual std::list<iparamval> getInternalParams() const { return std::list<iparamval>(); }
    00120
    00121
    00122   virtual paramval getParam(const paramkey& key) const;
    00123   virtual bool setParam(const paramkey& key, paramval val);
    00124   virtual paramlist getParamList() const ;
    00125
    00126   /********* STORABLE INTERFACE ******/
    00127   /// @see Storable
    00128   virtual bool store(FILE* f) const { return true;};  // FIXME: store Parameter
    00129
    00130   /// @see Storable
    00131   virtual bool restore(FILE* f) { return true;}; // FIXME: restore Parameter
    00132
    00133
    00134 protected:
    00135
    00136   int t;
    00137   std::string name;
    00138   int number_sensors;
    00139   int number_motors;
    00140   int number_controlled; // number of motors that are controlled. The remaining are set to 0;
    00141
    00142   paramval sineRate;
    00143   paramval phaseShift;
    00144 };
    00145
    00146 #endif