Tuning PID for multiple flight phases, TOW and altitudes on a 16 inch copter

Did ACCEL Level, the values of AHRS X,Y changed by 0.004 rads or 0.22 degrees, so nothing, Z was zero did not change

Did the test flight:

https://www.ecoterrenos.cl/Flight_15_01.bin

Did not feel too bad, but slightly worse.

MOT_THRST_EXPO remained at 0.55
Descent rate also remained reduced to 3 m/s

Thanks for that SMAX info, good work on figuring that out!

You now have the ESC data in that log, so you can set these and forget about it forever more:

Note that the frequency and bandwidth is lower than you’d expect - this is just the minimum or starting point, and the ESC RPM input will scale them up to the correct values dynamically.
I selected the final option there because there are some brief drop-outs in the RPM data.

Yaw control is very tight and my only concern with that is it could be detracting from pitch and roll somewhat. Usually yaw P term over 1.0 is getting too high and tends to cause occilations at arming, especially with long landing gear.
I would lower the Yaw PIDs, at least temporarily, while pitch and roll is sorted out. You can always put back the higher values later if you find yaw is lacking control. Yaw is much less critical and easier to sort out last.

ATC_RAT_YAW_D,0.008
ATC_RAT_YAW_I,0.08
ATC_RAT_YAW_P,0.80

The attitude control in that log does look conventional and quite fixable, I feel it’s not far from being good.
My normal process would be to do another test flight now, and if the harmonic notch filter log detail matches expectations (and it should) then I’d probably just run an autotune.
If the notch filter is working well you can set these to reduce the size of log files:

INS_LOG_BAT_MASK,0
INS_LOG_BAT_OPT,0

Thanks again.´

Yes, I have seen the RPM. Was surprised about constantly varying RPMs, assume that these are due to bad sensoring, not real oscillations of RPM.

I will set the filter and yaw, will do a test flight, and then will autotune.

Still, there are oscillations in the log. They are somewhat smaller, but the overall behaviour is also somewhat worse…

Now, the yaw could be a factor…

Apart from the fuzziness of your RPM line the reported RPM is real enough, except for where there’s some momentary drops to zero - that’s just some missed packets or something. Remember the BLHELI_S ESCs are only 8bit processors, so that fuziness in the RPM values could be related to that too - I dont have any 8bit ESCs to compare with.
The flight controller is constantly demanding RPM changes to control attitude.

You can see the RCout (demand) versus RPM (achieved) is so close there’s no effective difference.

Hi Shawn!

Did the test flights:

Pre Autotune: https://ecoterrenos.cl/Flight_Preautotune.bin
Postautotune: https://ecoterrenos.cl/Flight_Postautotune.bin

Preautotune test flight felt about the same as the yesterday’s flight, just maybe a little bit less firm.

Did autotune:

Post Autotune test flight was mainly OK, however, at some point I felt oscillations on descent and slow forward flight in Alt Hold, and occasional shakiness in Loiter mode, especially when transitioning from full down to full up power. This shakiness was not too bad (compared to the behaviour I had two weeks ago when it was almost crashing after autotunes), but still very much present.

Overall, I would say that this Autotune produced the best result of all Autotunes I have done so far, but still it feels slightly less stable than the manually overtuned copter I had 2 days ago.

On the graphs, the oscillations are present, and especially worrysome is the Loiter Mode, for instance, at 10:53:26, you can see not only the oscillations of the pitch, but also of the desired pitch, that is extremely dangerous, because FC basically starts PIO, i.e. FC induced oscillations. Here, they did not progress, but two weeks ago, with a different PIDs, that almost crashed the copter in LOITER mode (oscillations went to 30º).

If I can compare the manuallly tuned and autotuned differences, it seems that autotune gave much higher Angle values (P and Rate), about 50 %, and reduced the PI by more than 50 %. I suspect that the FC induced oscillations in Loiter Mode may be due to the higher Angle values, but that is just an impression. The lower PI may reduce overall oscillation tendency, but makes the response to strong disturbances (gusts, or prop wash on descent) less affirmative…

Try reducing the Stabilise P terms for pitch and roll by 10%

ATC_ANG_PIT_P,13.5
ATC_ANG_RLL_P,9.7

and the accels too:

ATC_ACCEL_P_MAX,79900
ATC_ACCEL_R_MAX,74590

and go from there.

In that post-autotune log almost all of the instability is during descent, so you might be able to lower the thrust expo another point or two.

As always:
BATT_FS_CRT_ACT,1

Thanks, I will do that…

But we are again almost arriving at the manually obtained values…

Hi Shawn!

Did the test flight.

