Loiter Mode is not working while everything else works great

Can someone help me, this is my first build with a APM however I am not new to Copters and Helis and their electronics.

Although there are a lot of info and problem solving posts on the Loiter mode (and the main arducopter instructions), I needed to open this thread because I did my homework and calibrated/verified everything needed for a healthy Loiter performance and it still does not work…EVERYTHING ELSE works excellent…I am out of options.

I have the latest version loaded on the APM 2.6 and latest MP installed. (Tried to reinstall a few times, but makes no difference)

Loiter does not hold position but fly’s away when engaged.

  • Stabilize Mode is perfect, with no wind you can almost think its in loiter mode
  • Alt Hold is very accurate and rock solid.
  • GPS is locking10 Sat and tried Loiter when it was under 2 HDOP (Actually is was pretty good holding 1.4 HDOP) (GPS is the Ublox LEA-6H)
  • GPS Orientation is set correctly showing North on mission planner when aircraft is facing North.

All calibration has been done successfully and fall between the nominal/acceptable ranges, radio, compass, gyros, etc.


I was getting some glitches in the GPS but I believe them to be minor and overall it stays under 2 HDOP

Vibration log - Got it better than I expected, graph shows vibrations between +1 and -1 on AccX and AccY and between -9 and -11 on AccZ.

Ran compassmot test on CLI and I have a low motor to compass interference of 14% (Under 30% is good)

Declination is right on for my magnetic field in Boynton Beach. I tried both auto and manual to eliminate all doubt. Also flew one time with “tuning declination from ch6” adjusting while flying with no change to a healthy Loiter hold.

My compass offsets are pretty good at:
Compass_OFS_X 16
Compass_OFS_Y 15
Compass_OFS_Z 5

Ran “motorsync” in the CLI, all good there…my motors are in sync.

Ran the data flash log to see how loiter is performing and as expected, it is not working…
the graph is all over the place.
VelX (actual velocities) is not tracking DVelX (desired velocities)…same thing for Y

(I wish I had the problem some are having with the toilet-ball effect in loiter because that means I am in the zone and loiter is working but I have not had the pleasure yet to hold my aircraft in an auto position)

What else I am missing? I believe I ran all the tests and calibrations…but I must be missing something!!!

I am out of options, can someone help me? I sincerely appreciate your time.

Below is the “Loiter Performance” graph looking pretty bad, 2 pairs of lines should be practically on top of each other (parallel)


Was this ever solved? I’m having the same issues and have been through the same analysis. I have a nervous copter in loiter mode and it makes me nervous :slight_smile:

No, not resolved yet…hoping someone well versed with the APM 2+ will step in.

When solved or “attempt to solve” in the meanwhile, all info will be posted here.

I left mine hovering in Loiter mode yesterday until it’s Loiter Performance deteriorated to the point it took a dive to the earth. You can see the big spike in DVelX (sent by loiter mode?) as well as the moment I switched to Stabilize and recovered. Still looking through the the attached full log for an indication of what caused it.

Try doing this.
rcgroups.com/forums/showpost … count=7878

More info.

The stock scrips do not work well, hope this helps.

I already tried that.

Tried 2 different GPS + Compass units, both very healthy.

Tried both with and without the custom GPS configuration from 3DR…no difference.

Please post a log?

Confirm that your compass is oriented correctly. You said north is north. Is east east?

Thanks for stepping in to help, I really appreciate it…been trying everything under the sun for about a week now.
I been studying and learning how to interpret the log files but there are so many and I am trying to find the ones relative to my problem.

Yes, North is North and East is East confirmed on the MP…very accurate too.

I calibrated the compass in open field and all orientations (axis) as per instructions.
Also, I made sure I did not have my cell phone anything metallic on me, and a good distance from the laptop.

What logs would you like me to attach?

Should I attach a log recorded with the “Log Bitmask” set to “Nearly All”?

I had a perfectly working copter where GPS loiter went crazy, but the explanation was embarrassingly simple.

On the compass setup screen in MP, you see some pictures. The first picture is a Pixhawk and the last picture is of the 3DR GPS/Magnetometer module that ships with every Pixhawk.

So which compass module do you choose? Don’t choose the 3DR GPS module – choose the Pixhawk. Every Pixhawk relies on that compass so while it might make sense to choose the GPS module that looks exactly what you have in your hand, pick the stand-alone Pixhawk.

If you don’t, here’s what happens:

  1. The compass calibration will work just fine.

  2. When you measure your calibration versus a second source (I used a compass on my Android phone), they’ll line-up just fine.

  3. The moment you go from Stabilize or Alt-Hold to GPS loiter, your craft will bank hard and just take off. Don’t wait it out – it will just keep going.

That’s probably not what’s happening to you, but I figure every little bit helps.

Update: Solved my Loiter Issue! Got the auto trim for both the Stabilize & Rate / Roll & Pitch done per this video I’ve watched before but never implemented it until a friend on Facebook suggested it: https://www.youtube.com/watch?v=YWi3WjGg5lQ . Before I did that, Miko (the Facebook friend) commented about the location of the receiver perhaps being too close to the compass.

He got me thinking about the location of all the components. I though the battery being off center just might be a contributing factor so I moved it to the center for now. When the gimbal comes in I’ll move it back for balance.

One other thing I did was to wait until the HDop dropped below 2 and Satellite count was up around 9 or 10 before starting the trim. I think when HDop goes up, all bets are off for any GPS dependent mode.

Just moving battery to center (balancing the aircraft) solved a large portion of the jitters. Then I fine tuned Stabilize & Rate / Roll & Pitch with channel 6 on the transmitter per the above video. Here is mine now: http://youtu.be/N0RHZMu8QM4. This is a heavy lift coptor so it has tons of reserve power to have to deal with.

