New Motors and Arms - stable in Alt-Hold - oscillates in Loiter

I’ve installed larger motors and longer arms on my Holybro X500 V2. Props and everything else is the same.

I did an initial test flight with the same tune as what I had before - and the copter was stable in Altitude Hold - but oscillated in Loiter. Not a toilet bowl - just oscillations.

I went back to the beginning and repeated the Initial Parameter Setup in Mission Planner - took all the options, did my test flight, and did the second set of parameter changes as directed.

This un-did the auto-tune I’d done on my old setup. I left my FFT settings alone.

Test flying again - the copter again was stable in Altitude-Hold, but oscillated in Loiter.

ALTITUDE HOLD:

LOTER:

The vibe numbers look good, but there is a yaw in the motors shown in the RCOU. No doubt, I don’t have the new motors mounted straight yet.

Compass calibration is excellent.

I’d like the copter to be stable in LOITER before I attempt a new Auto Tune - but I think I’ll need a bit of guidance to achieve that.

I’d appreciate all comments.

This BIN file has a short flight in Altitude Hold - followed by a short flight in Loiter:

Old and new arms and motors:

ADDENDUM:

I just noticed that the current doubles from 20A to 40A from Atlitude-Hold mode to Loiter.

I think the Loiter mode is unstable because it’s trying to hold a bad GPS position, combined with very high PIDs from the old tune.
HDOP is poor at times and there is never a good quality fix.
You can see on the map the IMU calculated position and the GPS position never align.
image

Set FENCE_ENABLE,1 to avoid that situation - you wont be able to arm. Either that or stay in Loiter until you get “the green light” before arming.
Set GPS_GNSS_MODE,7 to aid in getting a more reliable 3D Fix.
Set BRD_BOOT_DELAY,3000 to allow the CAN GPS to boot before the flight controller.

I would set these “PIDs” as a new starting point, since the existing ones were for vastly different motors and props.
ATC_ANG_RLL_P,12.0
ATC_ANG_PIT_P,12.0
ATC_ANG_YAW_P,4.0
ATC_RAT_RLL_P,0.12
ATC_RAT_RLL_I,0.12
ATC_RAT_RLL_D,0.006
ATC_RAT_PIT_P,0.12
ATC_RAT_PIT_I,0.12
ATC_RAT_PIT_D,0.006
ATC_RAT_YAW_P,0.5
ATC_RAT_YAW_I,0.05

Set these to get the Harmonic Notch Filter working better
FFT_MINHZ,40
INS_ACCEL_FILTER,10
INS_HNTCH_FREQ,80
INS_LOG_BAT_OPT,4

To let the copter relax a bit more in position-controlled modes, and not track the GPS position so closely, set these:
PSC_POSXY_P,0.5
PSC_VELXY_D,0.25
PSC_VELXY_I,0.5
PSC_VELXY_P,1.0
They are half their original (default) values, so they are easy to put back if you find you need to more accurately track the GPS position.

1 Like

Ah Ha! - Light bulb moment!!!

It just dawned on me that even though I did the “Initial Parameter Setup” again - it kept the old PID’s.

Wow - do I fee like a moron!

OK - I can certainly use the PID’s you recommended.

I started this copter with a brand new cube - so it initially had totally default PIDs on it. Would those be any better than the one’s you’ve recommended?

Boy do I feel better now - thanks for saving my bacon again Shawn!

BTW - these test flights were in my back yard - under a canopy of trees. GPS is always a bit iffy back there…

Use the PIDs I recommended - plus all the other settings too.
Once you can test out in the open you can decide if you need to put the PSC params back to defaults, but they are safe to leave at the 1/2 values I provided.

1 Like

I’ve made good use of your PID suggestions - certainly solved the oscillation problem in loiter. Thank you.

The previous PID’s were based on auto-tune with motors that were too underpowered for this frame. As a result, many of the PID parameters were set beyond the published range.

I still feel like a moron for not realizing that the Initial Parameter Setup didn’t also reset the PID’s - that’s a bonehead mistake I hope I’ll never repeat!

I’ve decided to go to larger props - I can barely squeeze in 14" props now - and I’ve ordered new motor mounts that should allow 15" props without having to make longer arms again. Once I settle on the props, I’ll take it to the field for an auto-tune. Here’s the clearance I have for the 14" props. The new motor mounts will move the motors out about two inches.

I’ve got a spreadsheet going to help me keep track of my tuning changes:

