Initial values of the parameters before autotune

@bnsgeyer
Hello Bill,

a simple question about the initial values of the parameters for preparing for AUTOTUNE. If I have carried out a manual tuning and have found parameter values that work reasonably well, can I leave these values in the FC or do I have to go back to the basic values as specified in the WIKI?

I hope I have expressed myself clearly.

BR

Heri

No need to go back. Use the values from your manual tune as a starting point.

1 Like

This is not entirely true for Heli autotune. If you exceed optimum values of Rate P and Rate D gains with your manual tune then it doesn’t reduce the rate P and rate d gain. So I would recommend halving your rate P and D gains before starting autotune just to be sure it can still raise the gains to find the optimum value. The FF gain tuning starts from a calculation so it is not affected and the angle P gain tuning will increase and decrease to find the right value.

2 Likes

@bnsgeyer
Hi Bill,

thank you for your advice.

Should I do so for all axes (Roll, Pitch,Yaw)?

BR

Heri

Good question. You can halve the rate p and d gains for pitch and roll axes. How much did you change the yaw axis gains? That axis relies on rate p gain a lot more so it might be best to go back to the default gains for yaw.

Thank you.

I will do so.

BR

Heri

Hello,

After manual tune dual tandem heli, I’m preparing autotune.

And about the ATC ACC MAX, is it best starting from init values (aka 110000 centidegrees /s/s) or is best starting from log analys manual flight after the best manual tune? (I determined 40000 for pitch and 60000 for roll)

Also for dual tandem heli, what about the autotune max gains for pitch roll and yaw?
can you advice about?

@kuspower good to hear that you plan to use autotune.

That is a good question. It really depends on your concern with the structural integrity of your vehicle. For most sport helicopters that have been converted for a UAV application, I don’t set this until the end. They have been built for the high stresses of aerobatic flight. However for newly designed aircraft for this application, it is worth knowing the structural limitation. The manufacturer would have to tell you this. I cannot help you in determining this. I could scale down some values of full scale aircraft to get an approximation for your size aircraft. That still doesn’t account for how well your aircraft is built.

Using the lower values that you determined from your manual tuning, may limit your results. How did you arrive at those numbers? Did you account for the input size and scale up the acceleration to the equivalent of a full input or maybe 90% full input.

I would suggest starting out with a max gain of 1 on the pitch axis, max gain of 1.8 on the roll axis and max gain of 1 on yaw axis.

If you would like, conduct the max gain determination test after doing the FF test and then send me the log files.

Hello Bill,

First of all, thank you so much for this advices.

So what is interesting in your reply, is that the autotune FF will follow the target that’s affected by ACC MAX for ech axis + input tc I supose ?

about acc max, I checked angular rate change in 100ms when I made charp inputs reaching 50° / sec.

I focussed the most verical sinusoids.

and I extrapolated.

so the result is very limitating has I don’t have more than 100ms resolution for rate…

but is like this that I determined the acc max for each axis.

Hello Bill,

Also if you have any advice about the initial DCP params for tandem it coul be very helpfull, as it seems very difficult to find it for the pitch and for the roll.

Thank you.

Hello Bill,

Today, I make the FF on pitch manually, and after I test autotune pitch rate kD and kP, and I stop it at the third sweep, because I’ve been scared by the large pitch input that autotune make…

Initially I axpected to see little sweeps about ±3° as on the tradheli autotune video Heli Autotune Rate D and RateP demo (youtube.com) for rat pitch kd/kp max gains) but I experienced ±25°, so too much for me…

Please check logs attached:
00000039.BIN

Let me know how to have the sames gentles sweeps as on the pitch kd kp seens on the wiki atune tradheli video.

Or if I setup something bad…

Kind regards.

@kuspower
I’m sorry that autotune did not work well for you. It does have protections to stop if it exceeds 30 deg. But you are right that it should not have got past 10 deg. I think that this older version of autotune does not tune tandem heli’s very well. The newer version that will be released with Version 4.6 should handle tandem heli’s much better as I have changed how the inputs are made and it looks at attitude rather than rate so it should keep the aircraft attitudes from getting too large. If you can wait until 4.6 is released then you could use the new version. If you want to tune it sooner. I can tell you how to setup the System ID mode and then you can send me data that I would tune analytically (I have developed a web tool to do this but haven’t released it yet). Let me know how you want to proceed.
Best Regards,
Bill

Hello Bill,

Thank you so much for the explanations and your help.

Yes for sure I want to try the sys id and i give you the logs, or i can put 4.6 beta for test the new autotune, and after autotune i go back to 4.5.6 ?

@kuspower Let’s start with the system ID. Here are the settings for system ID

LOG_BITMASK Fast_IMU unchecked,
Fast_Attitude unchecked,
Medium_Attitude checked

SID_F_START_HZ, 0.25
SID_F_STOP_HZ, 10
SID_MAGNITUDE, 5
SID_T_FADE_IN, 10
SID_T_FADE_OUT, 1
SID_T_REC, 90

For the pitch axis, set SID_AXIS to 5
For the roll axis, set SID_AXIS to 4

Put the System ID mode on a switch on your transmitter. You’ll want to take off in stabilize mode and establish a hover around 3-5 meters off of the ground. Ensure you have at least 25x25 meter area to allow the aircraft to drift as the sweep is being done. Unlike the autotune flight mode, System ID allows you to make control inputs while the sweep is being made and it won’t stop the sweep. However if you think that the aircraft response is getting too large then switch back to stabilize mode immediately. I have the magnitude of the sweep set for 5 deg. You may see the amplitude go to 10 deg. If it gets much bigger than that then stop and post the log here and let me know.

