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

silverlight - Applying a style to ItemContainerStyle in C# -

c# - NullReferenceException in MySqlClient.NativeDriver -

php - Updating recent updates - Problem in procedure - Any other approach? -