QAUTOTUNE disarm to save the tune (now with video)?

This page QAUTOTUNE — Plane documentation says:

You need to then land while staying in QAUTOTUNE mode and disarm without changing modes to save the tune.

I have an airplane that cannot land vertically. It can hover and should be able to transition from level flight to hover and back, but cannot land on its tail in its current configuration.

Is there any other way to save the tune except land in QAUTOTUNE?

you don’t have to land in Qautotune, just disarm in it, land in whatever mode you like, switch to Qautotune and then disarm

Wait, I disarm twice?

Ari.

Punctuation issues on my part. Hopefully his is better:

You don’t have to land in Qautotune, just disarm in it.

Land in whatever mode you like, switch to Qautotune and then disarm

Ah! So I can be in FBWA, switch to QAUTOTUNE, wait for it to stop twitching, switch back to FBWA, land and disarm, and it will save the new tune?

Ari.

yep, you will probably need to do one axis at a time due to battery life. Should do OK on roll might struggle in yaw an pitch with a tailsitter tho

What’s your expectation of how long this might take?

Can you say more?

Ari.

5 mins or so per axis.

autotune was designed for copters that control using differential thrust / torque. Tailsitter yaw and pitch don’t, might be fine, might struggle, might end up with a bad tune.

Uh. The little 850 mAh that fits in the airframe may be insufficient for a 5 minute hover. What happens if I have to land earlier? I imagine it will still save the PID results when I disarm, and then use them as a starting point next time? Can I do autotune in installments, so to speak?

Well I’ll definitively post my results here one way or another.

Ari.

That is not how it works, being close to the right value will speed it up a little. But any point through the autotune may not be better. It searches for a high value then a low one, one it has both it sets the gains to a mid point. It still takes just as long to find the high and low no mater where you start.

I’ve been trying to autotune this one, and I’m finding that I need a very very calm wind day. I was out today and the wind less than 10 mph, but the airplane kept drifting downwind. It hovers well enough with default tunes to stay off the ground, but even with full elevator input, it could not cope with the wind.

What limits forward airspeed in hover? Is there a setting, or is this a limitation of the aerodynamics of this airframe?

Wind died down in the evening, so I tried again. Two surprising observations. One, I can’t tell when it goes into autotune. I thought I had it in QLOITER most of the time and got into QAUTOTUNE towards then of this flight, but the log shows going in and out of QAUTOTUNE. Two, in QLOITER the aircraft mostly stays in one place. In QAUTOTUNE, it wants to drift towards its back. You can see it starting around the 1-minute mark in the video. I have to push down elevator to keep from drifting into a tree, and eventually I end up in the tree anyway. Wind was completely calm.

Ari.

Took it to the R/C field today and had 4 flights. This is the longest I was able to stay in QAutotune. I ran out of battery, switched to wing mode, landed and disarmed. The only change I see in parameters is in Q_M_THST_HOVER which went from 0.302363 to 0.2878072. All other Q_ parameters are same as before.

https://github.com/arikrupnik/ardupilot-config/blob/master/logs/FIXED_WING/3/2020-09-04%2010-06-33-4minute-quatotune.bin?raw=true

I had Q_AUTOTUNE_AXES,2. I entered QAUTOTUNE from QLOITER The log is full of lines like

MSG, 171091260, AutoTune: (P) Rate D Up
MSG, 171091380, AutoTune: WFL (Angle(P)) (43.83323 > 10.00000)
MSG, 171091506, AutoTune: p=0.250000 d=0.003600
MSG, 171091607, AutoTune: success 0/4

Does this mean that QLOITER was leaning that far off vertical (43 degrees) to try to maintain station against the wind? And so the tune could never start, always waiting for level?

Ari.

Had 5 more tuning flights today. The closest I came to a complete single axis tune is this flight. It has a number of lines like

AutoTune: success 3/4

I assume the numerator is zero-based, so 3/4 means completion of this step. How close did I get to completion? The ATUN.TuneStep value goes up to 4, which surprises me, since the documentation only mentions values 0,1 and 2

0 = Returning towards Level (before or after a test), 1 = Testing (i.e. performing a twitch to test response), 2 = Updating gains (twitch completed and gains adjusted)

I completely misunderstood you, @iampete. After QAUTOTUNE is complete, I can switch to FBWA, land, then switch to QUATOTUNE and then disarm.

Turns out the flight where I thought I was close to a complete roll tune, the tune was complete, just didn’t save it because I disarmed in FBWA.

Here are the last MSG lines from that log:

MSG, 457082254, AutoTune: (R) Angle P Up
MSG, 457082378, AutoTune: WFL (Rate(Y)) (17.64205 > 15.00000)
MSG, 457082505, AutoTune: p=10.31408 accel=110000.0
MSG, 457082667, AutoTune: success 3/4
MSG, 457705197, AutoTune: Twitch
MSG, 458188476, AutoTune: Success
MSG, 475977214, AutoTune: Stopped
MSG, 475980376, Reset alt target to 63.7
MSG, 477643226, Transition FW done
MSG, 510834876, Throttle disarmed

https://ardupilot.org/copter/docs/autotune.htm says:

If you do happen to accidentally discard a sessions AUTOTUNE values by disarming when not in AUTOTUNE, you can examine the dataflash log for the GCS messages it sent during tune and manually set them on the bench.

Which parameters am I looking to set, and what do the MSGs call them?

Ari.

In the dataflash log its the ATUN message.

Thank you, @iampete. There are 101 ATUN messages in the log. Do I take the last instance?

63158:FMT, 124, 41, ATUN, QBBfffffff, TimeUS,Axis,TuneStep,Targ,Min,Max,RP,RD,SP,ddt

ATUN, 458188439, 0, 4, 10, 9.77, 10.34, 0.2389859, 0.00738726, 10.31408, 57447.39

I think RP (0.2389859) corresponds to Q_A_RAT_RLL_P and RD (0.00738726) to Q_A_RAT_RLL_D. Maybe SP (10.31408) corresponds to Q_A_ANG_RLL_P? I’m not sure what the other fields mean.

Ari.

Yep, you have the params right, RAT_I should be set equal to P for roll and pitch, 0.1* for yaw. All the log messages are explained on the wiki.

https://ardupilot.org/plane/docs/common-downloading-and-analyzing-data-logs-in-mission-planner.html#message-details-copter-specific

Yeah, use the last values for that axis

That’s the page I linked to in my post above. It lists 0…2 as values for TuneStep where in my log they go to 4. It omits explanations for Targ and ddt.

Thank you. So to reiterate, there are four parameters I’m changing on the strength of this autotune:

Q_A_RAT_RLL_P,0.2389859
Q_A_RAT_RLL_I,0.2389859
Q_A_RAT_RLL_D,0.00738726
Q_A_ANG_RLL_P,10.31408

Ari.