QAUTOTUNE - VTOL autotune for quadplanes

First up, pretty much all quad planes should start out using these settings:
Q_A_ACCEL_R_MAX 15000
Q_A_ACCEL_P_MAX 15000
Q_A_ACCEL_Y_MAX 5000

The bad news is this is a classic ESC sync loss. You need to do your standard due diligence on your ESC setup. You should check to make sure that all your wiring and setup is done correctly in case it is a loose wire or something similar.

The things that reduce the chance of sync loss are keeping all power wires gently twisted from the battery to the ESC, avoid large loops.

Ideally you would reproduce the sync loss issue on the bench. Then you can make changes to minimise the chance of desync happening. To reduce the chance of sync loss you can increase the minimum throttle or increase the timing value.

Good luck and I am sorry to see your crash!

Thank you @Leonardthall for quick help!
I have already started the re-build and will incorporate all the feedback to make it a success this time around.

Noted for all future QuadPlane setups.

I have tested all ESCs and Motors individually and they are working fine. So this indeed is an ESC Sync Loss.

1 pair of 10-gauge power wire runs from PDB (mounted in fuselage) to centre of each boom (0.8m wire), where it splits into two ESC inputs. A loose twist was applied every 8 inches on the power wire to avoid the same. The ESC signal wire is routed alongside the power wire, using an anti-interference twisted servo extension cord (90 cm)
Is there a need to shield the power or signal wire using aluminium based shielding tape?

Minimum throttle was set to 23%. But i noticed that the motor spins very slowly at this point (using Motor Test and setting Throttle to 23%). Perhaps this is because of the Throttle Expo. Can you please point out how the parameters Q_THROTTLE_EXPO and Q_M_THST_EXPO affect the output level?

As for timing, the arduplane documentation says RCOU.C5-RCOU.C8 are set at 400Hz update rate for a QuadPlane setup. Digging into the ESC manual, i found that it supports OneShot and i have set Q_M_PWM_TYPE to the default Normal. Is it recommended to switch to OneShot if the ESC supports it?

Thank again!

@tridge and all: Any help with above questions please!

Many Thanks!
Amir

The main way to test this is to do step pwm inputs from near minimum to maximum. Basically you need to abuse the low end of the RPM range with fast steps to high RPM.

This seems quiet high. Make sure you have calibrated the ESC’s.

They don’t impact the minimum and maximum throttle settings. At minimum throttle you should have an assertive rotation but not so much that it is producing a significant amount of thrust.

I was talking about the ESC phase timing. This is not a setting in Ardupilot, it is an ESC setting. There are a few settings in BLHeli that might help. RC Test Bench is a good reference for BL Heli settings.

This is probably not going to be any great improvement in your system. So at this point I would not add another variable.

No, it sets the target overshoot for the tests. This overshoot needs to be between 5% and 10% for best performance. However, the tests can’t tell the difference between noise and the actual movement so we set it to the upper range by default. The noise in the system will mean it ends up lower.

Autotune works between 10 and 20 degrees on the angle steps and aborts if it goes over 20 degrees. So this would have no impact on autotune.

Hello!

Sorry to revive the topic but we’re trying to do an autotune of our Qplane and are not getting desired results.

We set flight mode 6 to Qautotune and went for a test. We take off in Qhover and then toggle into Qautotune when we’re in the air. From what I’ve read on here we should see it twitch rapidly about its roll axis but we don’t get any reaction at all. Furthermore we can’t see the correct parameters in the parameter list. We’re running arduplane 4.0.5.

Thank you!

We managed to get it started by updating to fw 4.1.0! :slight_smile: Unfortunately our rig flips when we exceed 15 degrees so when autotuning the roll axis we flip immediately. Will update here and here if we figure it out.

First up, pretty much all quad planes should start out using these settings:
Q_A_ACCEL_R_MAX 15000
Q_A_ACCEL_P_MAX 15000
Q_A_ACCEL_Y_MAX 5000

