Loiter Issue - Unable to resolve

I have set my quad up and it flies great in stabilize mode and alt-hold works well.

However, I have been unable to maintain loiter in nil wind conditions.  Approx 1-2 seconds after selecting loiter (from approx 10m agl) the quad will begin to track anti-clockwise from its original position in an large arc approx 15m in diameter.  Speed increases and if I were to leave it in loiter it would fly into the ground at a shalllow angle after a few seconds.  I immediately thought toilet bowling!  BUT:

I have an Adafruit HMC5883L compass module specified to run on 3.3v or 5v power/logic - perfect for APM.  3DR 2.6 board with Arducopter 3.15 quad firmware, sonar and 433mhz Mavlink groundlink.

My 2 compassmot results were 3% and 2% respectively.  The compass is mounted on a post and the mount is braced, solid and cannot move.

Hdop figures are good.  

I have tried disabling COMPASS_AUTODEC and inputing the figure manually.

My live calibration technique is as per Chris Anderson's demo video and I generally get over 800 samples before completion.

Vibration levels in the log file data are within recommended specs.

My frame is an S500 - very solid with minimal flex and  balanced with underslung battery.

Note:  I have also noticed that the quad occasionally looses orientation in stabilize mode i.e. pitch forward may result in roll left etc etc.   Sometimes this will self fix and othertimes I must land and then take off again.  I originally thought that this maybe something to do with Simple/Super Simple modes triggering - but they are all disabled in the parameters.  I have not determined the cause but suspect it occurs after yawing maneuvers. 

If I were to guess I would suggest a compass error but surely this would manifest at all times and in stabilize mode?  I'm stuck!  Any advice appreciated as always.  


2014-08-05 18-28-13.log

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

Join diydrones

Email me when people reply –


  • If it helps anyone I solved the orientation issue in stabilize mode today:

    I had CH7 set to engage SSimple Mode.  Turns out CH7 settings on my Taranis meant that although the CH7 switch was 'OFF' the PWM output didn't drop below 1550 meaning that Super Simple mode must have been engaging as if the switch was 'ON'.

    I changed the settings so that 'Off' meant PWM of 970 and 'ON' meant 2000 and this issue has dissapeared.  

    I'm able to fly stabilize mode without issue now and promptly started pushing the limits in my garden until I knicked the willow tree and crashed!

    Happy though:)

  • 100KM

    Agreed with other Ben here. I have seen the exact behavior on a well calibrated quad when my compass orientation was set wrong by accident. Does the red line for current heading on mission planner move and orient correctly as you rotate the quad?

    • I've been troubleshooting my drone shooting off when in loiter for days now. Once I read your comment Ben I checked my compass was oriented correctly and lo and behold it was 180 degrees out. Now it is fixed.

      It's hard to see in any of my logs the actual problem but I would have thought that an error should be detected between the GPS and compass that the headings were wrong.

  • I had this problem back in my early setup days. I found that even though the printed arrows on my external compass seemed to be correct, and calibration seemed to go ok, I still was getting the 'arc into another direction' reaction.

    What helped me was to look at the flight screen in Mission Planner and see how the quadcopter icon was aligned and pointing, and sure enough, it was pointing 90 degrees off for me.

    I then changed the compass setup so that '180 rotation' was now '90 degrees rotation' and this worked for me.

    I also found that I was having trouble setting compass declination, but figured it out by clearing the eeprom in terminal, and then installing an earlier version of mission planner and using it to set. My issue was described here: http://diydrones.com/forum/topics/declination-in-another-dimension?...

    Anyway, setting the compass direction and setting declination helped me to achieve steady loiter. Also, putting my compass & gps on a mast improved results too.

    • Thanks Ben,

      I would say you're on the money with your assesment.  I checked in Mission Planner and the compass readings were very close to 90 degrees off what my smartphone was telling me so it would appear that the printed markings on the breakout board are wrong..  I have changed the mounting parameters in Mission Planner and it is now orientated correctly.

      I have yet to test fly but would be surprised if this doesn't offer my solution.

      Thanks for your help.

      Simon Chandler,

      Worcester, UK.

      • awesome! I helped someone! :D :D :D

        • Yes you did  :).

          I flight tested yesterday and loiter was rock solid in nil wind - works very well with the sonar at low alt.  RTL is perfect as well.   I was really loosing confidence in APM after fly offs and a couple of failsafe crashes.   I even ordered a Naza M v2 kit with telemetry link which I think may be on Ebay soon.   It's nice but the capabilities are really limited in comparison with APM.  Their PC groundstation software is a nightmare as well.

          But... once this compass issue was identified all of my other work and research was vindicated.  Steep learning curve but I feel satisfied I can work with APM now.

          You live and learn ;).

          Thanks again everyone who commented.

          Simon Chandler.

          Worcester, UK.

  • Tune your declination with channel 6 (set it up in extended tuning section), set it change between -3 and 3 (-30 degrees and 30 degrees) then tune it until you get rid of the toilet bowl. Also do multiple compass calibrations away from computers and metal and compare the values.

    (that should fix the loiter issue)

    Your compassmot and vibes are good so i am not sure what could be causing the issues in stab


  • Try unplugging and disabling the sonar.

    • Sonar disconnect did not fix the loiter issue.  Turns out my compass orientation was out by 90 degrees because the breakout board orientation markings have been printed wrong.  Thanks for your suggestion.

