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.
Dependencies: mbed MODSERIAL FATFileSystem
PidController.hpp
00001 #ifndef PIDCONTROLLER_H 00002 #define PIDCONTROLLER_H 00003 00004 #include "mbed.h" 00005 00006 class PIDController { 00007 public: 00008 PIDController(); 00009 00010 void update(float position, float velocity, float dt); 00011 float getOutput(); 00012 00013 void setPgain(float gain); 00014 void setIgain(float gain); 00015 void setDgain(float gain); 00016 00017 void writeSetPoint(float cmd); 00018 00019 void setHiLimit(float high_limit); 00020 void setLoLimit(float low_limit); 00021 00022 void toggleDeadBand(bool toggle); 00023 void setDeadBand(float deadband); 00024 00025 void setHeadingFlag(bool heading_flag); 00026 00027 protected: 00028 float _setPoint; 00029 float _error; 00030 float _integral; 00031 float _output; 00032 00033 float _Pgain; 00034 float _Dgain; 00035 float _Igain; 00036 float _hiLimit; //these parameters clamp the allowable output 00037 float _loLimit; //these parameters clamp the allowable output 00038 float _deadband; 00039 bool _deadbandFlag; 00040 bool _headingFlag; 00041 00042 float _temp_velocity; 00043 }; 00044 00045 #endif
Generated on Thu Jul 14 2022 10:54:35 by