are these settings for quad planes still valid?

As per the Tuning Instructions Guide these Acceleration rate parameters must be set according to the propellor size (which is proportional to UAV size & weight).

However, @Leonardthall recommended these for Pretty much ALL Quadplanes which does make sense as high rate of acceleration in Roll & Pitch is neither desirable nor safe for a Quadplane. I would start-off with these parameters for a Quadplane and work from there.

1 Like

Today something very similar happened to me. I believe I followed all advices from this thread regarding parameters. I took off, the VTOL was oscillating a bit. However, it kept position nicely, so I decided to switch to QAUTOTUNE. Since I set it to the lowest aggressiveness I thought it should be fine. It seems like it started autotune, but a few seconds into it the VTOL flipped to its left and crashed top-down.
In the logs I can see that RATE.Rdes all of a sudden goes to -170deg, which should be the reason for the crash. However I didn’t even touch the joysticks during the flight

Its a Cube Black, two GPS, one flow sensor and a rangefinder.

Can anybody see from my logs why this happened or if I set any parameter wrong?
Here are the logs, params and a video of the flight.
https://1drv.ms/f/s!AuKkq6JXpbFTzrUaVbcwDCcSh3o1eQ

@snakeeater I am very sorry to hear about your crash but I think I was pretty clear in the instructions lined above that you should not start autotune until you have “ensured that the current tune is good enough to recover from the repeated tests run by Autotune”. Given:

The tune was clearly not ready for autotune.

I go on to describe how to tune manually.

I am sorry to be blunt here but you clearly did not follow the instructions.

This is an excellent thread. Thanks to all who have contributed.

Sadly, I have had two crashes recently, so I am moving forward with this build more cautiously.

I’ve read this thread numerous times and went through the tuning process instructions. I’ve done four flights. No crashes!

The first two flights were done with

Q_A_ACCEL_R_MAX 50000
Q_A_ACCEL_P_MAX 50000
Q_A_ACCEL_Y_MAX 18000 per the Tuning Processes Instructions.

The log showed overshoots on all axis.

I then set the parameters suggested by Leonard.

Q_A_ACCEL_R_MAX 15000
Q_A_ACCEL_P_MAX 15000
Q_A_ACCEL_Y_MAX 5000

This alleviated the overshoots.

I am satisfied with what I am seeing on the pitch and roll axis, but I have oscillations on the yaw axis. It’s not visible when flying but obvious on the log.

Can anyone suggest what might be causing the oscillation? And most importantly can I proceed with an autotune?

Log to the third and fourth flights is attached.

The first flight was flown with ATC_RATE_FF_ENAB to 0. The second flight ATC_RATE_FF_ENAB was set back to 1.

Thanks,

Dave

Ok, thanks for the clear assessment. Thats what I was considering too. I thought my D gains were already quite low, but obviously i will lower them further and be more cautious regarding vibrations before starting the Autotune.

So you recon the PIDs were the main problem? That spike in the graph above is not some sensor failure/reset because of wrong parameters or anything, but it was actually the first normal cycle of autotune? I would like to understand it from the data.

Btw on the Quadplane parameter page https://ardupilot.org/plane/docs/quadplane-parameters.html it says:
" The most critical tuning parameters are Q_A_RAT_RLL_P and Q_A_RAT_PIT_P. These default to 0.25 but you may find significantly higher values are needed for a QuadPlane."

I think this gave me a completely wrong feeling about those parameters. My initial try was 0.3 based on that and the plane flipped right at the start, thats why I was rather positive how it went this time. Of cause I am just one point of experience, but my VTOL should be a rather average setup. Maybe it should be considered weather the documentation should be updated?

Hi Dave,

If you have any oscillation then you can’t proceed with Autotune.

The good news is I don’t see any oscillation in yaw. Can you show where you think you see it?

You do have some high frequency noise at about 80 Hz that you would benefit from removing with a notch or harmonic notch depending on where it comes from. A batch fft log would be the way to go here see what it shows.