While system ID mode is making the frequency sweep input, you will let it do this and allow the aircraft to drift back and forth in the axis being swept. If it seems that after a few oscillations that the aircraft is drifting in one direction, then make small, slow control inputs to keep the aircraft from drifting further. After the frequency gets high enough, the aircraft will stop drifting and should oscillate in one spot. During the whole time, feel free to make inputs in all of the other axes not being swept to keep the aircraft from drifting.

You wont have any indication when the sweep completes because the frequencies will be high and the aircraft won’t respond much. so start a timer when you switch into system ID mode and wait 95 seconds (the sweep is set for 90 seconds) before switching back to stabilize mode and then land the aircraft.

Post the logs and I will take a look.

1 Like

Hello Bill,

I just make the sid flight today.

Please check attached:
00000051.BIN

We can see that the best response is arount 2Hz…

I also tryed to push rate pitch p/d and I pushed the tune to 0.12 P 0.012 D, but heli entered in vibration state, I keep the control and don’t brake anything, and finaly I let the 0.06P and 0.006D
00000041.BIN
I also tryed to push the pitch stab P, and I reach 8, but also started to vibrate strongly, and I finally let 5.

It seems to be very dificult to do better.

I think issue comme from the isolation foam I put bitwin the AP and the frame, is too smooth, but if I dont put it, I have too much virations and I have clipping.

Maybe tuning the FLTD,FLTE,FLTT can permit to go farther on the tune ?

Also there is this atc params below not too much documented, that maybe permit to enhance the tune:
ATC_RATE_P_MAX
|ATC_RAT_PIT_PDMX
ATC_RAT_PIT_SMAX

After analysing sweep result in error over frequency, I’m wondering that maybe the tandem heli pitch angular velocity cannot be well managed by the feed forward…

or maybe there is some mecanical issue or bad swash adjustment from my part.
I set for col1 and col2, -2,5° + 12,6°
and cyclic is set to +7,5- 7,5°
all the angle are fine tune and check for the 6 blades.

What I noticed is that on the ground, when I move the helicopter on the roll, the swash moves with a significant amount of travel, so that the swash tends to stay horizontal.

When I move the helicopter back and forth on the ground, the differential movement on the front and rear collective is barely noticeable.

On the ground, I went up to a FF pitch of 1, to see a movement that seemed correct to me.

However, with a FF at 1, the inputs made from the rc with the pitch stick, take the collectives from stop to stop…

In fact, it would be necessary that from my pitch inputs the collectives move 5x less, and that from the FF the collectives move 5x more.

I also tried with the Pot Tune on the FF of the pitch to go up to the max I can, starting from my initial setting of 0.17, I arrived at 0.21 and the helicopter started to make relatively slow but uncontrolled oscillations, so I went back to 0.17…

It’s weird I know… I’m scratching my head.

What you think about testing without the feedforward? there is other solution that maybe take more care about the resulting angle?

Here the att pitch des vs meas


and the rate des vs meas

@kuspower I think your basic mechanical setup to include the H_ settings are good. Here is what I found when I used my analytical tune feature to look at your pitch axis.

Your original tune is in blue and the predicted tune with the parameters shown is in orange. Everything above 8 hz on the x axis is unreliable. This is the closed loop rate controller response. You’ll notice that there is a hump in the original (blue) line around 1 hz (the x axis is frequency in hz). Then you see the other rise in the gain response around 7 hz. The low frequency hump is the attitude feedback mainly caused by the angle P gain (ATC_ANG_PIT_P) and the rate FF gain (ATC_RAT_PIT_FF). I left the angle P gain where it was but reduced the rate FF gain.

At 7 hz, the hump in the gain response is caused by the ATC_RAT_PIT_P and ATC_RAT_PIT_D. In order to improve the response and remove the hump, I used the PID notch filters. You will have to set up the filters in the FILT parameters and then use the ATC_RAT_PIT_NTF and ATC_RAT_PIT_NEF to specify the filter number. with using the Notch filter, the rate P and D gains are raised to flatten the response to 0 db across frequencies from 2 to 7 hz. Be sure to set up the filters exactly as I have shown them here. Note that I put the ATC_RAT_PIT_FLTE to zero. Add the PID notch filters and make all the other parameters match what I have except for the Rate P and D.
I would recommend bringing the Rate P and D gains up in maybe two flights. First flight bring Rate D up to 0.01 and rate P to 0.1. Then use your tuning knob to bring Rate P up to 0.15. That way you have a way to stop it from oscillating if it does.

If everything looks good with not oscillations then perform another System ID on the pitch axis with this setup and post it for me.

Good evening Bill,

First of all, thank you very much.

Then I am impressed by the capabilities of ardupilot,
In fact there is a solution!! we can activate a notch filter on the response of the pids to solve the problem!!

I can’t wait to try this!

I’ll keep you posted very quickly!!!

No problem.

Look forward to it. However can you change SID_F_STOP_HZ to 15. I would like to see more of the drop off in gain and that doesn’t happen until 10 hz.

Hello Bill,

I don’t find the filter params you told to set…

I’m using copter 4.5.6

Also I search on the wiki about and I don’t find nothing about.

I you can tel me how to make this params appearing.

Thank you so much