I’ve uploaded a BIN from my latest iteration of changes. I could use some help on determining the INS_HNTCH_FREQ parameter. I though that was selected by looking at the FTN1.BwAvg chart and seeing what frequency it centered around. But maybe I’m confused about this. Could you please offer me some guidance?

Side Note: You suggested INS_LOG_BAT_OPT=4. It appears this value isn’t possible:

I would suggest to start with the following:

INS_HNTCH_FREQ 60
INS_HNTCH_BW 30
INS_HNTCH_HMCS 7

If you are not seeing this dialog box perhaps you are not on the latest version of MP? Latest meaning latest Beta. No reason not to frequently update to that. I do every time I start MP for the day.

What minimum clearance do you have between blade tips?

Dang! That’s where the pre and post options went!

When I went through FFT about a year ago, I remember this - and I’ve been wondering where it went.

Very strange that it requires a beta update. I used to do the beta updates often - but haven’t in a while. I’ll do it now.

Right now with the 14" props I have 53mm clearance between tips.

With the new motor mounts that add a couple of inches to the arms, I expect I’ll have that much or more with the 15" props I’ve ordered.

Ah OK, that’s plenty. I had a similar setup and the blade tips were more like 12mm apart and it exacerbated a vibration problem that was already present on that craft.

1 Like

Peter - I really appreciate your input on this. I tried hard to get the FFT processes and procedures correct - but obviously, I’ve still got some studying to do.

One problem that came to light was that it looks like I don’t have a current enough beta update to Mission Planner to properly enter bit mask option on INS_LOG_BAT_OPT to include the pre and post filtering. I remember comparing pre and post filtering graphs when I first applied FFT about a year ago - and it’s been nagging at me a bit that I hadn’t resolved that - and it never occurred to me until Shawn mentioned it on this thread that I need a newer beta applied to Mission Planner.

I input your suggested values - and conducted another 10 minute test flight. Looks good.

When I get the new Mission Planner beta updated (the install seems to be hanging right now) I’ll update INS_LOG_BAT_OPT so we can see the pre and post data after another test flight.

In the mean time - here’s the BIN file with your suggested FFT parameter changes:

And my updated worksheet:

1 Like

FFT is not picking up on the base frequency. I suggest you disable it
FFT_ENABLE,0
and set throttle-based HNOTCH as follows
INS_HNTCH_MODE,1
INS_HNTCH_OPTS,0
INS_HNTCH_FM_RAT,0.7
INS_HNTCH_REF,0.14
INS_HNTCH_FREQ,60
INS_HNTCH_BW,30
INS_LOG_BAT_OPT,4

At the moment you’ve got DSHOT600 set on aux outputs, but no ESC data, or even RPM data.
If you load the BDSHOT firmware you will at least have RPM data and you can set:
INS_HNTCH_MODE,3
to better adjust the HNOTCH with changing conditions.

Also since changing up to 14inch props you should adjust these:
ATC_ACCEL_P_MAX,84700
ATC_ACCEL_R_MAX,84700
ATC_ACCEL_Y_MAX,23400
ATC_RAT_PIT_FLTD,16
ATC_RAT_PIT_FLTT,16
ATC_RAT_RLL_FLTD,16
ATC_RAT_RLL_FLTT,16
ATC_RAT_YAW_FLTT,16
INS_GYRO_FILTER,32
MOT_THST_EXPO,0.7
and you would probably need to run Autotune

Good evening Peter -

OK - I managed to get INS_LOG_BAT_OPT set to “7” so that pre and post filter data would be collected.

I flew another 10 minute test flight. But I’m afraid I switched from 14" props to 13" props - so I’m guessing the notch filter numbers you suggested are a little off now. My apologies.

Even though pre and post data is supposed to be collected, I don’t know how to display it both. Could you please point me in the right direction?

From the graphs you shared with me from my previous BIN file, I understand how you derived the values of INS_HNTCH_FREQ, INS_HNTCH_BW and INS_HNTCH_HMCS.

As I recall from the wiki, once FFT is enabled, all associated parameters are supposed to be detected and set automatically. If I’ve mis-read this, I’ll go back and study it again.

But if there is simply some “fine tuning” that’s possible, I’d appreciate any guidance you can offer.

Many Thanks!

1 Like

Shawn,

I finally got pre and post filter data collection enabled - INS_LOG_BAT_OPT=7

