etrobocon2019 feat.KatLab  ece30a9a007fff7d3ad48592c0d09a74643377bb
Pid.h
[詳解]
1 
6 #ifndef PID_H
7 #define PID_H
8 
9 // PID制御のみで用いる定数をまとめた構造体
10 struct PidGain {
11  double Kp; // Pゲイン
12  double Ki; // Iゲイン
13  double Kd; // Dゲイン
14  PidGain(double Kp_, double Ki_, double Kd_);
15  void setPidGain(double Kp_, double Ki_, double Kd_);
16 };
17 
18 class Pid {
19  private:
20  double target;
21  PidGain gain;
22  double integral;
23  double preError;
24 
25  public:
26  Pid(double target_, double Kp_, double Ki_ = 0.0, double Kd_ = 0.0);
27  double control(double value, double delta = 0.004);
28  const double setParameter(double target_, double Kp_, double Ki_ = 0.0, double Kd_ = 0.0);
29  const PidGain& setPidGain(double Kp_, double Ki_ = 0.0, double Kd_ = 0.0);
30  double limit(double value);
31 };
32 
33 #endif
double Kp
Definition: Pid.h:11
double Kd
Definition: Pid.h:13
double Ki
Definition: Pid.h:12
void setPidGain(double Kp_, double Ki_, double Kd_)
Definition: Pid.cpp:15
PidGain(double Kp_, double Ki_, double Kd_)
Definition: Pid.cpp:8
Definition: Pid.h:18
Definition: Pid.h:10