This reply was deleted.


DIY Robocars via Twitter
RT @masato_ka: 距離センサを3つとESP32を付けたラジコンカーをDonkeyCarライクにNNで自動走行。3層FC極小モデルをTensorFlow Lite for microcontrollerで動かしてる。機体は借り物でRumiCarって言います。Tenso…
7 hours ago
DIY Robocars via Twitter
RT @SmallpixelCar: My car was able to go all the way autonomously until the crosswalk. It was only 100 yards from the target. What should b…
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…"
DIY Robocars via Twitter
RT @SmallpixelCar: Smart move. The car used the shadow to guide it through the bridge. This was never in the training samples. But it learn…
DIY Robocars via Twitter
RT @SmallpixelCar: Getting closer to the target. Single camera. Untrained road. https://t.co/Wsr7RwDamj
Jun 29
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
DIY Robocars via Twitter
RT @RoboticMasters: #donkeycar https://t.co/czuLoVRcA4
Jun 29
DIY Robocars via Twitter
Jun 29
DIY Robocars via Twitter
RT @RoboticMasters: Donkey car, car car car car car car; Donkey car, car car car car car car; Donkey Car. Anyone like our tiny tiny donkey…
Jun 29
DIY Robocars via Twitter
RT @SmallpixelCar: After improving DBSCAN speed, I can get 11 frame per second on @NVIDIAEmbedded Jerson Xavier MAXN mode and the autonomou…
Jun 26
DIY Robocars via Twitter
RT @Heavy02011: Join us at next Virtual Race League: ⁦@diyrobocars⁩ Race #4 - Parking Lot Nerds, August 1st https://t.co/5KUpu7VGaH
Jun 25
DIY Robocars via Twitter
RT @SmallpixelCar: #CUDA implementation should be easy, because most of the time is on distance calculations berween two points and if the…
Jun 25
DIY Robocars via Twitter
RT @SmallpixelCar: This is the view from the car. Even my lanenet inference is fast on @NVIDIAEmbedded Jerson Xavier, DBSCAN clustering tak…
Jun 25
DIY Robocars via Twitter
RT @SmallpixelCar: Ran my car in the park, with single camera and @sparkfun IMU. #TensorRT on @NVIDIAEmbedded Jetson Xavier. Lanenet one fr…
Jun 24
DIY Robocars via Twitter
RT @SmallpixelCar: Making progress on drive the car autonomously in my neighborhood. This run used single camera only. No other sensors. ht…
Jun 24