pid.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: pid.h,v $ 00023 * Revision 1.7 2006/07/14 12:23:32 martius 00024 * selforg becomes HEAD 00025 * 00026 * Revision 1.6.4.3 2006/02/07 15:51:56 martius 00027 * axis, setpower 00028 * 00029 * Revision 1.6.4.2 2006/01/10 14:48:59 martius 00030 * indentation 00031 * #ifdef clausel 00032 * 00033 * Revision 1.6.4.1 2005/12/20 17:53:42 martius 00034 * changed to Joints from joint.h 00035 * new servos for universal and hinge2 00036 * 00037 * Revision 1.6 2005/11/09 14:08:48 martius 00038 * *** empty log message *** 00039 * 00040 * Revision 1.5 2005/11/09 13:28:24 fhesse 00041 * GPL added 00042 * * 00043 ***************************************************************************/ 00044 #ifndef __PID_H 00045 #define __PID_H 00046 00047 namespace lpzrobots { 00048 00049 class PID 00050 { 00051 //*********************attributes*************** 00052 //private: 00053 public: 00054 00055 double position; 00056 double lastposition; 00057 double last2position; 00058 00059 double error; 00060 double lasterror; 00061 00062 double targetposition; 00063 00064 double KP; 00065 double KD; 00066 double KI; 00067 double alpha; 00068 00069 double P; 00070 double D; 00071 double I; 00072 00073 double force; 00074 00075 //*********************methods****************** 00076 public : 00077 /// KP is used as a general koefficient. KI and KD can be tuned without dependence of KP 00078 PID ( double KP = 100 , double KI = 2.0 , double KD = 0.3 ); 00079 00080 void setKP(double KP); 00081 00082 void setTargetPosition ( double newpos ); 00083 00084 double getTargetPosition (); 00085 00086 double step ( double newsensorval ); 00087 double stepWithD ( double newsensorval, double derivative ); 00088 }; 00089 00090 } 00091 00092 #endif

Generated on Tue Jan 16 02:14:37 2007 for Robotsystem of the Robot Group Leipzig by doxygen 1.3.8