Problem with Pixhawk in Loiter, Auto and RTL Modes

Hi Guys,

Recently made a post over at DIY drones but have not had any replies as yet.

I’m flying a Skywalker X8 using the pixhawk autopilot and running mission planner. Apart from the obvious problems such as hand launching, one thing that seems to not work correctly is the loiter, guided, and auto modes. Ill explain the three instances.

On multiple occasions now, when I enable loiter on the RC, the aircraft will hold altitude and airspeed perfectly, but it will tend to drift away in loiter mode. It will look like it’s starting to loiter, and then basically reverse it’s direction halfway through it’s initial turn. It holds it’s altitude and airspeed very well, but won’t hold a ground track.

Here’s what it looks like on the mission planner - The whole blue ground track the aircraft was in loiter mode. Initially we thought it could have been a bad compass calibration, so that was redone, but it still did this after the compass cal. Basically this is what it does anytime loiter is activated, will snake around and drift off. Is there a parameter somewhere that I am missing?

This is loiter activated a few times - not just one loiter. As you can see it never seems to be a circle around a waypoint. … iter_2.png

Guided mode seems to do a similar thing - It will approach the waypoint, but never fly directly to it from it’s present location. It will snake around for quite a while until it gets near it, and then sometimes turn away from it again (without actually flying over the top of it)

I’ve only activated auto mode once for a small waypoint mission. In auto mode on this flight - It looks like it is trying to approach a waypoint, then it seems to get inself into some kind of death spiral, where the bank angle kept getting tighter and tighter. Even though I had set 35 degree bank angle max in the parameters it got up to about 70 degrees. Does the bank angle limit apply for all of the autopilot modes or just the FBWA and B modes? … o_Mode.png

All other modes seem to fly reasonably well.

One thing I did was left pretty much all of the default PID’s when I flashed the pixhawk with the firmware. Being that the X8 is a flying wing would having a yaw PID and a rudder mix in there cause this problem?

Here’s a link to a couple of flights that we did with it on droneshare.

Would appreciate any help or advice, I’m fairly new to the pixhawk system so it’s very possible it’s a setup problem on my end.


Our loiters are almost perfect concentric circles so there’s clearly something wrong as you surmise.

The autopilot uses the GPS for nearly all of it’s location finding so if the compass is out all you’ll get is a bad compass health message. The problem may be that the aircraft may physically not be able to achieve the loiter, maybe increase your loiter radius to 100m? Also the X8 is a large lumbering plane, it can’t fly very tight missions. It could be flying too fast to achieve the navigation. Your droneshare logs show speeds over 100kmh?
Make sure you have a HDOP of 2 or less and 10 sats at least before flying.
Make sure the plane flies perfectly in FBW-A. It should roll level quickly and without overshoot from a bank when you release the sticks. Do an Autotune at level 6, that will fix a lot of problems.
Set NAVL1_PERIOD to 19.
Set arming check to 1 so that everything is checked before allowing arming. Yours is set to 0.
Plot ROLL (achieved) and NAV_ROLL (requested)
Set your failsafes up as soon as you get a reliable loiter, everything is 0 at the moment.

Thanks Graham, I’ll make those changes and some more testing and report back. Appreciate the response. Your loiter looks perfect.

I can also post dataflash logs if that would help determine anything? Or are the droneshare logs the same as the dataflash logs.

You’ve raised another question I have regarding navigation. Once we have it all tuned and setup correctly, if I set up a survey grid pattern and the flight lines are quite close together (as an example with 60% overlap mission planner says the spacing is about 25 meters), once the plane finishes a run will it turn away from the next run to give itself space to meet the next waypoint? Or will it go to it’s maximum bank angle as set in the parameters and try to get to the next waypoint but fly through it if necessary and re-line up on the run?

Thanks again.

As an aside to this, I’ve just plotted the Dataflash log when the plane was in FBWA.

I’ve plotted Roll, NavRoll, and NavPitch.

First time I’ve done this, but looking at your message it seems that roll is the actual roll of the aircraft, NavRoll is the amount of bank that it should be commanding based on the stick deflection, and same for NavPitch?

If I’m reading it correctly it looks like there is quite a bit of NavRoll demanded, but it has barely responded with any roll? This is how I remember it flying. It was extremely stable in FBWA and it was very hard to get it to bank or pitch. Not knowing any better I thought this was normal and it was supposed to be super stable.

See attached image.

Close grid lines are a little difficult for the plane to follow, so you could do odd and even legs ie fly wpts 1-2 then 5-6 then 3-4. The plane won’t realign itself for the next leg, it will make a bulb-like turn to try get back on track, purely machine-like within it’s capabilities, another solution is to overshoot your target by 100-200m to allow the plane to get back on track before it overflies the target again.

This, (not mine) shows a typical flight path although the planes tend to follow the actual track much better than in this example: … flight.png

The droneshare logs are the same, one can get the parameters and original log from there.

Here’s another grid: … t-path.jpg