Understanding tuning

Hello,

Iā€™m struggling to understand the tuning with PX4.
Generally, I am familiar with PID controls, and I have tuned copters with other flight controls before.

But on PX4 I do not see how the sliders under ā€˜Tuningā€™, e.g.Pitch sensitivity or Roll sensitivity modify the internal Gains like MC_Pitch_* or MC_Pitch_Rate_. I would expect that moving the Slider of the Pitch sensitivity would change MC_Pitch_ or MC_Pitch_Rate_*. But that is not the case (using the latest beta). What am I missing?

Generally, I am happy with the flight behaviour in Acro mode, even with very high Gains. There are no visible oszillations.
But, the controls are way to agressive here. Now here again, I am lacking understanding of the internals of PX4. For other flight Controls, I have understood that the gains should be set as high as possible before oszillations appear in Acro mode. I do NOT have oszillations, but Iā€™d like to reduce the responsiveness in ACRO. Should I do this via the sliders? Or should I do that with some Expo on the TX?

Then, in Stabilized, I DO see oszillations. Nothing major, but clearly visible. I assume, I need to reduce the MC_Pitch_* Gains. Right? But should I do this now, or first tune my Acro Issue above?

Regards,
Hendrik

Hi Hendrik,

I understand the trouble you have been having. I started to look at the acro mode on the weekend
and opened this issue here

When I first went into acro mode with gains that would work fine in stabilized mode I realized that performance in acro was very bad. The vehicle would always drift off in one direction and I constantly had to correct manually. So I cranked up those rate gains and ended up with a solid performance for acro mode (orientation would lock in and it was very responsive).
With my current seting however, stabilized mode is very aggressive in the sense that you can hear decaying oscillations when demanding fast reactions with the rc stick.
I think people flying in stabilized mode would not want to go up as far with the gains so I think for that the slider should be used. Iā€™m not yet familiar with what it does but Iā€™ll have a look and see if it needs to be improved.

Regards,
Roman

Hello Roman,

thanks for your reply.
I am not sure though, that I understand well.
My understanding is, that the PID parameters of the Acro mode, are the inner loop, controling the rate. The PID parameters should be as high as possible, so that the commanded rate is followed quickly by the copter, but low enough not to overshoot.

Once, this is achieved, the agility of the vehicle might be too high. In my view, this should NOT be solved by lowering the PID paramerters, because in other modes, this high agility could be beneficial (i.e. in stabilize, correcting gusts).
If the Copter is too agile, this can be solved in acro mode by limiting the rates, or with some expo -but on the Copter-Side, not on the TX.

in acro was very bad. The vehicle would always drift off in one direction and I constantly had to correct manually.

Could you please clarify this? The behaviour that I experienced could be described in a similar manner, but I come to different conclusions:

  • The copter drifted -thatā€™s natural in Acro, as the Angle (pitch, roll) are not controlled.
  • Correcting the drift is challenging, because the copter is very agile. This leads to pilot induced oszillations (you over-correct)

Could that be the case for you aswell?

I think, whatā€™s needed is no different parameters for the gains in Acro, but the ability to limit the rate (absolute or by expo) in Acro. For other modes, these high gains of the inner loop should be beneficial.

What do you think?

Besides: Iā€™d appreciate, if someone could answer the questions on the parameters (in italic) I asked above. This is still unclear to me.

Regards,
Hendrik

Hi Hendrik,
I think your basic understanding of tuning the loops is right. However, there is not one right tuning.
It depends on what you want to optimise. Do you want to have as little overshoot as possible or do you just want to be fast.

Anyway, weā€™ve updated the rate gains on the quav250 on master so I would encourage you to try those.
If your rate loop is tuned well then in Acro mode you will see the vehicle locking into the orientations.
If you let go of the stick it should just hold that orientation and you should see minimal drift. If there is no wind I have no problem letting the copter hover in front of me for several seconds.
If the rate loop tuning is too soft then you will see it kind off rotating around almost in a circle. Another good indication is that if you e.g. bank it to the side it will actually come back to almost level given the feeling that there is some weak stabilization going on. But actually itā€™s just the controller not correcting the small moment created by the wind.

