Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
pidcontrol.h
00001 #ifndef PidControl_h 00002 #define PidControl_h 00003 00004 //----------------------------------------------------------------------------- 00005 00006 /// Simple PID controller class 00007 class PIDControl { 00008 public: 00009 /// Default constructor 00010 PIDControl(); 00011 00012 /// Destructor 00013 virtual ~PIDControl(); 00014 00015 /// Set the Proportional, Integral and Derivative gains 00016 virtual PIDControl & setPIDGains( double pGain, double iGain, double dGain ); 00017 00018 /// Set the lower and upper limits for the integrator 00019 virtual PIDControl & setIntegratorLimits( double iMin, double iMax ); 00020 00021 void setPWMParams( float Period, float PulseWidth ); 00022 00023 /// Update loop 00024 virtual double update( double error, double position ); 00025 00026 private: 00027 double m_dState; ///< Last position input 00028 double m_iState; ///< Integrator state 00029 double m_iMax; ///< Maximum allowable integrator state 00030 double m_iMin; ///< Minimum allowable integrator state 00031 00032 double m_iGain; ///< Integral gain 00033 double m_pGain; ///< Proportional gain 00034 double m_dGain; ///< Derivative gain 00035 }; 00036 00037 //----------------------------------------------------------------------------- 00038 00039 #endif //PidControl_h
Generated on Thu Jul 14 2022 00:36:34 by
1.7.2