Reading log files / twitchy hover

I am trying to better understand long files and tuning. I have a custom quad x. It flies very controlled, but it seems to twitch continuously while hovering. I’ve done some tuning to the PID values, and it is a little better, but not perfect. I have other models that seem to hover just fine using the same flight controller.

The vibe data seems to be within tolerance from what I can understand. Pitch and yaw
desired and output doesn’t seem crazy. Roll seemed a bit odd at first, but now I cannot seem to see it. I’m not sure what else to check or how to translate the roll concern into a tuning plan.

Any pointers on what might make this aircraft more stable would be appreciated.

testflight-clip.log (692.1 KB)

Looks like you skipped all the steps for Initial Tuning and simply dropped the Rate PID’s. Not much to see in that log but what there is the tuning is bad as one would expect.
Start with the Initial Tuning Parameters screen in Mission Planner. Setup>Mandatory Hardware>Initial Tune Parameters.
Then configure the Throttle referenced Notch Filter
Review the Motor range settings Motor Ranges
Set the PSC_ACCZ_P&I values based on MOT_THST_HOVER (see tuning wiki)
Review the baseline performance before advancing to Auto Tune.

Good day. Thank you @dkemxr for your reply.

It seems true. I’ve been working on a few airframes at once. I’ve been using more linux systems these days and MP is rather problematic, so a few airframes I configured with QGroundControl, which seems to omit this step? I didn’t see it in AP_Planner either?

Is there some stand-alone tool that does this initial tuning really well?

BTW - I assume you just looked at some of the parameters like ATC_RAT__FLT to see they were at the default? Is there some way to devine this from the flight data? I’m just curious how you approached it to learn myself how to spot problems.

The log is truncated due to upload size restrictions. There’s about a 10 minute flight of yaws, turns, ascends, decends, etc. What kinds of things do you look for? Is it useful to try to set up a link the entire file, or just proceed to the remaining steps, then continue from there?

The changes using the initial tune feature seem rather small. The biggest changes were in ATC_RAT_(pitch/roll)_FLTx. This is promising since this is where the twiching is, but the changes didn’t really seem significant. I ignored the reset of motor hover thrust down to .2, as I assume the test flights have modified this to a better setting at 0.3~. Is that reasonable or should I take it down?

I will take a look at the other settings you mention next. I’m looking forward to understanding these better. It might take me a week to get back to a test field.

Thank you very much for the guidance.

Use Mission Planner for Arducopter to configure things and get it calibrated. After that if you want to use another Ground Control Station App fine.

Just follow the instructions given and work thru the normal tuning process. It’s pointless to answer your specific questions until you have done so. There are Wiki entries for all these steps.

It took a while to get out to the test ground, but the wiki instructions have been completed as far as I have been able.

The initialization steps, mot ranges, psc values are all simple enough. All of these steps do not have any noticeable difference in flight stablity. The aircraft still twiches.

The notch filter steps could not be completed because the steps on the wiki at the following page to generate the data required to set the notch filter don’t seem to generate the expected graph.
(Measuring Vibration with IMU Batch Sampler — Copter documentation)

The IMU Sample button just brings up a black window. There is only one of buttons of the fftui that seems to generate any graphs at all is the “Run all imus - IMU1 - 3 MSG”. But the graphs are all too low frequency I believe to be of any use.

Here is a link to log file and screen shots of the graphs I was able to generate and the test flight log.
https://www.dropbox.com/t/65rR0ukgdM8eADEC

Any pointers on how to proceed would be appreciated. Thank you.

It has to be a .bin log file (not .log) for Notch Filter review. So, either post that or figure it out for yourself. But, you won’t see anything w/o setting these parameters 1st:
INS_LOG_BAT_MASK,1
INS_LOG_BAT_OPT,4
And set this:
INS_ACCEL_FILTER,10

Thank you kindly for your reply.

My apologies for the conversion to log. Here are the bins. There are two flights. The mask and opt were set as recommended. Filter was set to 20. If that is not satisfactory, please let me know and I will have to do another test flight. Thank you

Like to log bins:
https://www.dropbox.com/t/MEM0XaZ3Jgr2qo2U

Thank you.

There are two flight logs. Please use the file testflight-20230822-15h36m24s.bin

You can check the other, but I may have turned off the mask and opt to check if performance was any better.

Thank you.

