How to force pitch AUTOTUNE?

I’m trying to auto-tune a Bixler airframe. It’s not so interesting tuning a Bixler; I’m doing this to understand how the process works so I can apply it to less common airframes. I was able to tune roll (I think) but I’m having some difficulty forcing pitch tune. I flew for 5 minutes pulling and pushing the elevator stick to its limits, but the logs show only about 3 seconds of pitch autotune.

What am I missing?

MSG, 126168266, ArduPlane V4.0.5 (0bfa2638)
MSG, 126168323, ChibiOS: d4fce84e
MSG, 126168350, PH4-mini 00250035 31385118 35333837

Log here: Dropbox - 2020-08-03 09-55-12.bin - Simplify your life

Ari.


Your not reaching the threshold, must be asking for >80% of the max rate, you have a max rate of 75 so need to be above 60.

You only reach this on a couple of the peeks. Turn down PTCH2SRV_RMAX_UP. (or turn PTCH2SRV_TCONST down so the same stick input asks for a larger rate)

Thank you, @iampete! I’m changing this now and try again when I fly tomorrow morning. Will report back with new results.

I’m curious. I see that right now, I have RLL2SRV_RMAX==PTCH2SRV_RMAX_UP==PTCH2SRV_RMAX_DN==75. The default values for these, in a new installation, are 0 (which I understand to mean 100 deg/sec). I have no recollection of changing either of these parameters, much less to this specific value. It looks from different versions of parameter files I’ve kept that the 75 values appeared after a previous AUTOTUNE attempt, although it’s possible they changed earlier. Did I do something to invite this change, or is it a side effect of running AUTOTUNE mode?

Ari.

Equally, I’m curious about what controls the mapping from stick position to demanded angle. I calibrated the radio, but there must be a param that multiplies uSec from the stick to get desired deg/sec. Did I accidentally mess that one up?

Ari.

75 comes from the AUTOTUNE_LEVEL param, lower level = lower RMAX as does the PTCH2SRV_TCONST. So I guess just turn your AUTOTUNE_LEVEL.

Stick position is mapped to angle using using LIM_PITCH_MAX and LIM_PITCH_MIN. Angle is then mapped to rate using the time constant.

Thank you for this explanation, @iampete.

The elevator has felt sluggish to me in all modes.

My LIM_PITCH_MAX and LIM_PITCH_MIN are the default 20/-25 degrees which seem reasonable for a Bixler. But I think what you’re saying is that if I decrease PTCH2SRV_TCONST from the default 0.5 seconds, I can increase the demanded pitch change for the same stick deflection. Right now, at full up elevator stick, I think I’m getting LIM_PITCH_MAX/PTCH2SRV_TCONST = 20 degrees / 0.5 seconds = 40 deg/s. If I change TCONST to 0.25, I’d get 80 deg/s at full stick? Is this how the math works?

Ari.

…and AUTOTUNE_LEVEL overwrites *_RMAX* every time you enter AUTOTUNE mode? Does it overwrite anything else?

Ari.

It sets PTCH2SRV_TCONST, PTCH2SRV_RMAX and PTCH2SRV_D based on the aggressiveness.

This is how we go from angles to rates:

Surprised you having any issues with the defaults in a bixler, how does it fly in manual? Might be worth checking your CG and elevator travel.

So there’s no point adjusting *_TCONST manually?

I can adjust the elevator throw, but that wouldn’t help me get into 80% requested rate :=)

Ari.

I’m going to go with I have enough throw :=)

I tried again today, once with AUTOTUNE level=7 and once with AUTOTUNE level=3. In both cases, I seem to fail to reach 80% rate. With level=3 I did get a little time in auto-tune but instead of multiple spikes up and down, I see a single, 2-minute-long curve.

autotune-level-3

level=7: https://www.dropbox.com/s/ffocjhhcevmwrey/2020-08-06%2013-17-55.bin?dl=0
level=3: https://www.dropbox.com/s/hofr6epo5d7gcx0/2020-08-06%2012-51-55.bin?dl=0

Maybe I misunderstand something simpler. You graph PIDP.tar. Does the target represent stick deflection or the rate of change in stick deflection? I’m moving the stick to stops up and down, but maybe I need to jerk it faster?

Ari.

Sorry I missed your earlier reply here.

Pitch target is sort of a mixture of angle and rate, is basted on the angle error, so the faster you slam the stick the larger the error. My normal procedure is just to slam the stick from min to max. Looking at the log it could just be, as you say, you just need to move the sticks faster. Roll probably worked OK because you have a larger range of angles, ± 45 rather than +20 - 25. So the same speed stick movement generates a larger angle error in roll than in pitch.

Thank you @iampete. Last time I was at the field, I changed LIM_PITCH_MAX from 20 to 30, and the plane felt a lot more responsive in pitch in FBWA. I put it back to the default 20 before I tried autotune again, which I see now was a mistake :=) I’ll try higher pitch limits and faster stick movements next time I’m at the field.

What’s interesting to me is that with so much difficulty getting into autotune, I seem to be an exception. I wonder if it just works for everyone else, or conversely if it’s a feature that only a few people use. What makes it even more confusing is that I’m trying to keep as many of the defaults as possible.

You might say, what does it matter with a Bixler, it’s stable with default PIDs, and it is. But I want to understand better how the system works. My specific motivation is follow-on airframes in the pipeline, which are much more maneuverable and less forgiving of random tunes. The next project in my queue is an Eflite Extra 300.

Ari.

1 Like

Hi Ari,

Please keep going. I am interested in the outcome as wel. I also wasn’t aware of the stick changing speed.
After struggling with it I got a better tune by setting the RLL2SRV and PTCH2SRV param’s manually. A search for “auto tune” still delivers many issues by some users.
Regards Sascha

1 Like

Success. It seems that I had been too gentle bringing the stick to its limits previously.

I tried the slam-the-stick-to-the-stop-as-fast-as-you-can approach with two configurations today. First with AUTOTUNE_LEVEL=3 and the default LIM_PITCH_MAX=20. Second time, I set them to 7 and 30 respectively. It seems that in the second case, it was easier to force auto tuning.

I wonder if the documentation for autotune can benefit from a mention of stick velocity. I’ve been making PRs against AP documentation recently, mostly typos and grammar. I can make a PR to add a sentence about this on https://github.com/ArduPilot/ardupilot_wiki/blob/master/plane/source/docs/automatic-tuning-with-autotune.rst. I guess the same note should appear on copter documentation as well?

Ari.



A wiki update would be great, Copter auto-tune does its own stick inputs so this does not apply.

There’s a graph on that page that shows tune origress. Do you now what software generated it? I would love to include the same graph but add ATRP.Type to it.

Looking at the page, it says:

When you engage AUTOTUNE mode a few things will happen:

  • the autotune system will immediately setup some values for your roll and pitch I and D gains, and your roll and pitch maximum rates.

Can you confirm the coder overwrites LIM_ROLL_CD, LIM_PITCH_MAX, LIM_PITCH_MIN? I have not seen that behavior. Perhaps it only occurs under certain conditions? In my logs, these parameters appear only once, suggesting they stay constant during tune.

Two-liner PR: https://github.com/ArduPilot/ardupilot_wiki/compare/master...arikrupnik:patch-1

Ari.