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.
Dependents: Autonomous_quadcopter
Fork of PID by
Diff: PID.cpp
- Revision:
- 5:9bc7a51e97ba
- Parent:
- 4:3f9903757639
- Child:
- 6:02717c0e74ce
diff -r 3f9903757639 -r 9bc7a51e97ba PID.cpp
--- a/PID.cpp Sun Mar 25 10:07:32 2018 +0000
+++ b/PID.cpp Sun Mar 25 12:56:26 2018 +0000
@@ -210,8 +210,10 @@
}
void PID::setSetPoint(float sp) {
- if(stabelized_ == true)
+ if(stabelized_ == true){
+ tauR_ = firstTauR_;
stabelized_ = false;
+ }
setPoint_ = sp;
}
@@ -249,11 +251,12 @@
}
float error = scaledSP - scaledPV;
- if(error < 0.05 && error > -0.05){
+ if(error < 0.005 && error > -0.001){
error = 0;
if(stabelized_ == false){
+ printf("stabelized \n\r");
stabelized_ = true;
- float newTauR = 0.0005;
+ float newTauR = 0.02;
float newError = (accError_ * tauR_) / newTauR;
accError_ = newError;
tauR_ = newTauR;
