Toilet Bowl effect in loiter even after calibration

Hello there,

I'm trying to get an octocopter I built to perform well enough on Loiter. Stabilize always works really well, but loiter sometimes works and sometimes doesn't.

It shows toilet bowl-like behaviour, where it spirals out of control. Horizontal speed keeps increasing until it touches ground or hits something.

I tried the following, to no avail:
- Calibrated compass using On-Board calibration. Offsets: (X:~16 Y:~49 Z:~35)
- Recalibrated acc and gyros
- Adjusted (without adjusting other params) (+50%) POS_XY_P
- Adjusted (without adjusting other params) (+100%) WPNAV_LOIT_MAXA
- Tried flying with auto declination enabled
- Tried with manual declination
- Double checked declination
- Compass-motor calibration done (~30% interference at home, tied down).
- Moved flight controller upwards, away from electronics

I use a PX4 (actually a Pixhack, which is almost identical but with better EMF shielding) with Arducopter 3.5.2.

Sometimes it works, then the next day it doesn't work at all.

Log file attached. Screenshot plotting PosX vs DPosX and VelX vs DVelX attached as well.

Feel free to blurt out whatever comes to mind. I am utterly desperate. There must be something I am completely missing!

Screen Shot 2017-11-10 at 7.09.19 PM.png

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –


  • Thanks for both of your insights.

    Based on the given suggestions, I made some changes and flew again in two areas. I tested Loiter and WPNav, with success. However I am not convinced the problem won't come back again, time will tell. 

    I made the following changes:

    - Enabled COMPASS_LEARN

    - Enabled AUTODEC 

    - COMPASS_USE is enabled

    - COMPASS_USE2 is disabled (means internal compass won't be used for heading estimate).

    - Connected I2C cable from my GPS, thus enabling the external compass again.

    - Calibrated in a park (away from interference from metallic objects), using Mission Planner's on-board calibration.

    - No motor calibration

    - Flight controller is mounted 10 cm from base of frame, like before.

    - Increased length of my GPS mast from ~5 cm to ~10 cm. (GPS mast base is attached to the flight controller)

    - The GPS module is therefore distanced in 20cm from the base of the frame, and 10cm from the flight controller.


    PS: MAG2 = Internal compass, MAG = External compass

    As you can see, the internal compass is a bit noisier, especially when Dist1 = 0 (not flying). When not flying, the internal compass seems to oscillate at ~8Hz, visible on both X and Y axles on the picture above.

    Flight log:

    Do the compass values in the log look healthy now?

    Dropbox - Error
    Dropbox is a free service that lets you bring your photos, docs, and videos anywhere and share them easily. Never email yourself a file again!
  • How close are your esc's to the pixhack or gps? Somethings that ussually helps is raising the gps on a mast, moving gps away from power wires and esc's, twisting the ground and power wires to reduce electromagnetic interference.

  • Moderator

    Yes, currents in the FC and close peripherals can cause magnetic interference, definitely. APM2.0 had problems as it only had compass onboard and many things were tried to get around this. The way I understand it is that you can disable the internal compass but not the external one for the best chance at success.

    5V power wires generally carry low currents so should be OK but magnetometers are very sensitive so best if you can avoid them. Avoid any battery supply wires and motor supply wires.

  • Thanks for your observations; it helps a lot.

    You're right, I am only using the internal compass. Quite dumb of me to completely forget about that. However, I disabled it on purpose, months ago. There is a part of the story I completely forgot to mention.

    Months ago, the only way I could get it to calibrate, and fly well in loiter, was by disabling the external compass. I tried for months to get it to work with both compasses or either exclusively the external one. I even made modifications to the compass driver in NuttX to make sure that data from the internal compass wasn't being fused with data from the external compass.

    Still, my flight controller is positioned 10cm above the center of mass. The wires powering the ESCs are below the center of mass. I thought that would be enough to deal with interference. Although the currents in the flight controller alone might be enough to cause the interference you are seeing. (I have peripherals like a Pixy, which uses quite bit of power).

    Unfortunately, I had very high offsets with the external compass and was unable to calibrate with it enabled back then.

    I will try flying with the external compass enabled again. A lot has changed since the last time I tried flying with it. There is now more distance between components, ArduCopter has been updated, and I am using another FC board.

    When you say "place it 10 above the nearest wires carrying any DC voltage", does this include 5V power wires? Or just the wires powering the motors?

  • Moderator

    Toilet bowling is usually caused by the compass heading being out of phase with the true heading of the MR. Calibration fixes this normally on the ground but in the air other things can come into effect, particularly magnetic fields generated by DC current through wires.

    It doesn't look like you're using a external compass? That's the first thing to rectify and place it at least 10cm above the nearest wires carrying any DC voltage. Usually this will fix the problem completely.

    Note: AutoDec should always be enabled. COMPASS_LEARN can also be left on.


    Graphing magX also shows some unwanted oscillation in the first part of the log. There's also major fluctuations in magX while flying which don't seem to correspond with the yaw angle, need an external compass here.

This reply was deleted.


Liam left a comment on Agricultural UAVs
I'm Liam from T-MOTOR. I would like to reach out to see if there is any possibility for us to work together.
We are a propulsion system manufacturer who offers motors, propellers and ESCs for all kinds of drone applications which vary from secur…"
Jun 30
Richard Cox left a comment on Australia
"Anyone in the DIYDRONES Australian subgroup based in Alice Springs, NT?
I am experimenting with Ardupilot (standard Arduplane), Pixhawk 4 FC in a 4-ch
RC "AXN Floater Jet" foamy plane..."
Jun 29
Omar Sykes left a comment on Australia
"Hi everyone, I am looking for someone who is good at drone building, repair and software in Adelaide. Please give me a call on 0477 319 219."
Jun 29