a

Dependencies:   HCSR04_2 MPU6050_2 mbed SDFileSystem3

Fork of Autoflight2018_12 by 航空研究会

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pid.h Source File

pid.h

00001 #ifndef PID_MBED_H
00002 #define PID_MBED_H
00003 
00004 
00005 #include "mbed.h"
00006 
00007 class PID
00008 {
00009 public:
00010     double kp, ki, kd, max, min, dt; 
00011 
00012     //コンストラクタ
00013     PID();
00014     PID(double Pgain, double Igain, double Dgain);
00015     PID(double Pgain, double Igain, double Dgain, double Max, double Min);
00016     //デストラクタ
00017     ~PID();
00018 
00019     void initialize(void);
00020     void setPIDgain(double Pgain, double Igain, double Dgain);
00021     void setMaxMin(double Max, double Min);
00022     void switchMaxMin(bool Maxcheck, bool Mincheck);
00023     double calcPID(double nowval, double targetval, double dt);
00024 
00025 
00026 private:
00027     double integral;
00028     double oldval[2], diff[2];
00029     bool maxcheck, mincheck;
00030 };
00031 
00032 #endif