I had a pretty exciting flight on the weekend. My plane with APM2.5 flew most of a circuit in Auto mode correctly, but towards the end it just flew off to sea!

I wanted to monitor the strength of the telemetry link by flying ever increasing loops. Each loop took me 300, 400, 500 and 600m away respectively. It flew the first loops fine but as it started the 600m loop it just wasn't quite on target. The GCS announced that it passed through two points on that loop, even though it passed 100m or more to the left of those points.

As it passed by the furthermost point it turned slightly to the right, and headed out to sea. Gasp. 

I had a strong telemetry link (RFD900) and the GCS map seemed reliable. The plane icon and yellow line both pointed to the next WP, but the other heading lines pointed out to sea. When I realized it wasn't coming back I used the RC radio to switch mode to RTL. The GCS text-to-speech announced the mode change, but it didn't change course. I thought all was lost as it was over the sea about 1.5km away.

In the GCS I tried the right click > Fly To Here command (I think it’s called Guided mode) but no change. My RC radio link started failing and I heard the GCS announcing the throttle failsafe modes (short = circle, long = RTL) as it drifted in and out of RC range. That didn’t help and it kept heading out to sea.

Finally it occurred to me to try flying back in Stabilize mode. I’d just do a right turn and watch the GCS map to see when it was tracking in the right direction. I held the RC radio up above my head, switched to Stabilize and put in a right turn for 5 sec or so and watched the GCS map. The RC radio was still drifting in and out of range but after a few attempts it started heading in the right direction.

After several minutes I could hear the plane, and soon after I could see it. The day was saved.

 

Now I want to know what went wrong. Can anyone help me? I’ve got complete logs but don’t know what to look for.

When I play back the log in Mission Planner, during the fly away the plane icon (and the heading in the HUD) is correctly pointing to the WP/home (a heading of 90 degrees to start with) but the plane is moving due North.

The Mag Declination reading shows .38 for the whole log replay. Xtrack error is mostly +/-15 as the plane flies correctly around the circuit, but it gets to around 200 during the fly away. There was almost no wind at all (at ground level).

I’ve attached the log file, the param files and a youtube link to a screen capture of the log playback. The APM2.5 uses firmware 2.66.

http://www.youtube.com/watch?v=_wGe8orUAkk&feature=youtu.be

From about WP12 it’s getting more and more off track, after WP15 it just heads out to sea.

Any help appreciated.

Tags: flyaway

Views: 896

Attachments:

Reply to This

Replies to This Discussion

I'll ask the dev team to take a look at those logs. Good thinking under pressure!

Hi Moglos,

Well saved! I'm glad the flight ended well, even if it was more exciting than you would have liked :-)

Michael and I had a look at your log, and we think we know why it went off course. The log shows that your plane was setup with AHRS_YAW_P set to zero. That means you were doing no yaw drift correction at all - ie. neither your compass nor your GPS was being used for heading, you were only using the gyroscope, plus a very small component from the accelerometers when at larger bank angles.

So what happened was your z-gyro slowly drifted out of alignment with reality, eventually getting to the point that it was completely off. At that point the APM had no idea what its heading was (or more accurately, its idea of the heading was completely different from the true heading). Do you know why your AHRS_YAW_P was set to zero? Is that something you changed yourself? The correct AHRS_YAW_P setting should be around 0.4, although values down to 0.1 will work.

I also notice that your compass offsets are very poor, and you have COMPASS_LEARN disabled. That didn't affect this flight, as you essentially had disabled the compass via the AHRS_YAW_P setting of zero, but when you fix that you should also enable COMPASS_LEARN so it fixes the offsets in flight. Running a fit of your mag values against your GPS heading shows that your compass offsets should really be around (-10,-35,99).

Cheers, Tridge

I've also updated the docs to try to make it clearer that AHRS_YAW_P shouldn't be set below 0.1, and MichaelO is going to change the planner to display a warning if you set a value outside the recommended range.

Cheers, Tridge

Hi Tridge and co, thanks for your help. I'm pleased I've been able to bumble into a situation that has advanced the knowledge of the community.

The APM parameters file I was using came from http://conservationdrones.org/hardware/Their drone 2.0 is the same airframe as me, the FPV Raptor. (They seem to be flying long missions without problem, but I'll let them know about my experience/this post.)

