PID produces slow oscillation - Page 1
Forum section: electronics / projects

author: miketan3904
author_rank: Contributor
timestamp: September 26, 2021, 03:08:46 pm
content: Hi. I am building a drone and I am testing the PID on single axis of the drone. I used a PID controller and I observed some slow oscillation in the PID output. How do I tune it?

author: Terry Bites
author_rank: Super Contributor
timestamp: September 26, 2021, 03:36:21 pm
content: This is classic hunting.sic In general, a high proportional gain (Kp) can cause overshoot and oscillation, or hunting, for the target point, while the derivative gain (Kd) helps to dampen the system, reducing overshoot and oscillatory motion. A high integral gain (Ki) can also cause overshoot and hunting because it is determined by the sum of errors over time and increases at the end of the move.Are you trying to tune it with the full mechanical load attached? The mechanical inertia makes a big difference to your PID tuning profile. See (79)https://robotics.stackexchange.com/questions/167/what-are-good-strategies-for-tuning-pid-loopshttps://info.incatools.com/ebook-guide-pidtuning

author: Doctorandus_P
author_rank: Super Contributor
timestamp: September 26, 2021, 05:52:51 pm
content: https://en.wikipedia.org/wiki/Ziegler%E2%80%93Nichols_method

author: miketan3904
author_rank: Contributor
timestamp: September 27, 2021, 12:13:22 am
content: Quote from: Terry Bites on September 26, 2021, 03:36:21 pmThe oscillation is really slow and the amplitude is really small. Is it really caused by high P and I gain instead low P and I gain?Quote from: Terry Bites on September 26, 2021, 03:36:21 pmThere are only the motors attached to the drone and the drone is secured on a test jig.

author: bson
author_rank: Unknown
timestamp: September 27, 2021, 12:25:57 am
content: How about cumulative rounding error?

author: miketan3904
author_rank: Contributor
timestamp: September 27, 2021, 12:49:53 am
content: Hi bson, could you please elaborate a little bit in that and briefly explain how to overcome it?

author: Etesla
author_rank: Regular Contributor
timestamp: September 27, 2021, 01:12:23 am
content: If it's easy for you to change the P I D values, it's probably just best to experiment on your own . Apart from modeling your whole system in something like simulink there isn't much you can do to predict how changing your terms will impact the system. Generalizations about what terms are good for what only go so far...

author: MarkF
author_rank: Super Contributor
timestamp: September 27, 2021, 02:21:47 pm
content: Here are two lectures on PID control:https://youtu.be/FsZte3oBW28?list=PLKcjQ_UFkrd43P4lgzCot1hgiUu8onfaj&t=1775https://youtu.be/56PcPbgMZCk?list=PLKcjQ_UFkrd43P4lgzCot1hgiUu8onfaj&t=2418

author: bson
author_rank: Unknown
timestamp: September 28, 2021, 02:26:31 am
content: Quote from: miketan3904 on September 27, 2021, 12:49:53 amWell, rounding-induced oscillation is a common problem in IIR filters, where the feed-forward of rounding errors causes a sinusoidal drift.A quick google found this, but there's a lot of literature and explanations of it.https://flylib.com/books/en/2.729.1/pitfalls_in_building_iir_filters.htmlWhile they cause oscillation in IIR filters, it's easy to imagine when you consistently integrate, like add up the values of an accelerometer to track position, if the roundoff error isn't random your tracking will drift over time. The usual solution is to add a random dither to randomize the error. Like perhaps in the PID controller's I term, which of course is a running sum of errors.It's just a suggestion.