Page 1 of 1

how to select the pid value?

Posted: Wed Jun 01, 2016 3:28 pm
by justinleeyang
Hi,

I have checked the Rll/Pitch/Yaw Attidute/Rate PID value, as follow:

Code: Select all

#define PID_ROLL_RATE_KP  250.0
#define PID_ROLL_RATE_KI  500.0
#define PID_ROLL_RATE_KD  2.5
#define PID_ROLL_RATE_INTEGRATION_LIMIT    33.3

#define PID_PITCH_RATE_KP  250.0
#define PID_PITCH_RATE_KI  500.0
#define PID_PITCH_RATE_KD  2.5
#define PID_PITCH_RATE_INTEGRATION_LIMIT   33.3

#define PID_YAW_RATE_KP  70.0
#define PID_YAW_RATE_KI  16.7
#define PID_YAW_RATE_KD  0.0
#define PID_YAW_RATE_INTEGRATION_LIMIT     166.7

#define PID_ROLL_KP  10
#define PID_ROLL_KI  4.0
#define PID_ROLL_KD  0.0
#define PID_ROLL_INTEGRATION_LIMIT    20.0

#define PID_PITCH_KP  10
#define PID_PITCH_KI  4.0
#define PID_PITCH_KD  0.0
#define PID_PITCH_INTEGRATION_LIMIT   20.0

#define PID_YAW_KP  10.0
#define PID_YAW_KI  1.0
#define PID_YAW_KD  0.35
#define PID_YAW_INTEGRATION_LIMIT     360.0
I want to know why select the value, how to adjust them?
Thanks!

Re: how to select the pid value?

Posted: Mon Jun 06, 2016 9:08 pm
by theseankelly
Hey Justin

PID tuning is easy to understand but amazingly hard to get correct -- in fact, you can't usually mathematically prove a set of coefficients to be optimal.

These algorithms rely directly on the output as inputs, so they can't easily be simulated, modeled, or calculated. It's really just a guess and check process. Change a value, see how it affects flight. With that in mind, these values are almost certainly not the best possible values. I intend to keep tuning and seeing how things behave with different combinations.

Here's a good article that's specific to quadcopter applications: http://open-txu.org/home/special-intere ... id-tuning/

Give my other thread a read for some insight in how I came up with these values and how they relate more specifically to the crazyflie controller: viewtopic.php?f=6&t=1978