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.
Fork of PID by
Diff: PID.cpp
- Revision:
- 6:775c9421fe3b
- Parent:
- 5:3519920d064d
- Child:
- 7:66e3f3fd08d8
--- a/PID.cpp Wed Sep 23 06:01:32 2015 +0000
+++ b/PID.cpp Fri Oct 30 12:47:54 2015 +0000
@@ -52,6 +52,7 @@
{
timer = p.timer;
data = 0;
+ bias=0;
GAIN_P = p.GAIN_P;
GAIN_I = p.GAIN_I;
GAIN_D = p.GAIN_D;
@@ -63,6 +64,7 @@
{
timer=T;
data = 0;
+ bias=0;
GAIN_P = tauKp;
GAIN_I = tauKi;
GAIN_D = tauKd;
@@ -137,7 +139,7 @@
else if(data<OutMin)s_dErrIntg=OutMin;
else s_dErrIntg += (dErr+dErr_prev )* T /2.0;
// 制御入力
- dRet = GAIN_P * dErr + GAIN_I * s_dErrIntg + GAIN_D*dErrDiff;
+ dRet = bias+GAIN_P * dErr + GAIN_I * s_dErrIntg + GAIN_D*dErrDiff;
dErr_prev = dErr;
if(dRet>OutMax)data=OutMax;
@@ -150,3 +152,4 @@
+