Your filter settings look ok otherwise though.

In any case I would add the notch filtering after the FFT log flight before proceeding to Autotune. I suspect you would get away with it though. I just would do the setup properly first.

Yes that is correct.

Your log looks like it is oscillating in both Alt Hold and pitch. So I would read through the instructions above and make the appropriate changes I describe there. If you follow the instructions step by step you should do well.

Hi Leonard,

Thanks for the quick reply, Attached, please find an image of dyaw and yaw. I circled the part that I am bit concerned about.

I’ve never used FFT logs before. I do see the 80 hz noise in the IMU plot. Is the what I should filter out?

Df log attached link below.

Thank you. I really appreciate your time and experience.

Dave

Ok, I set up a harmonic notch filter linked to the throttle.

Did a few test flights. Everything looked good, so I proceeded with an autotune. First thing I noticed was a sharp yaw to the left, which surprised me because autotune is supposed to start with roll and I had Q_AUTOTUNE_AXES set to 1.

I gave it a few more minutes and didn’t like what I was seeing so I abandoned the autotune.

A few concerns:

The autotune seems too aggressive for a 2m QPLANE. Q_AUTOTUNE_AGGR is set to 0.1. Should I lower this to .05. AUTOTUNE_LEVEL is set to 6, which is default and consistent with the recommendation. Should I reduce the level?

The other concern is current draw during the autotune. It spikes to 160 amps. The four ESCs are rated at 60 amps and the Mauch Power module is rated at 200 amps. But the battery, connector, esc and engines are getting warmer than desired. I am concerned it may get too hot during an autotune. I plan to do one axis at a time, land, let it cool and do the next axis. And I am thinking reducing the aggressive may reduce the current spikes?

Long term I am not too concerned about the heat because we only plan to be vtol for a few minutes for takeoff and landing.

Any suggestions about how to proceed are greatly appreciated.

Thank you,

Link to the log for the attempt at tuning. It consists of two test flights and the autotune flight.

That is not oscillation. Oscillation is very regular and will look sinusoidal or at very least like a saw blade of some sort.

I am not sure what you want to show in that log but I didn’t see the batch fft logging there. Did I miss something?

This does not impact the tests just the choice of parameters. Three currently isn’t any way to reduce the maximum twitch request.

A quick look at your log doesn’t show any signs that I would be worried about. I can’t evaluate your power system but assuming it can take it I would proceed with autotune.

Lovely to see life return to the thread :heart_eyes:

We went autotuning recently and only managed to finish around the pitch axis. I’ve read previously that the PID’s are saved even if the autotuning did not finish completely. This seems to be wrong or maybe we are missing something.

Best of luck to everyone

Hello All,

I attempted another QAUTOTUNE today. It started out ok, but progressively deteriorated to a point where I was no longer comfortable continuing. My concern is large movements in the yaw and pitch axes while I am tuning the roll axis. I understand some motion on the other axes is normal, but both yaw and pitch seemed excessive and borderline unstable. At one point, the nose pitched down 35 degrees. Yaw is literally all over the place with several 180+ swings.

The winds were calm.
Vibrations look good
CG is at the recommended location.
The engines are close to the same PWM while hovering.

Not sure what else to check. But don’t have confidence in moving forward with the tune.

Attached, please find an image Des Pitch, Des Roll, Des Yaw. and a link to the log file.

Thanks,

Dave


Ahhhhh, I know what is going on!!!

You are starting autotune from Q_Loiter. This does a bunch of stuff for you like keeping you pointed in the right direction and fighting drift.

If you start it from Q_Hover then you will have to do all that yourself. I do it all the time like this so I didn’t think of it.

Basically do it on a calm day in a big field and let it drift with the air. Try to keep the axis being tuned 90 degrees to the air flow. ( I am deliberately not saying breeze or wind because you want really calm).

Sorry this did not click earlier!