Using Analytic Tune Web Tool to tune your helicopter

@spova You really should never have to lower Ang P below 4.5 on smaller heli’s. Ang P is very important to ensuring the aircraft maintains the requested attitude. I generally try to get this to at least 6. The other thing you should be very careful with is not putting in too much Rate I gain. This is very dangerous for the heli when it lands or is ground turning before takeoff. Any error in the requested rate and actual rate would cause large integrator buildup. This is caught by ILMI or IMAX depending on the integrator scheme you choose (Leaky Integrator or not through the param H_OPTIONS). So as a rule, I never increase Rate I more than 0.1.

Looking at your data, the pitch axis doesn’t show any rise in gain at a particular frequency. The gain plot with Rate P and D set to zero and the FLTT filter removed shows bare response to be pretty flat. There is a small rise of 2 db toward the point at which the gain then drops off. This is good. Se the plot below for that starting point with these settings

ATC_ANG_PIT_P,6
ATC_RAT_PIT_FF,0.14
ATC_RAT_PIT_P,0
ATC_RAT_PIT_I,0.05
ATC_RAT_PIT_D,0
ATC_RAT_PIT_D_FF,0
ATC_RAT_PIT_FLTT,20
ATC_RAT_PIT_FLTE,0
ATC_RAT_PIT_FLTD,0

I start tuning by reducing the Rate FF gain so that the rate gain is -4 to -5 db. Which when you view the angle with FF plot, it looks pretty good near 0 db. Then I start raising the Rate D gain while I watch the Rate controller plot. As the rate D gain is raised, the drop off will start moving to the right and then the gain will start to rise. As soon as I see an appreciable rise (1-2 db) which was around 0.0006, then i stop. next I raise the rate P gain while I look at the rate stability plot. You will see that the phase goes from -180 to 180 deg. This is the frequency that you look at in the gain plot to ensure it doesn’t go above -10db. I raised it to 0.03 and I am getting -12 db on the rate stability plot. You can see where my pointer is on the plot showing the gain at -12 db.

At this point I look at the attitude controller with Feedforward plot. This shows the response that you will observe when you fly.

I already have the Ang P at 6. You could go out and try this. You may notice a fast oscillation when you make sharp inputs. To remove that then you can lower FLTT. I Iowered it to 5 hz and I got the gain plot to flatten out before the drop off. here is what it looks like.

And the parameters are

ATC_ANG_PIT_P,6
ATC_RAT_PIT_FF,0.1
ATC_RAT_PIT_P,0.03
ATC_RAT_PIT_I,0.05
ATC_RAT_PIT_D,0.0006
ATC_RAT_PIT_D_FF,0
ATC_RAT_PIT_FLTT,5
ATC_RAT_PIT_FLTE,0
ATC_RAT_PIT_FLTD,0

Looking at the roll axis, you can see the gain rise around 5 hz for the tune with only FF gain and Rate I gain.

here is the attitude controller with feedforward plot after tuning it

and the parameters

ATC_ANG_RLL_P,6
ATC_RAT_RLL_FF,0.11
ATC_RAT_RLL_P,0.04
ATC_RAT_RLL_I,0.06
ATC_RAT_RLL_D,0.0003
ATC_RAT_RLL_D_FF,0
ATC_RAT_RLL_FLTT,20
ATC_RAT_RLL_FLTE,0
ATC_RAT_RLL_FLTD,0
ATC_RAT_RLL_NTF,0
ATC_RAT_RLL_NEF,0

Hopefully this was helpful

3 Likes

My SID_T_REC time is set to 90 and I have a timber set on my TX to start when I switch mode for 92 seconds. I left it in sid mode longer than normal just now and noticed it does actually show a finished message eventually. Should I be waiting for this message before I switch back to stabilized?

Also I would like to suggest an enhancement to add sid axis to the the transmitter tuning knob list. Happy to make a feature request issue on git hub for this if you want.

I guess I am not sure how you intend to use it. You aren’t tuning any gains.

No. It’s fine as long as you wait the T_REC time before switching out to stabilize.

I imagined that if that param could be adjusted on a knob I could land and switch to the next axis with out having to use a GCS to update the params. Or even not land I guess. Just do one sid run then turn the knob. The messages would be able to confirm when you start that you dis switch even.

