Trying to optimize the performance of my copter, I run into the following two variables used by the DCM to correct Gyro drift.
Unfortunately I have no big knowledge of DCM even though I understand the basics.
I'm just trying to understand the importance and the effects of those two variables for the everyday flight.
First of all I see that these are setted by default in the constructor of the DCM to:
Then in the init_ardupilot() function they are set to:
// setup DCM for copters:
dcm.kp_roll_pitch(0.12); // higher for quads
dcm.ki_roll_pitch(0.00000319); // 1/4 of the normal rate
Recent changes in the code from Jason have included a function for fast recovery (to avoid drift issues) that sets the dcm.kp_roll_pitch to 0.15 when there is no stick input and back to 0.05967 otherwise.
Now all these settings are a little confusing: the DCM is initialized with 0.05967, then it is set to 0.12 and then the new code switches between 0.05967 and 0.15. But at the moment excluding Jason's function, the value of 0.05967 is never actually used...
I understand that these values are useful to compensate for gyro drift but what I don't understand is how they affect flying behaviour.
What I'm trying to obtain is a good response from the sticks without loosing stability.
At the moment to have a stable quad I have to lower the P value to at least 0.3 (default from ACM coders is 0.54) and rise my D to 0.17 (default is 0.12) otherwise the quad will oscillate (a costant oscillation at abot 2Hz -rough calculation-) This causes a sloppy control, something I would like to avoid.
In Bill's paper it is stated:
"Selection of the weights and gains is a compromise between accuracy and speed of recovery to disturbances. The practical realities of the wind and gyro saturation favor using weights and gains that are large enough to recover in about 10 seconds. In the feedback loop, the DCM algorithm is a nonlinear integrator. Therefore, you can select the gains for the linearized equivalent dynamic model of the complete loop."
Hehe... how do I in practice calculate them?
If I understand correctly Higher gains recover quickly but are less accurate and prone to instability?
Or is it the opposite?
Thank for anyone clarifying this, and sorry for long writing... :)