There is something wrong with that log. No batch data found and there is no baro data either. You will have to make another flight. Enabling or disabling Batch logging will have no effect on flight so enable it and leave it enabled until tuning is complete.

That explains why no fft output. Do I understand correctly that the options above are all that’s necessary to enable? I have appt today at test park and can try again. Thank you.

I was able to generate a log file today that generates the expected Fourier transform data. These were made with the above recommended settings and additionally I set the accel filter to 10hz as recommended.

New logs at:
https://www.dropbox.com/t/4fssDuY347mw9RCV

The graph I got is below:

If I understand correctly, there is something going on around 97, 172, and 260ish hz. This seems to dampen as freq gets higer. This doesn’t look quite like the sample in the wiki with a single peak, so I’m curious if this is common to see a descending wave of peaks like that.

Any idea what that dip at 400hz might be in the acc0 graph?

The observable symptom is that in hover, occasionally, one corner of the craft slightly drops momentarily. This is not constant but occurs with a non-uniform period of a few seconds. It looks like twitching. Also, the motors seem a bit hotter than they should be.

What is the best way to proceed, and with which peaks?

Thank you.

BTW - I think the problem with the corrupt files earlier was something in the default log directory that was interfering with the log download from the vehicle. The file sizes weren’t matching after download, so I moved everything out of the default log directory and things got better.

Use the Ardupilot Filter Review Tool Filter Review Tool
And always select Linear scaling whether it’s using the tool or Mission Planner. Your Log scaled graphs are not that useful.

Here is pre-filter data:

And Estimated Post Filter data:

With these settings:
Settings

After trying these settings out tweak the values if required now that you know what to do.

Thank you very much for patiently following with me through the various log issues to provide this helpful guidance. I’ve followed the above and set the firmware parameters. I have a flight scheduled for tomorrow. I am looking forward to observing the performance with the notch enabled. Thank you.

The flight went well. Thank you for all that. The occasional twitching, or hiccup, behavior unfortunately did not improve noticeably.

I was able to use the new log and tools (thank you) to graph the performance of the new notch filter. The post filter data matches very closely the estimated post filter date produced before enabling the notch. So that seems to be doing its job. There was no noticeable difference in motor temp or handling, although it handles well.

Prefilter:

And the postfilter:

That seemed to make a big difference in the signal. It appears something else must be causing the hiccuping. Any pointers on next steps are appreciated.

Thank you.

New log is at: https://www.dropbox.com/scl/fi/554ljdqggx4oit3wdg56b/2023-09-08-15-48-14.bin?rlkey=kk0ml8p4dk61tfugp6qp8i3b0&dl=0

Try lowering the Rate Pitch and Roll P&I values to 0.1 (from 0.14) and try again. If there is an improvement then try Auto Tune.

Thank you for this suggestion. It took a while to get scheduled at the test park, but I was able to finally try this suggestion today. Thank you.

Basically, it didn’t stop the behaviour. In fact, maybe it was a little worse. So I tried a series of test flights slightly tweaking the parameters just to see. The pid values for each flight were #1/0.1/0.1/0.002500 (as suggested), #2/0.8/0.8/0.002500, #3/0.15/0.15/0.002500, #4/0.15/0.15/0.00125, #5/0.15/0.15/0.0025, #6/0.15/0.15/0.003000 **increase altitude climb response (i used qgc slider so I don’t know which value it changed), #7/0.15/0.15/0.003300, #8/0.15/0.15/0.003000, #9/0.15/0.15/0.002800, #10/0.15/0.15/0.003000

Changing the PI values in the range of 0.08-0.15 didn’t seem to affect the hiccup behavior much at all. The copter seemed a little more sluggish at the lower values. But that’s about it. It was controllable within this range. 0.15 seemed a bit more responsive, if that is consistent.

Upping the climb aggressiveness seemed to give the best result. It was still hiccuping, but it seemed more shallow. Increasing the D value also seemed to help. 0.003300 seemed worse than 0.003000 and 0.002800 seemed worse than 0.003000. So I left it there.

But the motors still seemed hotter than they should. They’re 920kv motors with 9450 props. They were touchable, but barely. I’ll maybe measure that next time just to make sure it’s normal.

For tuning, I’m wondering what next step to take. I’m not sure which logs would be most useful, or which parameters to check to diagnose this further.

Thank you for getting me this far.