Would speed things up if you are trying to get logs for several at a time or in one battery.

I wrote a script for that already. It’s up earlier in the post.

I saw that but I cant use lua on one of my heli because it has an f405 and the custom build gets so big it causes issues. Or maybe I could if I really wanted to make a stripped down firmware build just for getting the tune settings then flash back once its tuned I guess.

I saw the tune know sid magnitude option in there and though it would be handy to have axis too is all. For me this tuning method is already much more practical than autotune with small helis and a small yard so this is in no way a critical thing.

1 Like

Is the goal then to keep the predicted on the attitude plot 1:1 line or as close to as possible with out to much access over? What about the drop off on the attitude plot? Is there any desired relation between the drop off and the 180phase line or is it ok to keep the predicted line up closer to the 1:1 if it stays relatively flat past or even well past the 180 shift?

Also Im not really sure how at all to approach the yaw yet. I followed along with Leonard’s video sorta.

I’m guessing the goals are the same but the approach different as to what order params are adjusted?

For yaw does the tail waging sid and subsequent tuning adequately adjust the tune for strafing/sideways (not sure the correct technical term here) flight?

I reviewed my video again and I see where your question from our discussion in discord was coming from. When tuning the rate D, it is not necessarily that the amplitude plot turns down at the 180 deg phase crossing but that the gain at the 180 deg phase crossing is being used to tell when the D gain is no longer increasing the frequency of the 180 deg phase crossing and that we see an increase in the amplitude(gain) at the 180 deg phase crossing. Rate D gain should push the 180 deg phase crossing to the right (higher frequency) without raising the amplitude plot. once the amplitude (gain) starts rising then we stop increasing the Rate D gain.

For rate P tuning you are just looking at the peak of the amplitude plot.

3 Likes

How do we know what parts of the sid params we can or should adjust to adapt to different environments like smaller spaces or different aircraft like smaller helis?

For example the tail hardly moves with the suggested default sid setup above (link) on my two 450 class helis. Can/Should the settings be changed?

Is this based on continuity? On one of mine the continuity range is much larger than the other but him not sure if or how to tell if thats a problem.

For both Pitch and Roll the first few oscillations of the chirp are very slow and actually drive the heli wildly all over requiring a lot of correction to keep the center of the cycle close to one spot, probably invalidating the data from that part of the cycle. Can/should this be addressed and how would I know?

Id like to gain a better understanding of how to tell what parts of the SID values I can adjust and how they impact the data gathered.

If the continuity for an aircraft falls regularly in a much narrower range than the start and stop hurts is there any reason not to adjust those down to just the range that maintains continuity?

How does magnitude impact the data usefulness? I understand I think, what it does, increasing the amount of deflection that is aimed for during the sid run. I don’t understand how much or how little this should be to create good data.

What does the fade in and fade out even do?

This is already a lot more ideal for small helis just because its less time but I dont understand what things to adjust to adapt for different small helis. Or how to understand if anything needs to be adjusted for the SID params.

Thanks,

It’s all about signal to noise ratio. The amplitude needs to clearly be higher than the noise level. Only then can the system identification work and deliver a valid system model.

Is the coherence plot the only way to tell if that’s happening?

It is a good indicator of it, yes.

The System Identification wiki defines each of the parameters but I know that it may not be clear how they can be changed for your case.

Yes, it may require that you increase the SID_AMPLITUDE to get a better response so that the signal to noise ratio is larger and you get better coherence. You can increase by 10 deg/s at a time in the yaw axis. I wouldn’t go much above 50. I have found that with small heli’s the yaw axis system ID can cause very harsh responses in roll. If you see this happening then you will need to reduce the SID_VELXY_P parameter.

This is most likely due to your tune not being perfected at this point. As you pointed out, you need to help the SysID mode by adding some stick inputs to keep it from getting out of hand but only add enough to keep the oscillations bounded. Try not to prevent the aircraft from oscillating completely. SID_T_FADE_IN is probably your best bet to help manage the large oscillations initially. Fade in is the time it takes to ramp in the magnitude from zero to SID_MAGNITUDE. if you want to limit how much it oscillates then increase the time for Fade in. I don’t think you need to change Fade out which is the time it takes to ramp the amplitude from SID_MAGNITUDE to zero.

