Homepage | Demos | Overview | Downloads | Tutorials | Reference | Credits |
00001 //-*-c++-*- 00002 #ifndef INCLUDED_OutputPID_h 00003 #define INCLUDED_OutputPID_h 00004 00005 //! This object holds all the information needed to control a single output 00006 class OutputPID { 00007 public: 00008 OutputPID() : weight(0) { pid[0]=pid[1]=pid[2]=0; } //!< Constructor 00009 OutputPID(const float p[3]) : weight(1) { set_pid(p); } //!< Constructor 00010 OutputPID(const float p[3], float w) : weight(w) {set_pid(p);} //!< Constructor 00011 OutputPID(const OutputPID& a, const OutputPID& b, float w) : weight(0) { set(a,b,w); } //!< Constructor, see set(a,b,w) 00012 00013 inline void set(const float p[3], float w=1) { set_pid(p); weight=w; } //!< sets the value to @a v and weight to @a w 00014 00015 //! sets the value to a weighted average of @a a and @a b (higher @a w, more @a a) 00016 inline void set(const OutputPID& a, const OutputPID& b, float w) { 00017 pid[0]=a.pid[0]*w+b.pid[0]*(1-w); 00018 pid[1]=a.pid[1]*w+b.pid[1]*(1-w); 00019 pid[2]=a.pid[2]*w+b.pid[2]*(1-w); 00020 weight=a.weight*w+b.weight*(1-w); 00021 } 00022 inline void unset() { weight=0; } //!< sets value and weight to 0 (same as assigning ::unusedJoint) 00023 00024 float pid[3]; //!< pid value of the output 00025 float weight; //!< weight to be used in averaging, 0 to "fall through" 00026 00027 protected: 00028 inline void set_pid(const float p[3]) { //!< handy utility function 00029 pid[0]=p[0]; 00030 pid[1]=p[1]; 00031 pid[2]=p[2]; 00032 } 00033 }; 00034 00035 /*! @file 00036 * @brief Describes OutputPID, holds information needed to control a single output 00037 * @author ejt (Creator) 00038 * 00039 * $Author: ejt $ 00040 * $Name: tekkotsu-1_4_1 $ 00041 * $Revision: 1.3 $ 00042 * $State: Exp $ 00043 * $Date: 2003/04/09 07:01:30 $ 00044 */ 00045 00046 #endif
Tekkotsu v1.4 |
Generated Sat Jul 19 00:06:31 2003 by Doxygen 1.3.2 |