Here are my new PID settings.

jschall - Here are 2 the logs files. I tried to hold it in loiter mode for as long as I could…but after 2 secs it flys away.

W4DJW - Thanks for your input and I am glad you Loiter is working again, I can’t wait to enjoy the full potential of the Arducopter 2 myself. I did autotune on mine and I got stabilize mode to respond very nicely…actual it was pretty good before I did an autotune.

bcdebusk - Thanks for your input as well, yes “every little bit helps” My compass orientation is set correctly and so are my 3 offsets.
By the way, the 4 different options of picking your compass type, as you mentioned, has only to do with one thing…setting the correct orientation for the compass. The different options of picking the 3DR, pixhauk, manual etc is just to facilitate getting your orientation right.
With the incorrect compass orientation setup, yes, it will fly rapidly away when in Loiter…the onboard computer is doing what is is programmed to do, but just in the wrong direction. (Is it trying to correct to get the position hold by make a correction in the wrong direction.)

Belteshazzar, graphing your logs I see errors I never had. Have you checked these out yet? I’m on the hunt for where the error codes are listed. Looks like you’re getting GPS-0 and GPS-2. Now we have to find out what that means…

Found this:

7: GPS failsafe
ECode 1: GPS lock lost for at least 5 seconds
[color=#FF0000]ECode 0: GPS lock restored[/color]

11: GPS
[color=#FF0000]ECode 2: GPS Glitch[/color]

Here: http://copter.ardupilot.com/wiki/common-diagnosing-problems-using-logs/#Diagnosing_Problems_using_Logs

Looks like you are loosing the GPS. Which is explained here: http://copter.ardupilot.com/wiki/gps-failsafe/

Dave (W4DJW)

Yeah, I saw those and I don’t understand. HDOP shows under 2 at all times in MP live. I don’t see a lost signal when I am enter Loiter. I am watching the GPS live or have someone watch it while I enter Loiter.

I tried 2 different GPS modules…one LEA and one NEO.

Actually today when I flew the 2 times to get the logs to attach, it was a clear day and I was at hdop 1.4 with 10 Satellites locked at all times. At least that’s what I thought. (that’s it showed live)

I read the code…5 sec is very bad. If this is accurate, there is no way Loiter will work loosing 5 secs GPS signal at a time.

Yours does not show this GPS error on your log graphs at all? Anyone else?

Maybe looking at the MP’s live flight data and staring at the hdop and # of satellites is not the way to observe a gps glitch. (Although it makes sense to me that a 5 second loss of signal would show in the hdop and # of Sat)

Is there a dedicated graph in flight data live to see a GPS glitch? (clicking “tuning” box to pull up the live graph)
If not, is there a graph to display from the data flash logs showing GPS glitches?
I would like to verify the duration and where in the flight it happened…and how often this glitch repeated in the same flight.

Actually from my graph logs that you posted above it shows hdop at around 1.5 and a good # of satellites at the moment I was in loiter mode.

The blue line is straight…no drop in any way. Why does it report the the 5 sec E-Code2 error?

correction for my previous post… “9 satellites locked at all times”

HDop is the dilution of precision due to your satellites not being spread out enough. You could have great satellite separation thus HDop below 2 and not be able to get than information to the process that needs it. So it could be an internal communication error between threads. I haven’t looked at the code to see how objects communicate between themselves but it could be a bug.

[ul]Are you running the latest stable code.
Could it be a hardware error on the board?
Was that Pixhawk ever in a crash?
Just brainstorming to try to figure it out.
Are the wires running past a high current flow that could induce a signal in the lines?
Could one wire from the GPS puck be almost broke?
Is the plug secure in the socket…

On the GPS Failsafe Wiki it says:

[ul]During a glitch, “[color=#BF0000]Bad Position[/color]” will be written on the ground station’s HUD[/ul]

Did you see that on your HUD?

Dave (W4DJW)

Interesting, what hdop really means. This changes all my perspective and problem solving angle regarding the GPS.

So, basically you are saying I can be staring live at a dhop value of 1.4 locked in to 10 satellites while the GPS is actually glitching? Even up to a 5 sec signal loss?

Yes, I though about and checked everything on the list you mentioned…even hardware malfunction which I tried to trouble shoot by substitution.

I have APM 2.6 not Pixhauk.

I have 3 of them and tried 2 different ones to hope to find the problem by process of substitution.
I am about to try my 3rd and last apm 2.6 board.
What probability of 3 boards being bad?

  • Running last stable code. (also tried others just for the hack of it, no difference)
  • Never been in a crash…none of the 3 boards.
  • Definitely running sensitive signal wires away from high power lines.
  • Tried different wires from/to GPS/APM
  • Plug is secure in socket
  • Not showing “Bad Position” in HUD (although I seen it before when I am playing around with the setup indoors which is normal since I have an aluminum ceiling)

There is also something else I found. Could you or anyone who wants to jump in to help, check on something for me when you get a chance?

On your next flight, assuming you have an uplink (3DR radio), can you check the box “tuning” on the live flight data screen to bring up the graph, double click on it and check only "txerros"
How many txerrors are you getting on a basic 5 minute flight?

I’m not seeing that metric (txerros) in my list. Can you point it out?

Yes, you got it…you have it checked… rxerrors.

My bad, a txerrors matrix does not exist in MP

Anyway, I am getting 50 to 120 rxerros total for a few minutes of flight.

What are you getting?

I’m getting zero RX errors. Here is the graph of about an hours worth of flying. I added RSSI and the Noise Floor so you can see there is a very low noise floor in my area.