Quad drifting in loiter mode

Hi all,

I have a Pixhawk 2.4.8 running Arducopter v4.0.3.

My drone appears to fly fine in stabalize and alt hold mode. However when switched to loiter mode it drifts at around 1-2m/s in a seemingly random direction.

I have recalibarted the accelerometer, compass and radio with no success.

Note that I am only using the internal compass on the Pixhawk, as the GPS compass appears to not work with my firmware. I recalibrated the sensors mentioned above between the two flights.

Here are the log files for the two flights where I attempted loiter mode.

Log 1
Log 2

I also have recordings of the flights. Here is a short video of two attempts at changing to loiter mode.

Now being quite new to this hobby I am not hugely familiar with how to read the log files, but the things that catch my eye are the pitch/roll graph and the GPS speed graph, shown respectively below.

Running log analyzer gives these results (note the fail on the compass).

analyzer

Suggesting it may be a problem with me only using the internal compass. I have also not ran the compass motor calibration. Could this be the problem? I didn’t think that the compass was used during loiter / pos hold mode.

I have also just noticed the GPS_GLITCH error. Although I checked before the flight that I could change to loiter mode successfully and it said I had >10 satellites.

Thanks in adance for any help and I hope you are all staying safe!

EDIT:

Having run the compass motor calibration, this is the graph that is produced.

Vibrations cause that. Stiffen the frame, dampen the PH mount, and parameterize the notch filter, and your copter will start to work like you want.

Ah interesting. So should I not be concerned by the high compass interference?

Here is a graph of my vibrations which don’t seem to be huge in comparison to whats mentioned here.


I have my Pixhawk on a vibration mount (that also acts as the PDB / power module), and have some wires routed underneath that may be preventing some vibration damping. I don’t think it would make a huge difference however. I have had the drone flying successfully in the past with this frame on loiter / auto.

First of all, follow this tuning guide if you haven’t already. Have you run an autotune yet?

I definitely think that your compass is making a difference. Try installing the latest 4.0.4dev and the latest beta mission planner. You’ll see the compass calibration page has been updated and will show all the compasses it’s loaded drivers for. It also allows you prioritize them. See if your external compass pops up. What GPS module are you using?
After you’ve done that, perform a motor compass calibration, and then do an in-flight compass calibration. That will make sure your compass is as good as it can be.

Next I’d set up the dynamic notch (and static notch if necessary). Follow this guide and use this thread if you have questions or need help.

Regarding the vibes, make sure nothing is touching your flight controller. You can also put a small weight on top of it to add mass, which might help. It could also just shift the harmonic, so not a guaranteed fix. Of course if there’s any way to stiffen up your frame do that first. They are pretty high and could be a source of your problems. The best flying rigs I’ve tuned have low vibe numbers, less than 6 on average in a hover.

1 Like

Thanks for your reply.

I have been following that guide and had set all the correct parameters for my quad. I tested stabalize and alt hold mode as it mentions and both were successful (as seen in the video) with no visible oscillations.

I am using a (most likely cloned) Ublox M8N. I made a post in the past about it but with no success. The seller had a look for me and concluded the issue was to do with the firmware (see image 1 and 2).

I updated Mission Planner to the beta version and uploaded 4.0.4dev firmware to the Pixhawk. I had no luck calibrating the compass unfortunately.

dev_compass

As you can see, only the internal compass is calibrating. Although it has recognised the compass in HW ID. This is the same as before.

Have not heard of the notch before, will have a look through it! I’ve had this quad flying in the past with a different Pixhawk / GPS but the same frame / motors / ESCs, so I never suspected there would be an issue with vibrations.

My plan was to send this compass module back and purchase a different one in the hopes that Mission Planner can calibrate it.

Getting an external compass that works is ideal. My favorite compass/GPS module is the mRo Location One.

One last ditch attempt would be disabling all the compass drivers except the external one and see if that’ll get it to calibrate.

Wow thats expensive! Given how much trouble I’ve had with Pixhawks frying and other electronic components breaking in a variety of ways (granted most were my own fault!) I would rather not make such an investment until I have learnt a bit more about this hobby!

I understand that cheap Chinese fakes are never going to be as reliable or perform as well as the real thing, but for a student trying to enter the hobby on a budget I’d like to be a bit more confident that I won’t destroy a new expensive piece of hardware first!

Unfortunately I have had no luck with the compass so I will have to send it back and see if another one is compatable with the latest Arducopter firmware.