Overall, it felt slightly worse, slightly less stable in transitions from descent to climb, with stable small oscillations on descent and forward flight in Althold and Loiter Mode, also very light instability at high speed flight at 75 km/h.

I assume that this is due to slightly lower P angle parameters. Not sure if it related to MOT THR EXPO of 0.5 instead of 0.55, but I doubt it.

My natural instinct would be to hike up the PI of roll and pitch without increasing D, which should reduce high freq oscillations and give more authority to counteract disturbances…

https://ecoterrenos.cl/Flight_17_01.bin

If you can get some frequency sweep data using the system ID mode then the analytic tune web tool would take a lot of the guess work out of this process. If you understand the analysis and want to try it out, that would be a great way to do this. Sorry that I haven’t got a tutorial out on the tool.

I am waiting for a new FC with H7 2MB processor, because I can not run anything on SpeedyBee F405 FC… I am sure I will try out your tool later. Because up to now, it was a very long and complicated process, I never thought that it could get that complicated… I logged already 10 hours of test flights… But anyway, I do not regret, because I have learnt a lot…

Before changing the rate PIDs at all, just increase the Angle P’s first.
Previously Iwas thinking that reducing them to see the effect was safest.
Now I would go the other way, +10%, and leave the accels like they are now:

ATC_ANG_PIT_P,16.5
ATC_ANG_RLL_P,11.85

I know this is not very scientific - you could put these on a tuning knob and quickly arrive at a suitable Angle P as per the tuning guide.
When necessary, change the rate PIDs in small amounts and try to keep P and I equal.

Thanks Shawn!

I will make a test run with just the increased P Angle, and then will try two test runs with increased PIDs, increasing just the PI, without touching D.

Well,

Here are the results of different parameters:

Flight 1: oscillations on descent much more clear

ATC_ANG_PIT_P,16.5
ATC_ANG_RLL_P,11.85

https://ecoterrenos.cl/Flight_1.bin

Flight 2: oscillations on descent even more pronounced, also there was overshoot when moving the stick from extreme to extreme. Instability in Loiter mode dangerous, and overall instability

ATC_ANG_PIT_P,16.5
ATC_ANG_RLL_P,11.85
ROLL PI: 0.11 (+20%)
PITCH PI: 0.11 (+20%)

https://ecoterrenos.cl/Flight_2.bin

Flight 3: much better, oscillations considerably reduced.

ATC_ANG_PIT_P,11 (-30%)
ATC_ANG_RLL_P,8.3 (-30%)

https://ecoterrenos.cl/Flight_3.bin

Flight 4: Oscillations on descent with forward motion even better, but instability on vertical descent, esepcially in Loiter Mode.

ATC_ANG_PIT_P, 7.7(-30%)
ATC_ANG_RLL_P, 5.8 (-30%)

https://ecoterrenos.cl/Flight_4.bin

Resuming: increasing P angle response affects strongly the oscillations on descent. Reduction of the P angle decreases the oscillations on descent. Since the reduction of P angle reduces overall response, with too low P angle values overall instability seems to increase. Next logical step to me would be to increase the PI and possibly D. That would probably generate high frequency oscillations. And most probably I will arrive at the same parameters which I had before (for the high altitude flight), where there were high frequency oscillations but which did not cause visual problems.

The philosophical question here is: what is better, to have nice-looking logs, which potentially can resut in a crash, or bad logs with oscillations but which seem to result in seemingly good flight behaviour? I was very satisfied with the tune I had before (during the high altitude flights), except for the oscillations which were on the logs.

Do you have any clue as to why the copter does not want to tune itself. I doubt that this is a problem with tuning procedures, i.e. what we are doing goes well beyond what one usually should do. It is like tuning the untunable…

In any case I am waiting for a new set of motors, 700 kV, instead of the current 350 kV, which would use 13 inch props, and my hope is that the probIem may stem fro too large props.

Do you think that by extending the arms the overall response could improve dramatically?

As of now, the 16 inch prop has very good clearance, there is no interference with the body, but if I extended the motor separation by let us say 25 %, could that dramatically improve the stability? The diagonal distance beteween motors is now 70 cm. If I increase it to 90 or even 100 cm, keeping the same props, do you think that could improve significantly the behaviour?

It will make copter heavier and will generate more air resistance, but if this results in a much stabler copter, I am quite willing to try it out. In the end, this a scratch-designed copter and maybe I do not have enough experience yet to such things.

Another thing I was thinking off is the CG. It is pretty much on the same level as the motors, i.e. upper part of the motor is on the same level as battery.

I am thinking if lowering the battery could change the behaviour. If the CG is lower, for one thing the rotational intertia will increase, and that could dampen both the oscillations and wobble during the descent, but at the same time that would make the copter less responsive. Not really sure if it is true.