How to methodically configure and tune any ArduCopter

Hello Andy,
Today I made some flights with adjusted FFT settings according to your and Amilcar recommendations.

Parameter Value
FFT_ATT_REF 15
FFT_BW_HOVER 126,2013
FFT_ENABLE 1
FFT_FREQ_HOVER 105,4383
FFT_HMNC_FIT 10
FFT_HMNC_PEAK 0
FFT_MAXHZ 70
FFT_MINHZ 25
FFT_NUM_FRAMES 4
FFT_OPTIONS 0
FFT_SAMPLE_MODE 0
FFT_SNR_REF 25
FFT_THR_REF 0,0974717
FFT_WINDOW_OLAP 0,75
FFT_WINDOW_SIZE 256

(Some of them are calculated results and not set by me)
You see, that FFT_MIN_HZ is set to 25 Hz and FFT_WINDOW_SIZE set to 256 as recommended by you, FFT_NUM_FRAMES set to 4.
I set FFT_MAX_HZ to 70 due to the assumption that the propellers will not exceed 4000 RPM (according to the specs from T-Motor for that motor / propeller combination).

The results still seem to be not even close to the expected 35 Hz.
Here you find a log from a short hover flight:

So if you see no further things to try, I will switch over to throttle based notch filtering.

Call me on Monday and we can discuss some alternatives

I think it may be helpful for others planning a build of a 24" copter around 5.5 … 6 kg, when I give an update here:

After adjusting and testing some FFT parameters for the inflight FFT, the “learned” hover frequencies look better. I will show them at the end of this post.

With these settings I started another AutoTune - this time with AUTOTUNE_AGGR = 0.075. The reported results were:
Roll Angle P: 10.234, Max Accel: 63064
Roll Rate: P: 0.119, I: 0.119, D: 0.0028
Pitch Angle P: 11.283, Max Accel: 70317
Pitch Rate: P: 0.126, I: 0.126, D: 0.0033
(To remember: The QuikTune rate P and I were around 0.108 on each axis and when I tuned with AUTOTUNE_AGGR = 0.1, the rate P and I were around 0.148 (pitch) and 0.164 (roll)).

So, the PIDs were lower after that autotune but the max accels (ATC_ACCEL_P_MAX and ATC_ACCEL_R_MAX) as well as the angle Ps (ATC_ANG_PIT_P and ATC_ANG_RLL_P) were still pretty high for that large copter.
Perhaps I should also mention, that during the AutoTune there were some messages saying “AutoTune: failing to level, please tune manually”, but the process continued without visible problems and finally succeeded.

With these settings, the reaction to stick commands in AltHold feels very tight and it did not oscillate. When switching to Loiter, oscillations were not as visible anymore as before (after first AutoTune), but still audible after short stick impulses. May be, this could also be solved by tuning the position controller, but that’s another story…

So I decided to manually lower the relevant values stepwise. After several tests, the following settings feel ok and do not result in visible/audible oscillations after short stick commands in Loiter any more:
Roll Angle P: 7.0, Max Accel: 48000
Roll Rate: P: 0.115, I: 0.115, D: 0.0028
Pitch Angle P: 7.0, Max Accel: 48000
Pitch Rate: P: 0.115, I: 0.115, D: 0.003

Regarding the FFT settings for the inflight FFT, these are my current values after the last flight:


(some of the values are “learned” results)

The trick in this case seemed to be to set the “FFT_MAX_HZ” value slightly lower than the first harmonic (fundamental hover frequency was around 32 … 35 Hz and first harmonic was around 65 … 70 Hz - just to make clear what I mean, because ArduCopter seems to use other naming conventions for these peaks). Further adaptions were made at FFT_HMNC_FIT (changed from 10 to 20) and FFT_HMNC_PEAK (changed from 0 to 2) and FFT_WINDOW_OLAP (changed from 0.75 to 0.5).

During a longer flight with altitudes up to 100m, this was the resulting FTN1.PkAvg graph:

The determined peak frequencies during the flight seem a bit lower than expected (may be, due to the changed setting of FFT_HMNC_PEAK from 0 to 2), but at least, they are not as far off than before.

The CPU load of the Pixhawk 6X (H7) with these settings was around 33%.

1 Like

Those are good news.

Yes, the FFT is now tracking the first harmonic (fundamental). I’m glad the FFT_HMNC_PEAK and FFT_HMNC_FIT tip worked. This allows both the quicktune and the autotune to deliver much better results.

Roll Angle P: 10.234
Pitch Angle P: 11.283

Are good results.

Now you can continue to the loiter (position controller) tuning step on the methodic configurator and wind estimation and baro compensation steps.

After those your loiter should work great.

Quick follow up on this subject!

Im still using your configurator on some new copters and the initial hw json even off the latest build on github requires RC and Telemetr

Edit:

Looks like my quote didnt work

Im referring to copters using the master/mavlink-rc branch where the elrs radio is both sending telemetry and rc override messages, so no separate rc and tele radios

Please post a .zip file with all the files in the ArduPilot methodic Configurator vehicle configuration directory.

@amilcarlucas First flight was a success, but not its another language trying to understand all the info from that log and how to setup a notch. I read this… new FFT Filter setup and review web tool but I feel like I know less now than I did. Maybe I can post the .bin file and someone could help if there is any help for me, haha.

  1. Select only “Pre-filter X” and “Estimated post-filter X”

  2. there are three peaks, looks like the frequency of the first one is around 55Hz, enter that in the Notch settings

  3. select first, second and third harmonics.

  4. Post a picture with the new settings, or a .bin file

…and select Linear scale too - much easier for us mere mortals to understand the graph.

@amilcarlucas @xfacta


Screenshot 2024-08-15 165150

This is a more detailed of the original picture that I posted. 48.93Hz is the first if I am reading this correct.

Yes, you are reading it correct.
Did do a flight with 49 Hz already?

I haven’t setup any filters yet.

I am here right now at this point reading trying to make sure I don’t screw anything up.
Correct me if I am wrong but this is where I put the Info?
Or is this the screen?

Can you provide the log for those noise graphs? Do you have ESC/RPM data available, or will you be using the throttle-based notch filter?
Once we know that, those values can be set.

@xfacta this may be basic but where do I get those graphs? Yes I do have RPM available.

I just meant could you send us a link to the .bin log you used to generate those graphs - I assume they are your graphs…

18_notch_filter_setup.param is for estimation before the first flight when you still have no data. Leave that unchanged.

19_notch_filter_results.param is where you input the correct values that you where able to determine after analyzing the graphs from the first flight.

ATT 40
BW 24
FMRAT 1
FREQ 49
HMCS 7
OPTS 0

You need to have a vehicle connected to be able to change the parameters

@amilcarlucas thank you for that information

I tried to write those changes but it failed after 3 attempts, so I went into mission planner and plugged in the settings. Here is a shot of the settings, does this look right? should INS_HNTCH_MODE be set to throttle?

image

2nd flight with the parameters that are in the picture above.

Here is a Shot of it.

Maybe my answer to this question is located in the next portion of reading for me…
Should I configure a INS_GYRO_FILTER and if so where woould I find that info?

Yes filter is working fine now.

Send me the files so that i can have a look

One thing that I want to note is.

Hover flights work great, slow stick movements no issues.

If I do any quick stick movements then allow recenter then I get a massive wobble and it crashes.

Here is the bin from the just now crash flight

Any assistance would be appreciated.