Loiter Performance: Sometimes good, sometimes terrible

I have been testing around with loiter mode on my quad and it seems to be very moody. Sometimes it works very nicely but fails terribly at other times.

I am using a Matek GPS & Compass combi M8Q-5883.
Ardupilot v4.3.7 on a Matek H743.
I also use a downward facing rangefinder backed up by the FC’s onboard barometer.

While testing today I first got the worst and later the best loiter performance so far, without changing any of the parameters.

In the bad attempt the copter was generally drifting all the time in different directions and sometimes mocking me thinking it would perform a flyaway only to stop after about 10m. I also had to intervene a lot with RC input.
This process repeated with the next two packs, afterwards I gave up for a bit.

About an hour later I wanted to fly a little in stabilized mode and then switched back to loiter out of curiosity when it suddenly worked perfectly fine. I was experiencing good XY-position holding and could even forcefully push my quad in the air because it would recovery its position perfectly as it should.

What itches me is that I have not changed a thing - so I wanted to have a look at the logs.
As the wiki tells about the Loiter mode I looked at the Navigation Velocities.

Here is a comparison of the bad (left) and the good (right) flight.
The scales are always matched for better comparison.

  1. Velocity East

    Desired Velocity East PSCE_DVE (blue), Target Velocity East PSCE_TVE (orange) and Velocity East PSCE_VE (green)

  2. Velocity North

    Desired Velocity North PSCN_DVN (blue), Target Velocity North PSCN_TVN (orange) und Velocity North PSCN_VN (green)

Although the right log is clearly more calm I do not see a real issue in the left one because the VE/N follows the TVE/N nicely (most of the time).

I also looked at the Mag_X/Y/Z and compared it to BAT_CURR but there seems to be no interference.
I will attach these two logs, I would appreciate if you’d have a look at them.

What else could I be looking for in the logs to troubleshoot this? Do you have an idea?
BR, Felix


Post a link to the log file.

1 Like

Here is the link to the logs

the first one is the bad the other the good one

I would start with some basic tuning and you should be using the Bdshot version of firmware. It looks like you have done the Initial Tune Parameters only. Set these and configure the notch filter:

You have MOT_PWM_TYPE,5 (Dshot600 is generally the most Stable)
And Set the Motor Ranges Setting Motor Ranges

If you want help with the Notch Filter just make a simple AltHold hover flight for ~1 monute or so and post that log.

Thank you for the instructions. I think that my ESCs don’t support bi-directional DShot. They are pretty beefy but they don’t run BLHeli. I take this information solely from the retailers website, link:

note: I have v1, not the newer v2 which do support bdshot

Other than that I did as you said and would gladly take your help with Notch Filter tuning.
Here is the log from the AltHold flight:

There is also another Loiter flight in there, which I did right afterwards.
I would call the performance not good not terrible, somewhere in between my two flights from yesterday. So I am still seeking for continualness.

You have good RPM data there, so that is very handy.
Set these for the Harmonic Notch Filter:

INS_HNTCH_ENABLE,1  // write then refresh params to see the rest

And set these for other general tuning


Your GPS HDOP is always bad so you might have to do something with cabling or blocking interference. The update rate is less than ideal too.
Start with these settings:
if your GNSS unit handle Galileo well, or if it doesnt:
Which will limit the number of constellations to improve the update rate, and probably also give you a quicker time to 3D Fix and hopefully improve the HDOP too.
Where I am using Beidou gives slower time to Fix and worse HDOP, even though there is more sats.

Now run Autotune, and when attitude control is improved we can assess Loiter performance (position controller) much better.

Hi Shawn,
thank you for your response.
I am waiting for some new 3D parts to get the drone into the air again, so it might take some time until I can test the new changes and perform the autotune.

I am a little concerned about setting the ATC_THR_MIX_MAN value. As far as I understand it, this mixes who is in control of the copter, either the pilot (throttle, right?) or the attitude controller. Well, I don’t put a lot of trust in my quad right now, so I’m not sure if I can give up some control. I put this value to 0.3 for a start but maybe I’m seeing this wrong?

Other than that I also had a look on the HDop value as you mentioned. In the original two logs (bad, good) there is deffinitly a difference.

GPS_NSats (orange) and GPS_HDop (blue).

Do you think this might be an indicator of what is the problem with my loiter performance?
Anyways, I will finish the tuning and playing with GNSS_MODE and keep you updated with the logs once it’s done.

So weather is getting a little better and I was able to do some testing. Unfortunately, it is still windy so I haven’t tried out autotune yet.
I also haven’t changed anything with the GPS yet.

Despite that, the copter is behaving very nicely today. Loiter performance is good to excellent.
The vibrations were removed nicely with the notch filter, thanks for that.

Old Log:

New Log:

Also HDOP was quite good on these (three) new flights.

Maybe I was just lucky today, but it seems that my problem with consistency and bad loiter performance is gone.
Thanks to everyone for the tips!