I had some weirdness making this happen - you’ll see it addressed in a separate Mission Planner post.

Here’s a bin file with the pre and post data:

Maybe the “base frequency” is in this bin file now. From Peter’s helpful post above, I thought the base frequency could be picked off the FFT graphs. (easier to see when you zoom in on the graph)

I’ve changed the props again - 13" this time.

I plan to make a few more prop changes. I expect auto-tune will help sort the appropriate parameters out. But I’d like to know how the parameter changes you’ve proposed have been derived so I can be more knowledgeable and self sufficient.

Is there a reference on these relationships and settings you can refer me to?

Lastly - in the old FFT, you could see the “before” and “after” filter by enabling the options that collected one or the other - and graphing the results after test flights. But now that both pre and post filter data can be collected, isn’t there a way to see both for comparisons? I can’t seem to find that.

Many thanks

That gives you sensor rate , post filter and pre&post filter logging.I have never seen all of those options enabled simultaneously before! Sensor rate is why the frequency is scaled to 4kHz which doesn’t do anything for you. And the Gyr0 and Gyr3 graphs are the same so you are not getting pre and post. All you really want is option 4 pre and post filter. You can use the Gyr0 graph if you want as Pre filter data to set the notch but I would set option 4 and make another flight.

And as Shawn noted you may as well update to the Bdshot firmware now before proceeding further with tuning and get ESC RPM data going. The FFT referenced filter is looking a bit rough. RPM will serve you better:

Hi Joe,

Thanks for the info and if you have changed propsize then the HNotch values may need to be adjusted. I always do at least two short (hover in spot for a minute or so) flights recording the pre and post results separately.

I don’t actually know if it is possible to record both pre & post filter results and visualise this in MP. Maybe there is a version of MP that can do that but I’m not aware of that.

Hi Peter,
Yes, you can set INS_LOG_BAT_OPT,4 in recent firmware versions and you get both pre- and post-filter data in one log.
In the MissionPlanner FFT graphs you’ll have Gyro0 and Gyro3 for pre and post.
You can leave it set until you’ve finished making changes just in case there’s adjustments needed.

2 Likes

Thanks for the information Shawn - much appreciated - I did not realise Gyro3 was used as the post.

I will give that a go next time I’m setting up a HNotch. :slight_smile:

As per the Wiki:

Pre-Flight Setup

@xfacta @dkemxr @Clogz

Yes indeed - the correction option (bitmask) for collecting both pre and post FFT data is INS_LOG_BAT_OPT=4.

There is a caveat in the Mission Planner parameter description that’s not in the ArduPilot parameter wiki. It won’t work with both “sensor” and “post” logging.

And as a clarification to the comment by @xfacta - the “pre” and “post” are on the “0” and “3” labels - so the “ACC0” chart is the “pre” and “ACC3” is the “post” for the imu accelerometer. I don’t have a wiki reference for that - but it appears true from the graphs.

Similarly GYRO0 is “pre” and GYRO3 is “post”.

Now that I’ve selected the correct INS_LOG_BAT_OPT=4, this is shown now on the FFT diagrams:

Even with my swap down to 13" props - this seems to show that the parameter suggestions offered by @Clogz are effective.

As I understand it, now that I know FFT is working well, I can turn of pre and post logging to save processor load.

I’m curious about the “0” bit on INS_LOG_BAT_OPT for Sensor Rate Logging. I’m wondering when and if that option should be selected.

Also - on my test flight with INS_LOG_BAT_OPT=4 there were momentary oscillations that didn’t happen on my previous several test flight. This is particularly perplexing because the MavExplorer Attitude Control graph is looking pretty good for a copter that hasn’t yet been through auto tune.

I’ve uploaded this BIN file, in case you’d like to poke around a bit.

Thanks so much for all your kind help!

FFT_ENABLE,0
INS_HNTCH_MODE,1
INS_HNTCH_OPTS,0
INS_HNTCH_FM_RAT,0.7
INS_HNTCH_REF,0.13

You need to adjust the filters too. If you just go for
INS_GYRO_FILTER,30
ATC_RAT_x_FLTT,15
ATC_RAT_x_FLTD,15
they will be close enough for a range of props that you are trying.
Then you only have to change the ATC_ACCEL_x_MAX and MOT_THST_EXPO to suit the prop size.

You can leave INS_LOG_BAT_OPT,4 in place, that wont worry a Cube Orange at all.