I changed a number of settings going through the setup process outlined in the manual, but I've got no idea what the vast majority of the parameters are for. I've just found the Parameters and their meaning appendix (after a quick read I've still got very little idea of what they all do, not enough of an idea to recognize if something needs fixing). I should probably compare my parameters to a parameter file for a similar airframe in the diydrones download section (the Bixler probably). 

The Bixler file has AHRS_YAW_P,0.2. Do you think that's a good setting for me?

Should I set the offsets to -10,-35,99 AND enable COMPASS_LEARN (or is just doing the offsets enough)?

In your message below (with the graph) you wrote " the correction from the compass and GPS was disabled". Is there another setting I should change to turn on correction from the GPS too? Or will AHRS_YAW_P take care of tha?

If you can help me with these settings questions I'll go and fly the same course again and report back.

Thanks again.

The APM parameters file I was using came from http://conservationdrones.org/hardware/Their drone 2.0 is the same airframe as me, the FPV Raptor. (They seem to be flying long missions without problem, but I'll let them know about my experience/this post.)

ok, thanks for letting me know. I've emailed the site offering to help them with their parameters.
I doubt they have flown long missions successfully with the parameters they advertise for the raptor. The parameters they have for the other planes may be better.

I changed a number of settings going through the setup process outlined in the manual, but I've got no idea what the vast majority of the parameters are for.

The general rule is that if you don't know what a parameter does, then leave it at the default value!

The Bixler file has AHRS_YAW_P,0.2. Do you think that's a good setting for me?

Just use the default (which is 0.4). A value of 0.2 will also work though.

Should I set the offsets to -10,-35,99 AND enable COMPASS_LEARN (or is just doing the offsets enough)?

You should do both. The learning will cope with changes in your airframe as you move things around.

Alternatively, if you have reliable GPS signal, you could set COMPASS_USE to 0 and use the GPS for heading. When COMPASS_USE is zero it will automatically switch to using the GPS as long as the GPS has a good 3D fix.

If you can help me with these settings questions I'll go and fly the same course again and report back.

I'm sure it will work much better for you with AHRS_YAW_P set to the right value!

Cheers, Tridge

Hi again Moglos,

The more I look at this flight log, the more I like it! I'm glad you did this flight, as it is the first time we've had a real flight log with no yaw drift correction reference vector. It's fascinating.

As I'm sure you know, gyros tend to drift over time and need correcting. You normally correct the heading using the compass or GPS, and correct the roll and pitch using the accelerometers. In your flight, the correction from the compass and GPS was disabled, so it just did accelerometer based correction. The interesting thing is how well that worked.

The accelerometers can contribute nothing to the yaw correction when the plane is level, and the gravity vector is perpendicular to the yaw rotation plane. When the plane is rolled over the accelerometers can correct the yaw however, and that is what happened in your flight. In each turn, it took advantage of the acceleterometers to correct the yaw a bit, then as it straightened out it started drifting off course again. Your expanding diamond flight pattern shows this really well, as the straight parts got longer and longer.

The above graph shows the effect during the long auto part of your flight. The red line is the difference between your GPS heading and the DCM heading (the heading it was flying with). You can see it getting worse and worse, getting to 120 degrees of error. What is great is seeing how the error reduces when the plane turns (the green line is the roll), due to the impact of the accelerometers on the drift correction.

When you turned it to fly back home, that turning also caused it to roll enough to start correcting the yaw using the accelerometers, so it actually had a reasonable yaw value when you brought it home.

It is also fascinating to see the crosstrack correction working. As long as the yaw error wasn't too large, it still navigated OK due to the crosstrack correction. It was only once the yaw error got really large that crosstrack couldn't keep up, and it completely failed to navigate.

Great stuff!

Cheers, Tridge

This was a very worthwhile post. I asked a question wrt compass affect on navigation but it didn't get a response. My issue is that the "hold down" magnets on my EZ airframe really wreak havoc on the APM2 manetometer. So I asked what weight does the compass have in navigation. Part of the answer is above but assuming the GPS is not disabled and working correctly, is the compass critical?

BR,

Steven

Hi Steven,

I've seen your post now, and replied

Cheers, Tridge

I love these log sleuthing posts. Did not know the DCM did yaw correction from the accels. What a clever thing.

Hi,

Moglos just got in touch with me about this problem. We claim some of the credit for his exciting flight! 

He used an ancient param file for the bixler that we at conservationdrones.org tested on APM 1.0 in Feb 2012. 

At that time the “AHRS” series of parameters didn’t exist for the firmware (I don’t remember what version it was then). That param file was left unused until many firmware versions later now, when Moglos loaded it to the new firmware. My guess is that when the new firmware loaded the ancient param file something must have gotten lost in translationm including erroneously setting to zero both AHRS_YAW_P and AHRS_GPS_USE.

We have corrected our param files for all models now.

Good catch!

-LP

After making the recommended changes I did a test flight this morning on the same circuit (with one extra loop added) and it was rock solid.

Thanks for all your help.

That looks much better!

RSS

© 2014   Created by Chris Anderson.

Badges  |  Report an Issue  |  Terms of Service