Let me know how those gains work for you!

Regards,
Roman

P.S. You were also asking about the parameter which would not be changed by the sliders. Iā€™ve never tried it @LorenzMeier Have you played with this?

Hello Roman,

thanks for your reply!
[[quote=ā€œtumbili, post:4, topic:398, full:trueā€]
P.S. You were also asking about the parameter which would not be changed by the sliders. Iā€™ve never tried it @LorenzMeier Have you played with this?[/quote]

Do I understand well, that you work directly with the parameters and not with the sliders at all?

[quote=ā€œtumbili, post:4, topic:398, full:trueā€]
Hi Hendrik,I think your basic understanding of tuning the loops is right. However, there is not one right tuning.It depends on what you want to optimise. Do you want to have as little overshoot as possible or do you just want to be fast.[/quote]
Iā€™m not sureā€¦ If I accept overshoot, will that not always lead to oszillations?
Anyway: In my case, I do not see any overshoot. BUT: The copter is way to agile. This way, I cause overshoot, and by that Pilot Induced Oszillations (PIO). This has nothing to do with PID. Just imagine going 180km/h (or whatever is allowed in your contry :wink: with your car. And now a movement of the steering-wheel of 3Ā° rotates the wheels by 20Ā°.
This will lead to oszillations, but this is not caused by too high PID Gains. It is purely caused by the driver. I have the impression, that this is my problem.

Of course, this CAN be mitigated by lower gainsā€¦ But this is not the root cause. The root cause is that the Pilot (me) is not able to use the sticks accurately enough. BUT: The outer loop controller (aka stabilize) can use the controlls accurately enough. By reducing the gains of the inner loop, we limit the agility of the copter, trying to overcome our (=the humans) limitation. But in doing this, we also limit what the stabilize controller can do.

You are right: This can be done. But another way to fix this -and I think this would fix the root cause- is to add some expo in Acro. This should result in a better control in stabilize.

Does this make sense, or am I missing something?

Although my copter is a H680, i.e. three times as big?

[quote]If your rate loop is tuned well then in Acro mode you will see the vehicle locking into the orientations.If you let go of the stick it should just hold that orientation and you should see minimal drift. [quote]
Yes, I do. But I do not see minimal drift, but strong drift. This is, because a slight input on the RC leads to a high roll angle. Thus, the drift is strong. But: yes, the locking of the orientation is very good.

Iā€™ll try. After your confirmation that itā€™s a good idea despite the large difference in size.
When were the gains updated? I am using the beta from last weekend.

Greetings,
Hendrik

Hi Hendrik,

I think you are right about the expo. Are you able to set expo on your remote? Because we donā€™t support expo in the software at the moment.

If you have a different quad then I donā€™t think that those 250 gains will apply.
You will have to try to tune in yourself. Best is to have someone who can increase the rate gains for you while you are flying. And make sure to only increase them by about 0.02 at a time. If your tuning was bad you will immediately notice how it improves the more you increase the gain.

Regards,
Roman

Hi Roman,

yes, I can add expo on the remote.
The question is:
Shall we solve my problem, or is this maybe a way to generally improve the tuning.
I think today, the inner loop gains need to be reduced if the copter is too agile.
If weā€™d add expo, this would not be needed anymore.
What do you think?

But Iā€™m happy to give it a try beforehand.

Greetings,
Hendrik

Hi Hendrik,

I have my TX set up to use expo when in ACRO mode, and linear stick response in all other modes.
If expo doesnā€™t reduce the center-stick rate sensitivity enough for you in ACRO mode, you should next try reducing
MC_ACRO_R_MAX, MC_ACRO_P_MAX and MC_ACRO_Y_MAX. Those default to 360 deg/sec, and I also found them to be too sensitive near center without expo, but I need rates at least that fast to do flips and rolls.
Of course, you could always use Rattitude mode, if what you really want is self-leveling at center stick.