updated for quadcopter
Dependents: Autonomous_quadcopter
Fork of PID by
Diff: PID.cpp
- Revision:
- 7:8ee2f9ba6ac3
- Parent:
- 6:02717c0e74ce
--- a/PID.cpp Tue May 15 10:34:07 2018 +0000 +++ b/PID.cpp Tue May 22 19:37:34 2018 +0000 @@ -218,6 +218,11 @@ } +void PID::setLandingPoint(float sp) { + setPoint_ = sp; + +} + void PID::setProcessValue(float pv) { processVariable_ = pv; @@ -251,7 +256,7 @@ } float error = scaledSP - scaledPV; - if(error < 0.005 && error > -0.001){ + if(error < 0.002 && error > -0.001){ error = 0; if(stabelized_ == false){ printf("stabelized \n\r"); @@ -268,7 +273,6 @@ //integrate if it is not. This is to prevent reset-windup. if (!(prevControllerOutput_ >= 1 && error > 0) && !(prevControllerOutput_ <= 0 && error < 0)) { accError_ += error; - } //Compute the current slope of the input signal. @@ -321,6 +325,10 @@ return stabelized_; } +void PID::setNotStabelized(){ + stabelized_ = false; +} + float PID::getInMin() { return inMin_;