As for the start frequency and stop frequency, I would leave the start frequency alone. it is important to get the low frequency data to ensure you stabilize the low frequency dynamics which are typically unstable in helicopters. For the stop frequency, you want it high enough so that you capture at least the -180 deg phase crossing in the Attitude controller plot. you may want to get a little more like -240 deg phase. That way as you tune and you push the -180 deg phase crossing frequency to the right (increasing it), you can still have data to show any instabilities.

Hopefully you find this helpful

1 Like

The yaw axis is coming out a bit wonky on my DDFP 450 class heli.

I can set p and d to max in the sid tune and then fix it all with lowering the FLTT to 5 on the yaw.

This doesn’t seem right. LINK to the sid run log.

@spova took a look at your log file. As far as the predicted response that you posted, be very careful in setting the rate P and rate D gains. Notice that the predicted phase plot shows the phase increasing out past 5 hz. That is very indicative of an instability meaning that you added too much P or D gain. You can make sure that the rate controller is stable by looking at the rate stability plot. The gain in that plot should not be greater than -6 db at the frequency where phase crosses -180 deg (in the phase plot is jumps from -180 to +180). For you settings this is what the rate stability plot looks like.

You can see the gain is +10db which is very bad.

First thing to note when you load a new data file. be sure to see how well the calculated and predicted follow each other. You can see the predicted doesn’t follow the calculated around 5 hz

So the predicted response after tuning may not be that accurate. so be careful and gradually approach the settings you determine.

Here are the settings that I arrived at. I don’t add FLTD unless I really need to. If you signal is cleaned up well by the notch filters then you can set FLTD to zero to disable it. That was causing a lot of rise in the gain plot

This is the rate controller plot

This is the attitude controller plot

This is the rate stability plot. You can see the gain at the -180 deg crossing is below -6db (not by much though)

Hope this helps

2 Likes

@spova Saw your comment on Discord regarding your overshooting in the yaw axis. I think you need to adjust some of your command model parameters. It may be overshooting because the aircraft can’t keep up or there are delays in the control system logic that cause this. Here are the four that you should be concerned with

PILOT_Y_RATE 360

PILOT_Y_RATE_TC 0

ATC_ACCEL_Y_MAX 80000

ATC_RATE_Y_MAX 0

I think the accel max is probably fine. Do you know whether your heli can achieve 360 deg/s yaw rate? Plus this is what you can command on your stick, that seems very touchy in my opinion. The one thing about yaw axis is that you command rates with your stick and it goes on and off the max acceleration to get there. This instantaneous change is not achievable by a heli. I would recommend some time constant (PILOT_Y_RATE_TC) to allow the heli time to response. I think 0.05 or 0.08 might be appropriate. I dont think you need to go any higher than 0.15. That would probably make it feel pretty slow in getting to the desired rate.

I’m pretty confident that it can hit 360. Iv seen it well over that a couple times in the logs.

PILOT_Y_RATE_TC 0 & ATC_RATE_Y_MAX 0 are both just default. I wouldnt know how to tell when those need adjusted.

I have started to notice that even really slow yaw input gets a bounce back and then look for this in the logs I see there is a saw tooth bump on ang yaw every time the stick re-centers. I guess I would have expected ang to change slower as the stick is moved back toward the center but im not sure if this is what is causing the overshoot. Iv tried PIDS all over the place to address this one thing and nothing seems to help.

Going to try Pilot y tc at .05 now and log some piros now to verify the the speed.

I guess the point of questioning PILOT_Y_RATE is that would you ever want to use 360 deg/s? I mean if you are doing acro then that would be desired but if you are like me who likes to fly pattern then 180 deg/s is plenty. I really think using the PILOT_Y_RATE_TC will help with the overshoot.

I verified this heli can do 360/s. I set it up to 400 and then checked the logs and it held around 400 so 360 should be ok.

Yes, I want that. 360 feels very slow to me still. Am I often going to do 360/s turns? Probably not but most of my FPV flying is done with quad copters so 360 is closer to sorta what I’m used to I guess. I’v turned in down to 180 on this heli for now though incase that is contributing to my issue.

It has this yaw bounce back with the stick hardly moved at very slow rates though so I don’t think rate max is the issue.