control theory - Scaling PID (Proportional Integral Derivative) Output -


i have implemented pid function using formula,

correction = kp * error + kd * (error - preverror) + ki * (sum of errors) 

what should keep output between range? 0-255 if disregard value not between 0 255 produces jiggly behavior?

correction = ...  correction2 = correction; if(correction < least) {correction2 = least;} if(correction > most) {correction2 = most;} 

then use correction , correction2 output appropriate.

don't correct based on correction2 , wonder why behaves in odd way when reach edge of least <-> most.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -