Question about autotune as a channel

Did pitch and yaw autotune a while ago but never did yaw. So this morning I set autotune up as a channel, sent my drone up and put it on the autotune channel. It twitched for a while, then stopped and I figured it was done. So I put it into stabilize and landed it. But it looks like the yaw settings are the old ones. I reviewed the documentation, which is a little unclear as it talks about running autotune as a channel in the footnotes. Am I supposed to land the drone in autotune, then unplug it all while still in autotune in order to save the settings? Hoping not to have to run autotune again as the winds aren’t calm very often. Can I get the autotune settings from the .bin dataflash log?

here is the dataflash log https://mega.nz/#!UCR0zK7I!oojoQP7HCeNWE2ld1ia_boH1SuNxRslkbVsh5TusPGM

It works as described in the wiki.
After completion of autotune switch to another flight mode and then back to autotune. Then land and disarm which saves the new settings.
If you switch to stabilize and then land it will return to the old settings.

The key thing is to disarm in Autotune mode

You can get the values from the log and just update them. I had to change some of the timeouts because I couldn’t get autotune to complete before my batteries ran out. I live on the beach and it’s always windy. If you need help understanding the autotune messages just ask. They are very confusing and I had to read the code to understand what was going on. I think the last message has the right values and is something like autotune complete. If the values aren’t there get them from the previous message.

Instead of switching filght modes if autotune is on a separate channel switch it off, back on, then land and disarm. I believe that is the right sequence and I’ll check the code today to be sure. I’m having probems with autotune myself so I need to look at it. It’s not starting which I’m sure is my setup.

It works as described in the wiki.
After completion of autotune switch to another flight mode and then back to autotune. Then land and disarm which saves the new settings.
If you switch to stabilize and then land it will return to the old settings

It says to test the settings put it in a new flight mode. Doesn’t say I have to, and I’d rather not.

Put the ch7/ch8 switch into the LOW position then back to the HIGH position to test the tuned PID gains.
Put the ch7/ch8 switch into the LOW position to fly using the original PID gains.
If you are happy with the autotuned PID gains, leave the ch7/ch8 switch in the HIGH position, land and disarm to save the PIDs permanently.

What I get from that, reading it explicitly, is that I don’t have to put it into low at all. Because I’m not trying to “test the gains” or “fly using the original PID gains”

I land my craft using stabilize. I don’t trust alt hold to land because I had a crash early on and it seemed to be because of prop wash affecting the altimeter (its a large 880mm 6s MR). IIRC autotune is based loosely on the alt hold mode, so I’m wary of landing in that mode.

You can get the values from the log and just update them. I had to change some of the timeouts because I couldn’t get autotune to complete before my batteries ran out. I live on the beach and it’s always windy. If you need help understanding the autotune messages just ask. They are very confusing and I had to read the code to understand what was going on. I think the last message has the right values and is something like autotune complete. If the values aren’t there get them from the previous message.

Instead of switching filght modes if autotune is on a separate channel switch it off, back on, then land and disarm. I believe that is the right sequence and I’ll check the code today to be sure. I’m having probems with autotune myself so I need to look at it. It’s not starting which I’m sure is my setup.

Thank you, I appreciate the offer. Am I looking for the MSG or ATUN lines? Here’s the last bunch of MSG that I saw. Can you help me figure out how to populate the items in the orange box?

Here’s the selected entries from the dataflash log

Looking further, this seems to be what I’m looking for, right? I see the RP is rate P, RD is rate D, and SP is stabilize P. But where is the rate I? http://ardupilot.org/copter/docs/tuning.html doesn’t say anything about changing the D value (its not in the orange box), just the P and I values, but I don’t see the I values in the autotune line below

I is set to P/10 for testing, and set back to the P value aftrer testing. This is a bit confusing because the comments in the code don’t match the values.
I = P * AUTOTUNE_RATIO_FINAL,
P = P *AUTOTUNE_RP_BACKOFF,
D = D * AUTOTUNE_RD_BACKOFF

where
#define AUTOTUNE_RD_BACKOFF 1.0f // Rate D gains are reduced to 50% of their maximum value discovered during tuning
#define AUTOTUNE_RP_BACKOFF 1.0f // Rate P gains are reduced to 97.5% of their maximum value discovered during tuning
#define AUTOTUNE_SP_BACKOFF 0.9f // Stab P gains are reduced to 90% of their maximum value discovered during tuning
#define AUTOTUNE_ACCEL_RP_BACKOFF 1.0f // back off from maximum acceleration
#define AUTOTUNE_ACCEL_Y_
I is set to P/10 for testing, and set back to the P value aftrer testing. This is a bit confusing because the comments in the code don’t match the values.
I = P * AUTOTUNE_RATIO_FINAL,
P = P *AUTOTUNE_RP_BACKOFF,
D = D * AUTOTUNE_RD_BACKOFF

above is done for roll, oitch, and yaw axises prior to saving final values,

Stabilize P = Stabilze P * AUTOTUNE_SP_BACKOFF

where
#define AUTOTUNE_RD_BACKOFF 1.0f // Rate D gains are reduced to 50% of their maximum value discovered during tuning
#define AUTOTUNE_RP_BACKOFF 1.0f // Rate P gains are reduced to 97.5% of their maximum value discovered during tuning
#define AUTOTUNE_SP_BACKOFF 0.9f // Stab P gains are reduced to 90% of their maximum value discovered during tuning

Multiply by 1 is not 50% of the value, so this must have been changed at some point. You will see three types of messages, Rate P, Rate D, and Angle. Abgel = Stabilzed P, so from thew messages posted Stabilzed Yaw p should be set to 5.21 * 0.90.

For the Rate messages you will see up and down messages. Use the last value per access. I hope I helped a little. I is just set to the rate P value. There are also lots (in my case) of messages where the change was greater thanthe limit. You can ignore those and only look for RP UP, RP DOWN, RD UP, and RD_DOWN. I’m rereading the code now to make sure nothing else changed. I may update it to print the final values on complete.

Thanks for the assistance David. I’ll read the code to better understand how autotune works then I think it’ll all make more sense.

Good luck on that. I think the developer was trying for as few lines as possible rather than clarity. The comments obviously were not updated as macro values were tweaked and the messages are simply confusing. The overall concept is great. In fairness to the developer I often find ardupilot hard to follow at times. I know the dev team works very hard to make code reuse a priority.