7 constexpr bool EXCEED_MICROS_LIMIT =
false;
9 constexpr unsigned long MAX_MICROSECONDS = ULONG_MAX;
10 constexpr double MICROSECONDS_TO_SECONDS = 1.0 / 1000000.0;
23 unsigned long preMicros;
26 double capableDutyCycle;
45 PID(
double capableDutyCycle,
double Kp,
double Ki,
double Kd,
double current,
double target,
bool direction);
54 void setGains(
double Kp,
double Ki,
double Kd);
61 void setKp(
double Kp);
68 void setKi(
double Ki);
75 void setKd(
double Kd);
82 void setTarget(
double target);
89 double getTarget()
const;
96 double getCurrent()
const;
104 double getDutyCycle()
const;
118 void reset(
double target);
127 void reset(
double Kp,
double Ki,
double Kd);
137 void reset(
double Kp,
double Ki,
double Kd,
double target);
146 double compute_PID(
double current,
bool logging =
false);
159 inline void PID::setGains(
const double Kp,
const double Ki,
const double Kd)
179 this->target = target;
187 return this->current;
191 return this->dutyCycle;
195 preMicros = micros();
201 this->target = target;
205 inline void PID::reset(
const double Kp,
const double Ki,
const double Kd)
213 inline void PID::reset(
const double Kp,
const double Ki,
const double Kd,
const double target)
218 this->target = target;
double getDt() const
Get the Dt object.
Definition PID.h:153
void setKi(double Ki)
Set the Ki object.
Definition PID.h:169
void setKp(double Kp)
Set the Kp object.
Definition PID.h:165
double dt
dt[s]
Definition PID.h:32
void setTarget(double target)
目標を変更する。
Definition PID.h:177
void setKd(double Kd)
Set the Kd object.
Definition PID.h:173
double getTarget() const
目標を取得する。
Definition PID.h:181
void reset()
制御器のリセット
Definition PID.h:193
double getCurrent() const
現在値を取得する。
Definition PID.h:185
void setGains(double Kp, double Ki, double Kd)
ゲインを変更する。
Definition PID.h:159
double getDutyCycle() const
Duty比の取得
Definition PID.h:189