APM applied full pitch back and full throttle after engaging loiter

Hi all,

This is my first post here, I've only been using APM for a few weeks on a DJI F450 Quad and so far it has been going well, until today.  I'm using an rctimer APM 2.5.2 board with the latest firmware v3.0.1

I'd been out flying earlier in the day and was getting some "toilet bowling" when using loiter, when previously my copter had been nice and steady in loiter.  After reading around a bit I decided to recalibrate the compass.  So I went through the live calibration and compassmot - which came out about 58% I think - not great, but not bad, and no worse than the last time I did it.

Went out to test fly in the garden.  Started off in stabilize, all ok, switched to Alt hold, still good, holding altitude well, all behaving very nicely.  I then switched to Loiter and whoosh, the APM applied full throttle and (what I assume was) full pitch back shot over my shoulder and smacked into the back of the house :-(  By some miracle, the copter seems to be ok (and still flies in stabilize), though it did put two nice scratches in the glass in my back door :-O

So, I need a little help triyng to work out what went wrong?  I've attached the logs (my switch to loiter is at line 2246) and a couple of plots I've done.  You can see where it goes totally bonkers immediately after I switch into loiter.  I initially thought that the "problem" was that WPDst=2.5, but after a bit more reading, I see that means that it thought it was 2.5cm from where it should be (have I got that right?).  So that shouldn't have caused any major movements right?

GPS hdop and nsats both look good, so I don't think it was a GPS issue.

The numbers that look odd to me from NTUN rows are PErX and PErY - distance to intermediate target(what do these mean, what are they exaclty?) - and VelX and VelY - velocity estimates, which are huge, and DPit = 45 - is that 45degree pitch back?  Which is what it appeared to do.

Any more ideas why did it did what it did?  

How can I gain some confidence that it's not going to do this again next time I switch to loiter?  

Should I recalibrate everything? gyros, compass, etc.  (I don't see how any of this could be that out given it was flying well in stabilize and alt hold)

Any ideas welcome.



PS: hope I've picked a sensible category.

Views: 3644


Reply to This

Replies to This Discussion

I have also just found the Mission Planner telemetry log, though I can't glean any more information from it.  Here it is in case it helps anyone else.  You can see where I switched to stabilize just after 17:50 by plotting throttle against chan3_raw.  The APM stuck the throttle up to 100% and I slammed my rc throttle stick to zero in a mad panic.


Anyone any ideas?


Amazing...I was about to post a couple issues I am having, read your post, and thought, wow, that is EXACTLY what has been going on with me.

I have a DJI550 clone/frame, APM 2.5,, firmware v3.0.1.  I found TWO flight modes that gave me the same behavior as you...RTL and LOITER...both modes that need the GPS (don't know if that has anything to do with it)...but like you, GPS seemed fine...9 satellites locked, etc.

For me, switching from stabilize or ALT HOLD, which both worked fine. to either of LOITER or RTL, made my hex pitch, well, 45 degrees (or so) "right" (like it was trying to make a big circle around me to the right), while at the same time losing altitude very fast...diving at maybe a 30-degree angle into the ground.  

I survived two crashes (from about 25 feet up), but the 3rd was from a much higher altitude (100 feet?) and I broke 3 arms.

In each case I switched back to STABILIZE, but too late to do anything other than maybe soften the crash a bit.

This also happened to me a couple days ago...I was trying to fly an AUTO flight plan, with RTL being the last command...same thing happened...after hitting the first waypoint (more evidence GPS is working fine), the flight plan called for RTL, and the hex made a big 1/2 circle (100 foot diameter?) around to the right, while at the same time going into a 30 to 45-degree dive into the ground.

So...yeah...I would be very interested to hear what folks have to say about this.


Does it always do this when you swtich into one of these modes or is it only sometimes?

Have you looked at the logs from these flights to see if you can work out what is going on?  I'll have a look if you want to post them, but I don't really know what I'm looking for, just hoping to find something that will help work out what went wrong.



This is quite interesting. You have probably already seen my thread describing a disastrous crash in RTL where the controller asked for (and got) full pitch and throttle despite there being no reason for it to do so.

From your description your crash sounds similar. However I'm not quite sure - it's a shame there isn't a bit more of the "bad" section of the flight (seeing as your house got in the way!) to be certain. The odd thing with your log is that the PitchIn and RollIn don't seem to follow the DRol and DPit and actual Roll and Pitch. The way i understand it (I may be wrong) is that in a navigation mode on a correctly setup quad with hands off the RC sticks, the DPit, PitchIn, and Pitch values should all track each other. That's what happened in my crash and in other successful flights. So I don't really know why they are different here.

Nonetheless there have really been quite a few issues now with people having loiter or RTL mode result in a high speed, straight line flyaway. None of them have been answered satisfactorily by anyone, so far as I can see. These threads are just being ignored. 

If you get any replies at all to this I am sure they will tell you that compassmot of 58% is too high and you should buy an external compass and everybody will live happily ever after. It probably is too high, but I am simply not convinced that is the reason for these problems. Bad compass issues result in toilet-bowling spiral patterns. GPS glitches can result in the kind of thing you got, and that issue is being worked on. But there have been other crashes, mine included, which weren't a GPS issue either as the copter was flying AWAY from where the GPS was telling it it needed to be.


One other thought: did  you have a camera or anything else onboard that could possibly generate interference?

No camera equipment onboard, so I shouldn't get interference from that.  Maybe from a few peoples WIFI, but I would hope not.

And yes, I've just been reading all the other "fly-away" type crash posts and I did see yours.  I think mine is probably similar to these as well except like you say, my house got in the way and "saved" me from loosing the heli completely.

I'll look into an external compass maybe, but I don't see how / why a dodgy compass reading should cause such a violent fly away.  I'd expect that to impact more gradually on yaw.  And I have had loiter working really well in the past with a similar compassmot figure.

It seems to me more like a GPS glitch and it decided it needed to be elsewhere so headed off to try and get there.  Maybe the logging I've got just isn't granular enough to show it.  Hopefully the new code to deal with GPS glitches will solve problems like this.  Is there a page somewhere that gives us an idea of when the next arudcopter release might be and what it is expected to include?

Just looking at the pitch and roll log items you refer to, and it looks to me (correct me if I'm reading it wrong) like it's doing what it thinks it should (see attached graph).  There are only a few points in the log, but it appears that as soon as I switched to Loiter DPit (desired pitch) goes to 45 (orange line) and (pretty much) stays there, Pitch (purple line) climbs rapidly to match and stays there.

Roll in and Pitch in were both zero (no input from me) until I realise at point 7 and try to correct.

DRol and Roll are following each other, though it does appear to be heading over to the left (I assume negative is left) which would roughly reflect what it did as it went backwards over my left shoulder.

So the copter is doing what the autopilot is telling it to, which makes the question that needs to be answered - why does it think it should pitch back so aggressively.


I think that RollIn and and PitchIn reflect whatever input the rate controller part of the code is getting from anywhere: either from the loiter controller or from your RC sticks. So as you weren't moving the sticks, I'd have expected these to match the DRol and DPit values. I may be wrong in that interpretation, but it is certainly what I see in my logs.

Apart from that, though, I agree-  the DPit and Pitch values clearly tie together indicating that the copter is responding to the autopilot's demand, so we need to know why this large pitch demand is happening. You don't have enough time on the flyaway section to judge what speed it would have got to, but on mine and on Frank Rodger's thread the copter speed generated by this pitch was well in excess of the configured loiter and wp_nav speeds which indicates to me that it can't have been a GPS glitch - your crash might just have been that, but a 45 degree pitch seems excessive even so.

Ah, okay.  I can see where you are coming from with that.  When I read "RollIn: the pilot’s desired roll angle in centi-degrees" from the wiki page, I assumed that "pilot" meant me, the human in control, but it could also mean the autopilot :-)


     It looks like a problem with your GPS.  It only seems to be providing position updates once per second (it should be 5x per second) so that's not enough to keep the inertial navigation estimates from drifting off.  I guess it's not a 3dr GPS so maybe it's the wrong type or maybe it hasn't been loaded with the correct config (the APM actually tries to update the config at startup but perhaps the GPS isn't accepting that for some reason.

     You can see the issue by checking the "Time" column of the GPS messages.  In a good log each time will be increased by 200 from the previous (200ms = 0.2 seconds = 5hz) but this log has them increasing by 1000 with each message.

By the way 58% compass inteference is at the top end of the "grey zone" which is 30% ~ 60%.  below 30% is ideal.

Good work on looking into the logs yourself though by the way!  nice.

Reply to Discussion



Season Two of the Trust Time Trial (T3) Contest 
A list of all T3 contests is here. The current round, the Vertical Horizontal one, is here

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service