daad

Dependencies:   mbed TrapezoidControl QEI

Committer:
7ka884
Date:
Mon Oct 01 13:47:19 2018 +0000
Revision:
4:ba9df71868df
huhuhuh

Who changed what in which revision?

UserRevisionLine numberNew contents of line
7ka884 4:ba9df71868df 1 /*
7ka884 4:ba9df71868df 2 * PID.h
7ka884 4:ba9df71868df 3 *
7ka884 4:ba9df71868df 4 * Created: 2016/07/01 17:47:45
7ka884 4:ba9df71868df 5 * Author: yuuki
7ka884 4:ba9df71868df 6 */
7ka884 4:ba9df71868df 7
7ka884 4:ba9df71868df 8
7ka884 4:ba9df71868df 9 #ifndef PID_H_
7ka884 4:ba9df71868df 10 #define PID_H_
7ka884 4:ba9df71868df 11
7ka884 4:ba9df71868df 12 namespace PID_SPACE
7ka884 4:ba9df71868df 13 {
7ka884 4:ba9df71868df 14 class PID
7ka884 4:ba9df71868df 15 {
7ka884 4:ba9df71868df 16 private:
7ka884 4:ba9df71868df 17 double diff[2];
7ka884 4:ba9df71868df 18 double integral;
7ka884 4:ba9df71868df 19 double deltaTime;
7ka884 4:ba9df71868df 20 double dataRangeLower;
7ka884 4:ba9df71868df 21 double dataRangeUpper;
7ka884 4:ba9df71868df 22 double kp,ki,kd;
7ka884 4:ba9df71868df 23 double mv;
7ka884 4:ba9df71868df 24
7ka884 4:ba9df71868df 25 public:
7ka884 4:ba9df71868df 26 // deltaTime:1サイクル時間( 1 / Process Frequency )
7ka884 4:ba9df71868df 27 PID(double deltaTime);
7ka884 4:ba9df71868df 28 PID(double deltaTime, double dataRangeLower, double dataRangeUpper);
7ka884 4:ba9df71868df 29 PID(double deltaTime, double dataRangeLower, double dataRangeUpper, double KP, double KI, double KD);
7ka884 4:ba9df71868df 30
7ka884 4:ba9df71868df 31 //パラメータを設定
7ka884 4:ba9df71868df 32 void SetParam(double KP, double KI, double KD);
7ka884 4:ba9df71868df 33
7ka884 4:ba9df71868df 34 //測定量を入力し操作量を取得
7ka884 4:ba9df71868df 35 double SetPV(double sensorData, double targetData);
7ka884 4:ba9df71868df 36
7ka884 4:ba9df71868df 37 //操作量を取得
7ka884 4:ba9df71868df 38 double GetMV();
7ka884 4:ba9df71868df 39
7ka884 4:ba9df71868df 40 //入力した値を制限して取得
7ka884 4:ba9df71868df 41 double limit(double data, double lower, double upper);
7ka884 4:ba9df71868df 42
7ka884 4:ba9df71868df 43 //TODO:速度系PID関数
7ka884 4:ba9df71868df 44 double SetSpeed(double sensorData,double targetData);
7ka884 4:ba9df71868df 45 };
7ka884 4:ba9df71868df 46
7ka884 4:ba9df71868df 47
7ka884 4:ba9df71868df 48 }
7ka884 4:ba9df71868df 49
7ka884 4:ba9df71868df 50
7ka884 4:ba9df71868df 51
7ka884 4:ba9df71868df 52 #endif /* PID_H_ */