D term scaling (PID tuning)

Post Reply
nebbian
Posts: 67
Joined: Mon Jul 21, 2014 6:54 am

D term scaling (PID tuning)

Post by nebbian »

I've been having some issues tuning my Tricopter, and was wondering if anyone else had come across this issue.

My specs:
1 KG tricopter, with 900 kv motors and 11" props.
I'm using the experimental PID method (method 2), as the method 1 was woeful in angle mode (although it showed the same behavior as method 2 when in acro).

I started by tuning the P term with my Tri suspended on a string, which worked well. I turned this up until I was happy with the response. I ended up with a value of around 15 for P.

Then I took it outside and tuned the D term to try to reduce the overshoot. Even with D at 100, the arms would overshoot by at least 10% of the total travel, and 'ring' for at least one cycle. This indicates to me that the system is underdamped.

Eventually I rolled up my sleeves, and modified the PID loop to multiply the D term by 10. Now the response is critically damped, with no overshoot at all, and no ringing.

Has anyone else come across this? I can't see that my specs are very different to most people.

Why isn't the base system set up so that with a large value of D, the system becomes overdamped?

BirdShredder
Posts: 31
Joined: Mon Jun 16, 2014 10:50 pm

Re: D term scaling (PID tuning)

Post by BirdShredder »

First of: I'm not awfully familiar with the MW code, but I _think_ I do understand PID controllers. That said, this situation seems strange to me. When your derivative term comes close[1] to your proportional term it can play a larger (than P) role in the PID output. Thus causing your craft to rotate *away* from your setpoint. And ofcourse the direction of rotation will than change and the D-term will flip sign, pushing the other way. Hard to say what the effect will be, I imagine a very fragile stability, slow converging to the set point and maybe a nervous feeling quad.

Exactly at what value of P and D the D term becomes bigger than the P-term might depend on the implementation.

[1] 'close' here might depend on how fast your pid-loop is and ultimately how fast your motors can respond.

ctzsnooze3
Posts: 11
Joined: Thu Aug 07, 2014 7:23 am

Re: D term scaling (PID tuning)

Post by ctzsnooze3 »

HI
You might be trying to tune D in the wrong direction.
Most of us think that higher D numbers mean *more* Differential component in a classical PID algorithm. Actually, in multiwii, it is the other way around.
See http://www.multiwii.com/wiki/?title=PID
Higher D numbers in the GUI actually *reduce* the Differential component of a classical PID algorithm. This is a strange way to code it, but basically it means that higher D values mean faster responses, more oscillation tendency, less damping - just like high P values. So for the casual users, bigger numbers = more responsive.
But this makes it difficult for people who think that bigger D numbers in the GUI mean *more* damping - they actually mean that LESS differential damping - there is LESS damping at a D value of 100 than a D value of 1. D of 100 means, effectively, NO DIFFERENTIAL DAMPING!
You can verify this easily in hand testing. Try a D value of say 5, and you'll see a sluggish response to sticks and a delayed return to normal position following a transient external offset.
I would suggest restoring the code back to normal, setting D to 100 (effectively off), then increase P stepwise until you get P oscillations. Back off until they just stop or are only just apparent. Then decrease the D number (increase damping) until you see obvious differential damping (delayed return to previous position after external transient force). Then increase the D number (reduce damping) until you no longer perceive any residual damping effects, or they are just barely perceptible. You should now find that you can increase P a bit more, past the previous oscillation point, with a faster response but less oscillation! If you do get oscillation as you add even more P, you can try REDUCING the D number (increasing the damping) a little bit, and you may control the oscillation despite additional P. There is a limit to what you can achieve, typically you cant get much more than 50% extra P from the point at which undamped oscillations are first obvious with a high D number in the GUI, but with the right balance you should theoretically optimise response.
You should then have a nicely optimised response.
Anyhow I think that's why you were having these issues.
C

Post Reply