QAUTOTUNE - VTOL autotune for quadplanes

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!

Thanks Leonard. I’ll let you know how it goes.

Well another frustrating day in my drone building life. Went to the field twice today. Two takeoffs, one landing and one crash.

Earlier today, we tried an autotune. The winds were calm when we started but picked up during the flight. Again the VTOL wasn’t responding to the tune as expected. We abandoned the tune and attributed performance to the wind.

Hours later, the wind was calm. If not zero very close. So we decided to give it a go again. Charged the battery and full of optimism to the field we went.

Took off in qstablize, selected q hover, climbed to 30 meters and initiated the tune for the roll axis only. Again, I was quickly concerned about what I was seeing. While responding to roll, the drone would often move back and forth aggressively. I expect some movement but sometimes it would quickly, almost violently, slide 10m aft. Despite my concerns, I continued the tune. I had to re-position the drone several times. Each time the tune would resume. At one point, I had to be close to the end of the tuning process, the drone spun out of control. I quickly deselected tune and was hoping for a recovery. No joy! Sucks! Total loss. Foamies don’t do well when they impact the ground. Although I am not sure any material would survive the impact.

My initial thought was an ESC desync. I don’t see any evidence of that in the log. Additionally, the vibes, batt voltage, Vcc to the Pixhawk 2.1 look good. I don’t know what else to check.

No indication of physical failure. All props intact although forward two broke on impact.

GC is slightly forward for plane.
While hovering, the drone is fairly stable. It doesn’t move forward or aft, suggesting the front motors are vertical, It doesn’t move left or right. In a hover, PWM to the engines is around 1500 for all engines.

The build seems solid but I am obviously missing something.

Log attached.

Any help is greatly appreciated.

Thank you,

Dave

Hi Dave,

That sucks, I am very sorry to hear about your crash!

I know it is too late for you now but in general Autotune should move in one axis at a time and recover pretty cleanly back to level. Autotune is only running during that very short twitch. Other than that it is running Alt_Hold or Loiter. So if it is not recovering cleanly then either the starting tune needs work or there is another problem like sync loss.

In this case it does look like desync. It appears you are getting partial desync on numerous occasions through that tune.

I assume you calibrated your ESC’s. Your min throttle is set to 15%. This is all ok assuming you are not using ESC’s with a fixed pwm range. If you are using BLHeli esc’s you have some options to reduce desync. If not, all you can really do is increase your Q_M_SPIN_MIN value.

Sorry again Dave!