Tuning a fleet of large quadrotors

Hello,

I’ve seen some great feedback from this forum, so I thought I’d make a post here. I’m looking to take my quads from flying OK to dialed-in and I really don’t have the depth of experience to know what is needed to make that happen.

For some background, I’m a researcher with the University of New Mexico where I’m using Computer Science to study volcano plumes using a swarm of large quadrotors. The quads we’ve built have 18" arms, use ardupilot on a cube black, along with some large T-motor motors, ECs, and 22" props. The whole quad is designed to fly up to an hour in order to collect gasses above an active volcano. Additionally, we’ve set up a network so that our 5 quads can talk to each other and coordinate their flight - meaning we can fly them in-formation as a single unit or fly them independently and have them trade data. Pretty exciting stuff!

My goal is to make our quads as stable as possible to prepare them for the adverse conditions we may see on the top of a mountain. This would include gusty or high wind scenarios. So, that our automated flights will have their best chance for success.

What we’ve done so far is the following:

  1. Autotune - we’ve relied heavily on autotune on a single quad to set the PIDs. We adjusted the D parameter up a bit following some analysis of the logs (up from 0.001 to 0.005) for some better response out of the quad. We copied this autotune to the rest of the quads in the swarm.
  2. Vibration dampening - we’ve combated vibration using a vibration gel under the flight controller and added some weights to the top of the cube to help in this regard. This significantly reduced vibration.
  3. Setup a static not filter - this took vibration down from sometimes touching 30 to under 10 almost always and seems to make the quad behave better. The RPM we setup to filter is 48hz.

What we’re seeing now is sometimes the quad has some erratic behavior. First, in gusty winds, we see the quad overcorrecting or oscillating in a scary fashion - well, almost any drastic mauver is scary for a large quad. This leads me to believe we’ve set the D parameter too high, or it’s not balanced with a proper P parameter. Second, when flying over bushes, the quad changes elevation in an extreme way, meaning that we see the quad bounce around due to (what I can only guess is) lidar inputs. Again, it seems like the quad is over-reacting to inputs instead of smoothly reacting to inputs.

So, I’m reaching out for help. Here are two recent example flights:

  1. This is a baseline tune that we run on all our quads:



    And the flight log for this: https://drive.google.com/file/d/1ehyKYq1NGAG_BOcGcj7nZ6WXhreKBI8f/view?usp=sharing

  2. This is a recent retune with a higher aggressiveness setting:



    And the flight log for this: https://drive.google.com/file/d/1CPsQ4bobxN5jHxSHNQqtIzmb20u3vqVY/view?usp=sharing

What should I do next to tune the quads? If more data or a certain flight would help, I’m game to fly it.

1 Like

And for an example of the over-compensation we saw in gusty conditions, here’s the desired vs actual roll and pitch:


And the log: https://drive.google.com/file/d/1V3-_I9bVbEBTLSfDTTbIT1rlmjJszaPw/view?usp=sharing

1 Like

Reviewing the logs further, it seems that every time we have one of these overcompenstations we are hit by a high degree of vibration which (from reading this) causes some clipping, which is an indication that vibration is out of control.

Since this flight, we have added the static notch filter that seems to reduce vibration significantly. I’m going to be flying again soon in similar conditions and I’m hopeful that this situation should be resolved. I’ll report back in case anyone is interested.

1 Like

Just flew today in gusty conditions with a consistent wind speed of 15mph with gusts up into the 20mphs. With the static notch filter involved I didn’t see any of the erratic behavior. Maybe this solves the problem I had with the quads?

Ok, my big question now is: the pid values, especially P gains for pitch and roll, seem low. Are these low for this quad from anyone’s experience?

Yes, low. Post a log with the Notch filter set. You are saying static notch, why not a dynamic notch?

Sorry, I misspoke, I believe I have the dynamic notch filter set up - I have INS_HNTCH_MODE = 1 (following this post and the docs)

Here are the params:

INS_HNTCH_ENABLE = 1
INS_HNTCH_REF = 0.125
INS_HNTCH_FREQ = 48
INS_HNTCH_BW = 24

