Author Topic: PID produces slow oscillation  (Read 1232 times)

0 Members and 1 Guest are viewing this topic.

Offline miketan3904Topic starter

  • Contributor
  • Posts: 38
  • Country: as
PID produces slow oscillation
« on: September 26, 2021, 03:08:46 pm »
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?
 

Offline Terry Bites

  • Super Contributor
  • ***
  • Posts: 2385
  • Country: gb
  • Recovering Electrical Engineer
Re: PID produces slow oscillation
« Reply #1 on: September 26, 2021, 03:36:21 pm »
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-loops

https://info.incatools.com/ebook-guide-pidtuning
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3341
  • Country: nl
 

Offline miketan3904Topic starter

  • Contributor
  • Posts: 38
  • Country: as
Re: PID produces slow oscillation
« Reply #3 on: September 27, 2021, 12:13:22 am »
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.

The 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?

Are you trying to tune it with the full mechanical load attached?

There are only the motors attached to the drone and the drone is secured on a test jig.
 

Offline bson

  • Supporter
  • ****
  • Posts: 2269
  • Country: us
Re: PID produces slow oscillation
« Reply #4 on: September 27, 2021, 12:25:57 am »
How about cumulative rounding error?
 

Offline miketan3904Topic starter

  • Contributor
  • Posts: 38
  • Country: as
Re: PID produces slow oscillation
« Reply #5 on: September 27, 2021, 12:49:53 am »
Hi bson, could you please elaborate a little bit in that and briefly explain how to overcome it?
 

Offline Etesla

  • Regular Contributor
  • *
  • Posts: 149
  • Country: us
Re: PID produces slow oscillation
« Reply #6 on: September 27, 2021, 01:12:23 am »
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...
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2536
  • Country: us
 

Offline bson

  • Supporter
  • ****
  • Posts: 2269
  • Country: us
Re: PID produces slow oscillation
« Reply #8 on: September 28, 2021, 02:26:31 am »
Hi bson, could you please elaborate a little bit in that and briefly explain how to overcome it?
Well, 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.html

While 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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf