Can't make progress with AutoTune on Plane

I have been failing to make any perceptible progress with Autotune on Plane for a few weeks now. My field days are few and far between, so I am trying to do my homework before my next one.

I’m running Arduplane 3.3.0 on a clone pixhawk. The plane is a Pinata wing from Crash Test Hobbies. It’s fairly heavy for small wing, but also quick. It stalls badly when I have too little speed on a turn (I’m an intermediate pilot at best), but otherwise flies decently in manual mode and has been trimmed appropriately. I’ve flown many batteries in manual and I’d like to move on to the automated modes.

A typical attempt to use Autotune goes like this: I get the plane aloft, get it set to run down one side of the oval I’m flying, then I put it in Autotune. I do full deflections on the sticks a few times, but within a few seconds (often less than the 10 required for an Autotune save), I’m at the point where I need to turn. I start my turn, but the plane is limited in its bank angle so severely that I typically have to keep the stick pinned to one side just to do a large gentle turn; I can’t do any more full stick deflections. Most of the time I abort and resume manual mode so I can turn at a decent enough angle to keep the plane at a comfortable range and/or avoid obstacles. If I’m lucky I can get one 12-15 second run with one autotune save; often I don’t even get that far.

Pitching is similarly limited, but doesn’t present the same problems turning does.

Question 1:

What is limiting my roll angle so severely? What do I need to change to improve my ability to turn in Autotune? I was figuring on lowering NAVL1_PERIOD from the default, but if there is something else I should do in addition/instead, please tell me.

Question 2:

When I look at the logs from my autotune sessions, I don’t see any evidence of tuning progression. ATRP.P is zero throughout Autotune, which I find pretty confusing. I am unclear what is going on, exactly.

Here’s the log on Droneshare:

droneshare.com/mission/112568

I have been assuming that I will get more control/deflection as I progress through autotune, and that I just had to get through a few 10 second intervals and things would loosen up and I would get more control/deflection. I gather this isn’t the case, but I’m not sure what I should be expecting either.

Thanks for any and all help!

[Also, a coaxing note about the forum attachment size limits - I think they are a bit restrictive. I could not upload my log from a short flight, or even a screenshot from that log. I had to resize the screenshot, making it far less legible, and upload the log to Droneshare. I imagine the limits were set several years ago.]

I may be able to help you somewhat - I am in the same boat as you in that my space for Autotune is limited.

Two things:

  1. Adjusting NAVL1_PERIOD will not work. This parameter is for navigation in the Auto mode, only. It adjusts how tight the plane flies between waypoints. If you want to manually adjust a parameter so your wing rolls faster, adjust the P of the PID tuning for roll: RLL2SRV_P. You can bump this up a little higher - hopefully this will let you roll faster, but not cause the wing to go unstable in roll. Don’t make this value too high. You can use the manual PID tuning guidelines to get your tuning close, and then invoke Autotune.

  2. The parameter LIM_ROLL_CD should let you roll at a steeper bank angle, and thus, turn faster. Check to see if this value is not too small. Note that increasing this value could induce your wing to stall.

Hope this helps. Hopefully my replay may elicit other replies as well…

Thanks for your response.

I changed a number of things and had some improvement:

LIM_ROLL_CD 4500 => 6000 (45 to 60 degrees max bank angle)
NAVL1_PERIOD 20 => 17 (I could see a lot of precendent in other peoples settings for a small fast wing like mine)
WP_RADIUS 90 => 50 (“Set WP_RADIUS to the distance your plane would fly in 2 seconds at cruise speed.” - plane.ardupilot.com/wiki/navigation-tuning/. The plane cruises at about 25 meters/second.)

I also followed the advice here about programming my radio to give 100 rates in AutoTune mode - previously I was flying the auto modes in a “high rates” setup that only gave about 81% deflection. Once I did that I recalibrated the radio in Mission Planner.

I also realized the flight controller was at a slight angle due to the curvature of the wing itself; I adjusted this using the AHRS_TRIM_X and AHRS_TRIM_Y settings so that the flight controller read flat when the wing was lying flat.

The end result of all these changes was that cruise, stabilize, RTL all worked much better, and I had adequate responsiveness from the wing. This was a great relief. I expect LIM_ROLL_CD was the key parameter that needed adjusting, but the throw range issue might also have had some impact, I’m not sure.

I have not had time to do extensive testing on AutoTune again, but the one test I did do leads me to believe it is still not working. Below see a graph from my latest short section of AutoTune flight. You can see my demanded clipping at 80%, which I believe indicates that I’ve reached sufficient stick deflection that AutoTune should kick in and start adjusting PIDs. But P remains 0, as it has before.

Here’s another person with an apparently similar problem:

viewtopic.php?f=105&t=10598&hilit=work

If we graph the AutoTune section of his posted bin file, we see the same pattern as in my flights. Interestingly, he is also flying a wing.

Today I maidened another wing, this one starting from stock PIDs, and I managed to get the very first AutoTune session captured to a log file.

It appears AutoTune is in fact working as it is supposed to - the tuning brought immediate improvement to the responsiveness, at least if you examine the graph of the first few seconds of AutoTune, a screen shot of which I’ve attached. You can see the Achieved getting much closer to the Demanded in just s few seconds.

When I compared the before and after PID values, I found a change:

Before:

RLL2SRV_P, 0.4
RLL2SRV_I, 0.03333334
RLL2SRV_D, 0.03
RLL2SRV_IMAX, 3000
RLL2SRV_RMAX, 75
RLL2SRV_TCONST, 0.45

After:

RLL2SRV_P, 0.6703251
RLL2SRV_I, 0.05586043
RLL2SRV_D, 0.05027438
RLL2SRV_IMAX, 3000
RLL2SRV_RMAX, 75
RLL2SRV_TCONST, 0.45

So far so good.

What does seem to have a problem, however, is the interaction between the logging and/or Mission Planner’s display of the P value. It always shows ATRP.P as being zero, although as I saw today P is in fact being adjusted (along with I and D).

I don’t know if Mission Planner is showing the wrong value, a non-existent value, or if the value isn’t being logged correctly in the first place. Either way it is extremely misleading to see a zero P. I was convinced until today that AutoTune was simply broken.

I will next look into this and see if I can determine the cause of the problem. If anyone beats me to it, please say so.

(I had intended to upload the relevant log from this flight to DroneShare, but it is just erroring out on me with a blank red error message right now. Apologies - again, I would suggest this forum configuration be updated to support larger uploads.)

So I reviewed the log files themselves this morning, and found P being changed. Then I graphed just P, and found that in fact Mission Planner is behaving OK. The problem is you can’t get Mission Planner to make you a graph like the one shown in the Auto Tune documentation here:

plane.ardupilot.com/wiki/flying/ … -autotune/

I kept looking at this graph and assuming that it meant I could see something equivalent in Mission Planner, and was always enabling Demanded, Achieved, and P all together, and clicking P last. Since P is a 0-1 value, and Demanded is 0-80 value (at least when AutoTuning), I only got a flat line at the origin for P, which I mistook for 0.

When I graphed just P, I could see that in fact P was being manipulated during the AutoTune session. I am not sure why I never figured this out before - all I can figure is that the auto-scaling behavior of Mission Planner often takes more than one attempt for me; I often feel like Mission Planner gets its display range wrong, although it can get it right if you clear and reselect what you are interested in.

Anyhow, aside from that quirky ranging behavior in Mission Planner, I’m finding no bug in AutoTune - everything seems to be working correctly.

I do feel like the docs for AutoTune are slightly misleading in spots, and could use a bit of editing. If I wanted to submit a potential change, what would the process be?