The flight from today in gusty conditions (Quad #3): https://drive.google.com/file/d/1erdOGc9rwBstLvLq0dTm4vjZVOR4qjdX/view?usp=sharing

And the flights on Quad #4 that includes the post-filter gyro data (INS_LOG_BAT_OPT=2) while tuning the dynamic notch filter from a few days ago:

Pre-filer:


Log: https://drive.google.com/file/d/1j9hypR441vc8hihasC_Oot6PcPEx7Zaf/view?usp=sharing

Post-filter:


Log: https://drive.google.com/file/d/1c4loMDoWXdPtlbeuKVXiSnBYJGAt7B8X/view?usp=sharing

I would try setting the rate filters to 12Hz, the PID values back to default, Autotune aggression to .1 and these and run another Auto Tune:
ATC_ACCEL_P_MAX,45000
ATC_ACCEL_R_MAX,45000
ATC_ACCEL_Y_MAX,17000

This assumes it will fly w/o to much trouble with default PID’s.

Commanded motor outputs are not that well balanced. To what do you attribute that to?

It’s been a while since I ran with the default PIDs, but I don’t remember them being an issue.

I recently autotuned with aggression set to 0.1 and I ended up crashing when starting the pitch tune. (log if you’re interested) I’m ok trying it again, but I guess I’m nervous doing so. I did start with the ATC_ACCEL_* values close to the ones you mentioned quite a while ago when I started the tuning process.

The output balance is probably due to how we mount the battery. We offset it slightly to the rear to counterbalance a potential payload. Is this a problem?

And the rate filters you’re referring to are the following?:

ATC_RAT_PIT_FLTD = 12
ATC_RAT_PIT_FLTT = 12
ATC_RAT_RLL_FLTD = 12
ATC_RAT_RLL_FLTT = 12
ATC_RAT_YAW_FLTT = 12

Why 12? I had them at 10 to match INS_GYRO_FILTER / 2 from the docs

I would position the battery at the CG for tuning. Yes those filters. In some cases the tuning guide suggests these values too low for larger prop craft. The gyro filter at 20Hz is fine.

Ok, I’ll give this a go tomorrow morning and let you know how it goes.

Thanks for your help on this @dkemxr!

And I’m not seeing the same post filter FFT as you posted. Update Mission Planner to latest Beta.

Maybe before running Autune , but after making the suggested parameter changes, simply do a ~1min hover flight in Althold with INS_LOG_BAT_OPT at 0 and post that log. You have so many graphs and logs posted in this thread perhaps it’s best to start from the beginning.

What you posted is what I see too, just scaled (notice Amplitude axis):

On that note, I set the INS_HNTCH_FREQ = 48 to match the peak I see. Do you happen to suggest another frequency?

I can run another pre-filter log. Do you want me to keep the filter enabled for the autotune?

I don’t know, you can’t base the filter settings on post filter data.

Absolutely you need the filter enabled for Auto Tune.

Ok, started with default PIDs this morning. Did a compass calibration and an acceleration calibration (both were asked for). I had to lower the P and I gains for pitch and roll because I saw some unwanted oscilations. Now Stabilize and AltHold are reasonably solid. Here are the baseline pids:

I also measured out the motor distance from the center. Come to find out C1 and C4 were farther out than C2 and C3. I moved them to be exactly the same distance from the center.

And the pre-filter fft analysis:

Looks like the motor peak is at 41hz. Im setting the filter to accomodate this frequency and running a post-filter analysis.

Here’s the log for the baseline flight: https://drive.google.com/file/d/1GUiEbV43EiP_UFYPSIPXOvolGqI_O0o5/view?usp=sharing

Yea, looks about right.

Here’s the post-filter fft analysis:

And log for the flight: https://drive.google.com/file/d/1_aTGFvSgrYN_NrIMxnBLvsBqoZd-ORBV/view?usp=sharing

Anecdotally, she feels solid already. About to go into autotune…

If AutoTune softens everything back up you may have to revert back to this and manual tune. Worth trying though.

Ok, bad news. I crashed two of the quads during the pitch autotune. :anguished: I believe the first crash was due to a desync on a motor I repaired from my last tuning outing. The second crash, though, was from excessive oscillation and it just couldn’t recover. Note, I performed the same parameter reset on 3 as I did on 4

First autotune (on 4): https://drive.google.com/file/d/1e0RxIp2RR-orD-0g8NF7vh3PR6ohd6fa/view?usp=sharing
Second autotune (on 3): https://drive.google.com/file/d/1lu291X56Ye5i0yJOc0Kxln4HYjBUA2o7/view?usp=sharing

I’m done tuning for the day as I need to repair the quads. Luckily only some 3d printed parts broke.

I’d appreciate your analysis of this @dkemxr and advice. Thanks again!

Mulling the flight over on the way home, perhaps I set the initial pitch tune P too low. I really only saw oscillations in the roll direction, but set the P to 0.085 for both roll and pitch.

Sorry to hear that. Yes, perhaps P was too low. I would set these back to default for now:
MOT_SLEW_DN_TIME,0.025
MOT_SLEW_UP_TIME,0.025

And set these to 6S (right?) recommended values:
MOT_BAT_VOLT_MAX
MOT_BAT_VOLT_MIN

Also check out PM Nlon and Load in the 2nd tune log. Both are pretty high, something is bogging it down (for lack of a better term). Try turning fast sample off for the 3rd IMU3. Dynamic notch only runs on the 1st one anyway.

These values are set to 0.025 as they were during today’s flights:
MOT_SLEW_DN_TIME = 0.025
MOT_SLEW_UP_TIME = 0.025

I’ve setup the 6S parameters following the docs:
MOT_BAT_VOLT_MAX = 26
MOT_BAT_VOLT_MIN = 18

We added some weights to the flight controller to help dampen vibration, along with some vibration dampening gel, could the be the culprit that is “bogging it down”?