invertcontroller.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  *   ANY COMMERCIAL USE FORBIDDEN!                                         *
00008  *   LICENSE:                                                              *
00009  *   This work is licensed under the Creative Commons                      *
00010  *   Attribution-NonCommercial-ShareAlike 2.5 License. To view a copy of   *
00011  *   this license, visit http://creativecommons.org/licenses/by-nc-sa/2.5/ *
00012  *   or send a letter to Creative Commons, 543 Howard Street, 5th Floor,   *
00013  *   San Francisco, California, 94105, USA.                                *
00014  *                                                                         *
00015  *   This program is distributed in the hope that it will be useful,       *
00016  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00017  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                  *
00018  *                                                                         *
00019  *   $Log: invertcontroller.h,v $
00020  *   Revision 1.10  2006/07/20 17:14:34  martius
00021  *   removed std namespace from matrix.h
00022  *   storable interface
00023  *   abstract model and invertablemodel as superclasses for networks
00024  *
00025  *   Revision 1.9  2006/07/14 12:23:58  martius
00026  *   selforg becomes HEAD
00027  *
00028  *   Revision 1.7.6.2  2006/07/10 13:05:16  martius
00029  *   NON-COMMERICAL LICENSE added to controllers
00030  *
00031  *   Revision 1.12.6.4  2006/06/25 21:56:06  martius
00032  *   configureable has name and revision
00033  *
00034  *   Revision 1.12.6.3  2006/03/30 12:35:12  martius
00035  *   documentation updated
00036  *
00037  *   Revision 1.12.6.2  2006/01/18 16:48:10  martius
00038  *   configurables can be stored and reloaded
00039  *
00040  *   Revision 1.12.6.1  2006/01/17 16:58:39  martius
00041  *   loading and storing
00042  *
00043  *   Revision 1.12  2005/08/06 20:47:54  martius
00044  *   Commented
00045  *
00046  *   Revision 1.11  2005/08/03 20:28:57  martius
00047  *   inspectable interface
00048  *
00049  *   Revision 1.10  2005/06/21 15:31:11  martius
00050  *   getSensorNumber and getMotorMumber added controller interface
00051  *
00052  *   Revision 1.9  2005/06/20 09:04:16  martius
00053  *   init function added to controller-interface
00054  *
00055  *   Revision 1.8  2005/06/17 10:45:22  martius
00056  *   GPL added
00057  *                                                                 *
00058  ***************************************************************************/
00059 #ifndef __INVERTCONTROLLER_H
00060 #define __INVERTCONTROLLER_H
00061 
00062 #include "abstractcontroller.h"
00063 #include <stdlib.h>
00064 #include <string.h>
00065 
00066 /**
00067  * Abstract class (interface) for robot controller that use direct matrix inversion and
00068  * simple one layer networks.
00069  * 
00070  * Implements standart parameters: eps, rho, mu, stepnumber4avg, stepnumber4delay
00071  */
00072 class InvertController : public AbstractController {
00073 public:
00074   InvertController(const std::string& name, const std::string& revision)
00075     : AbstractController(name, revision){
00076      eps=0.3;
00077      rho=0.0; 
00078      s4delay=1;
00079      s4avg=1;
00080      delta=0.01;
00081      factor_a=1.0;
00082      desens=0.0; // name form desensitization
00083      number_it=0;
00084      epsilon_it= 0; 
00085      damping_c=0.0;
00086   }
00087 
00088   virtual paramval getParam(const paramkey& key) const{
00089     if(key == "eps") return eps; 
00090     else if(key == "rho") return rho; 
00091     else if(key == "desens") return desens;     
00092     else if(key == "s4delay") return s4delay; 
00093     else if(key == "s4avg") return s4avg; 
00094     else if(key == "factor_a") return factor_a;     
00095     else if(key == "number_it") return number_it; 
00096     else if(key == "epsilon_it") return epsilon_it; 
00097     else if(key == "delta") return delta;             
00098     else if(key == "damping_c") return damping_c;             
00099     else  return AbstractController::getParam(key) ;
00100   }
00101 
00102   virtual bool setParam(const paramkey& key, paramval val){
00103     if(key == "eps") eps=val;
00104     else if(key == "rho") rho=val; 
00105     else if(key == "desens") desens=val;
00106     else if(key == "s4delay") s4delay=val; 
00107     else if(key == "s4avg") s4avg=val;
00108     else if(key == "factor_a") factor_a=val;
00109     else if(key == "number_it") number_it=val;
00110     else if(key == "epsilon_it") epsilon_it=val;
00111     else if(key == "delta") delta=val;                
00112     else if(key == "damping_c") damping_c=val;                
00113     else return AbstractController::setParam(key, val);
00114     //    else fprintf(stderr, "parameter %s unknown\n", key);
00115     return true;
00116   }
00117 
00118   virtual paramlist getParamList() const{
00119     paramlist list;
00120     list.push_back(std::pair<paramkey, paramval> ("eps", eps));
00121     list.push_back(std::pair<paramkey, paramval> ("rho", rho));
00122     list.push_back(std::pair<paramkey, paramval> ("desens", desens));
00123     list.push_back(std::pair<paramkey, paramval> ("s4delay", s4delay));
00124     list.push_back(std::pair<paramkey, paramval> ("s4avg", s4avg));
00125     list.push_back(std::pair<paramkey, paramval> ("factor_a", factor_a));
00126     list.push_back(std::pair<paramkey, paramval> ("number_it", number_it));
00127     list.push_back(std::pair<paramkey, paramval> ("epsilon_it", epsilon_it));
00128     list.push_back(std::pair<paramkey, paramval> ("delta", delta));
00129     list.push_back(std::pair<paramkey, paramval> ("damping_c", damping_c));
00130 
00131     return list;
00132   }
00133 
00134 protected:
00135   paramval eps;
00136   paramval rho;
00137   paramval desens;
00138   paramval s4delay;
00139   paramval s4avg;
00140   paramval factor_a;
00141   paramval number_it;
00142   paramval epsilon_it;
00143   paramval delta;
00144   paramval damping_c;
00145  
00146 };
00147 
00148 #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