Hacker News new | ask | show | jobs
by leafario2 1842 days ago
1) this is the same problem like controlling the angle of a quad copter, for which I have used PID. You can calculate the error of the position, which is in the range -180..179. Applying one PID stage to the error of the orientation yields a "desired rate of change" - it increases if the error is large or held for a long time and it's sign describes the direction of the rate of change of orientation. You can use another PID stage to give a step count power iteration (how much to turn the object). 2) integral windup is commonly prevented by just capping it. You can also use a smoother capping function which bounds the size of the integral, or lowers it on each iteration.
1 comments

Capping and/or gradually lowering the the integral part seems like an elegant solution. Thanks for your input! This is something which is never told but should be part of every PID controller resource on the web.
An alternative to capping is to avoid adding anything to the integral term in situations where the actuator is already at 0% or 100% of the possible range.