LibrePilot Forum

Users => Applications - Autonomous Flight => Topic started by: TheOtherCliff on December 07, 2015, 12:50:44 pm

Title: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on December 07, 2015, 12:50:44 pm
There was an issue back in OP days where there was an oscillation in GPS flight modes that increased/decreased depending on which direction the quad was facing in hover.  LP users have also found this issue.

Here is what we know about it.
- It happens in GPS flight modes when hovering.  Sticks in the center.
- It is often small enough that it may only be noticeable in FPV or onboard video.
- It is worse when pointing more toward south and better when pointing more north.
- It stops oscillating if you tell the quad to move, even slowly.
- There is an piece of firmware code that runs differently if below a hard coded minimum braking deceleration although I don't necessarily blame it.

Things we (users who have this issue) need to try to see if it affects the issue:
- Move your HomeLocation significantly north or south and see if it changes the issue (makes it worse or better).  Try maybe 1km, 10km, 100km, 1000km for starters.  Be aware that moving HomeLocation will make the GPS map location offset, usually toward the distant HomeLocation.  I have personally flown with 50km offset, but not more.  Be careful.  Very large offsets may cause movement north/south to climb/descend or cause other bad issues.  Make sure you have a non-GPS flight mode on your switch.
- (Carefully!) When hovering in PositionHold or VelocityRoam, can you feel it if you put your hand on it?  Does it go away if you hold the quad away from hover point, vertically or laterally, by hand, without moving the sticks?
- Waypoint flight mode with various speeds, including very slow.  Perhaps 10m/s, 1m/s, 0.1m/s, 0.01m/s.  Try to narrow down what speed the oscillation stops.
- Other users (e.g. me) can try to recreate this by moving the HomeLocation far away north or south.

I will try to keep this first post updated with the current facts about this issue.
Watch the "Last Edit:" time below to see if this post has been changed.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: lanzi on December 07, 2015, 07:29:06 pm
Hi TheOtherCliff.

Thanks for officially starting a thread on this issue. Hope we all can find a solution soon.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: Wagsy on December 08, 2015, 03:36:14 am
Will have a tinker with mine over next few days and see what it does.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: lanzi on December 08, 2015, 05:54:35 am
did some extensive testing today in a radius of 10 km.

1. when hovering in velocity / gps assist and pulling the VTOL by hand I can feel the oscillations. they increase when the VTOL gets pulled away.
2. when i yaw the hovering VTOL 180 I can feel that the oscillations decrease or increase depending on the compass direction.
3. Also noted that the oscillation still exist when given little stick input. only a more dramatic stick input fades makes the oscillations disappear.
4. here in Wellington the oscillations increase when the compass is heading SOUTH and decrease when heading North (the compass was calibrated heading North)
when i redo the compass with the compass heading south during calibration, the oscillations decrease when the VTOL is heading South and increase when heading North. 
5. Offsetting the home base 35 km (i did not dare more) did not have any positive or negative effect. things stayed the same.
6. flying close to water makes things worse
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on December 08, 2015, 08:23:10 pm
(That's the first time I have heard that oscillations remain at very slow speeds.)

The bit about it being worse close to water makes it sound even more like a magnetic inclination error which is my current best guess about the issue.  Magnetic inclination is the angle that a compass needle would change vertically if allowed to.  It is a large value.  In USA the needle would point north, but also point down about 60 degrees.  When you set HomeLocation, one of the important things it does is set the expected magnetic inclination.  It would also explain why most people don't have the issue; the formula estimate of magnetic inclination at their HomeLocation is more accurate.

At this point, I really expect that setting HomeLocation significantly far off north or south is a workaround to the issue, with the side effect that your GCS GPS map locations will be wrong by several hundred meters or more, so you won't be able to click up a waypoint flight using the GPS map.  I need to test this by setting my HomeLocation off by say 1000km and seeing if it starts happening to me.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: ArnhemAnt on December 08, 2015, 09:52:20 pm

This may be a real stupid question, but I figured it was still best to ask.

Could this issue be due to the differences between 'magnetic' north and 'true' north? These variances change depending where you are located in the world.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on December 08, 2015, 11:12:31 pm
I don't think so.  The only sensors that know absolute direction when motionless are the mag and accels, and neither of these know true north.  GPS is the only one that knows true north and you can be traveling true north, but facing east so it wouldn't be direction sensitive.

I think that the oscillation is happening because the angle between mag and accel isn't what it should be.  The typical response of the EKF to two sensors that disagree is oscillation.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: lanzi on December 08, 2015, 11:20:23 pm
My revo is rotated 90 degrees but the offset value has been applied. So the physical angle between revo and v9 is 90 degrees. Could that be an issue although the offset value has been set?
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: lanzi on December 09, 2015, 04:37:57 am
I have a video up showing how flying close to water worsens the problem and also shows that the oscillations also happen in VELOCITY ROAM when flying with stick input ( figure 8 for example). I know the clip is 6 minutes, but it shows quite well (audible and visible) how the intensity of the oscillation alter when the VTOL and with that the compass is changing the heading.

https://www.youtube.com/watch?v=XtIC1ZKX-bs
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: Brunosanta on December 09, 2015, 02:26:05 pm
Maybe this is a dumb guess, but have you tryied to use the mag of the GPS only for testing?
you can go into the config> mag settings > instead of the default "Both" set it to external to test.

hope this helps,
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on December 09, 2015, 04:59:03 pm
My revo is rotated 90 degrees but the offset value has been applied. So the physical angle between revo and v9 is 90 degrees. Could that be an issue although the offset value has been set?

You would have bad problems, unflyable in GPS modes, if your mag was rotated 90 degrees.  You DO need to configure in a rotation if your mag is rotated, but only if it is rotated from "normal level straight ahead hover" so zero is correct for your mag.

Be aware that you do need to have both mags configured and usable with rotations already configured when you calibrate mags, and that both get calibrated at the same time.

Are you configured to use both mags or one or the other?  The best advice would normally be to use just the aux mag.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: lanzi on December 09, 2015, 06:37:18 pm
I am only using the aux mag of the v9 and as the my GPS flight modes really do work apart from the oscillation I do not think the rotation of the revo is an issue. I believe there is a bug somewhere in the code. Would  you say so as well theothercliff? Especially I am not the only one with this issue. Wagsy has exactly the same issue and his videos show the same behaviour.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: gitit20 on December 10, 2015, 05:54:04 am
I just want to hit mine with a stick sometimes I seemed to be mostly ignored when it was reported I think because most did not have this problem. I am going to reinstall my revo and flash and start over from scratch and see what we get.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: lanzi on December 10, 2015, 06:22:31 am
is started from scratch numerous times. with the latest OP version and with the LP version on two different frames with two different revos and two different v9s.

by now i firmly believe it is a bug in the code that needs to be found and addressed.

TheOtherCliff also hinted a bug at some point. hopefully it can be addressed with the next version.

I am not a coder at all, so the only way i can help is by addressing the issue and show how it looks like.

cheers
lanzi

I just want to hit mine with a stick sometimes I seemed to be mostly ignored when it was reported I think because most did not have this problem. I am going to reinstall my revo and flash and start over from scratch and see what we get.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on December 10, 2015, 07:48:43 am
I certainly believe there is an issue.  I think the main problem is that there is no dev who can reproduce it.  :(

Is it true that tuning is not critical?  I think I recall someone trying stock PIDs and still having the problem.

What kind of PDB are you guys using?

How did you tune your PIDs?

What things about your copters do you think might be a little out of the ordinary?  Especially ones that you both have?

Did you twist all your power wires:
- battery to connector
- connector to PDB
- PDB to ESC
- ESC to motor

I can imagine it being caused by (no particular order):
- hidden copter build issue (mag field caused by increasing e.g. front motors makes it e.g. pitch back <or> mag field caused by increasing some motor(s) aligns with earth mag field when pointing this way (no oscillation) and perpendicular to earth field when pointing 180 degrees from that (oscillation) this would be worst where magnetic inclination was 45 or -45)
- local magnetic issue like deviation from normal magnetic inclination
- local magnetic issue caused by large electrical power flow in the area
- code bug
- default tuning value that we haven't tweaked yet (e.g. EKF or braking etc PIDs)
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on December 10, 2015, 08:01:17 am
For anyone wanting / willing to try moving HomeLocation a long way north or south for a test, I can say that I just had flights in VelocityRoam where I moved it 1400km north and 1300km south.  Moving it that far, I couldn't get the mags to go green, so I increased my mag warning level from .05 to .10 to get it to arm.

The one thing I definitely saw was a very slow north south oscillation in flight.  Distance was maybe a hundred meters.  Velocity was maybe a five meters per second.  In VelocityRoam I had no problem countering the oscillation, but if I didn't counter it, it moved as described.

I would suggest trying 500km or 1000km north or south; whatever it takes to still get an occasional green mag so it will arm.

Another thing that I can't say for sure was that there seemed to be a fast twitch (like a partial fast oscillation) that I have never seen before.

This quad is a stable old underpowered work horse running stock PIDs.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on December 10, 2015, 08:26:07 am
Does your mag health consistently go yellow or red at slightly more than hover power?  Perhaps more so when pointed say north than when pointed say south?  How about at higher power than hover power?
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on December 10, 2015, 08:27:22 am
Warning:  Dangerous test!  Don't do it if you are uncomfortable with it.

Probably the first thing I would do if I could recreate it is log and graph the mags and ActuatorCommand.Channel(s) (=motors) while I used the GCS to run each motor up (to at least hover x 1.5 power) and down.  And also run all motors up and down at the same time.

One fairly good way to do this is to start by taking all props off and putting them back, upside down, on the motor immediately clockwise, like motor #1 prop goes upside down on motor #2.  This will cause all motors to blow upward and make testing somewhat easier.  Whether you do it this way or not, you must have props on because the motors won't pull many amps without props.

Tie it down securely (so it can't move, which would cause the mag reading to change) maybe to a board in your porch.  It's important that it doesn't move during the test.  Long wobbly landing gear might need to be removed.

If you can see a difference in the mags when running this test, there is a reasonable chance that it could be a wiring / mag issue.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: lanzi on December 10, 2015, 08:42:07 am
-Yes absolute stock pids after a fresh install shows the issue the same way as a pid tuned quad.

- using a lumenier qav 400 with a PDB in a non circular layout. there is heaps of separation between the Platinum V9 and the PDB (which is the lowest part of the frame).
the lipo is strapped underneath and all wires are twisted and braided. the V9 has a vertical separation of the PDB of more than 20cm.

- 2 tuning methods are used. OP-Tune (when the calculator was still online) and now LP easy-tune.

- only out of the ordinary i can think of is the 915mhz 3dr radio that i use for telemetry. although i doubt this is an issue as i tested it with a bluetooth module as well. same oscillations.

- yes all wires are twisted and braided. hi current wires as low as possible and gps and compass as high as possible.

- my second testframe is a blackout mini-h. showing the same characteristics although the components on that frame are really rudimentary. no osd, no vtx, no camera, just the revo, platinum v9, 12 amp escs, 2000kv motors and frsky 2.4ghz receiver.

-i would like to mention again that flying close to or over water makes the oscillations really bad.

- logging my flights i can say that my mags almost always stay green in flight. sometimes they go orange but never red. no matter how much throttle i give.

- will do a home location test with greater distance tomorrow (weather permitting). also will try the inverted propeller test to see what happens

thanks heaps TheOtherCliff for getting onto it!! May i ask where your physical location is? Do you think the compass declination could be an issue?

cheers
lanzi
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on December 10, 2015, 09:30:58 pm
A 'bug I hinted at' is that the braking has a minimum speed in it and we seem to have a problem if it is below a certain speed.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: lanzi on December 10, 2015, 09:42:26 pm
yes it seams like the breaking values must have something to do with it. the faster i go the less oscillations i have. when i get slower to fly a turn left or right the oscillations get more.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: lanzi on December 10, 2015, 09:44:41 pm
by the way, did the inverted propeller test yesterday evening. tied the quad down and gave full throttle to see what the mag is doing. mag stays green up to 90 percent throttle above that it turns orange, but never red
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on December 11, 2015, 08:10:45 pm
That is a smoking gun that we should look at high power wiring.  If you were to test again and rotate the copter and test at different compass points, you would find that there are directions where this (orange mag health) happens less or not at all.  If you included all possible orientations (not suggesting doing this) you would find a group (cone actually) of angles where the mag stays green at full power.

(assuming you aren't close to a magnetic north or south pole :) and your wiring mag field is much weaker than the earth's when measured at the FC mag sensor) 

Are all your high power wires twisted:
- battery to connector
- connector to PDB
- PDB to ESC
- ESC to motor (less probable issue here)

The mag direction is used like the accels for attitude.  The mag strength is used to determine mag health.

If you add an external mag field (from our high power wiring) to the earth's mag field, it can do any combination of making the strength stronger (ext field points north), weaker (points south) or even just change field direction without changing strength (points mainly in a disk (actually a cone) that goes east up west down).  This is vector addition (arrow addition) where for instance 10 north plus 10 east equals 14.142135... northeast and 10 north plus 10 south equals zero and 10 north plus 10 north equals 20 north.

So understand also that the mags are used for attitude, just like the accels.

What sounds like it is happening:
Say facing north it is worse:
When front motors add power the extra mag field changes the direction of the detected mag field and makes it think it is more nose down so it adds even more power to front motors.  It reaches a point where it thinks it is correct and reduced power on nose motors.  That changes the direction of the detected mag field and makes it think it is more nose up, so it reduces nose motors even more... Oscillation.

And when facing south there is no problem:
In the above description, the extra mag field does not change the direction of the detected field, it just changes the strength.  The change in detected mag field does not change the direction of the detected mag field, so no attitude change, so no oscillation.

It would be my guess that for say 300mm and larger quads with external mag on a pole, with all high power wires twisted, that this will not happen.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on December 12, 2015, 06:44:29 am
Today I went out and flew VelocityRoam with a camera on board.  Here is the video I made.  Do you see an oscillation?  What time / direction did it happen?  When the camera is facing the man (me) it is point just about straight south.

Password is:
oops

https://vimeo.com/148698129

Timestamp in video is about 2 hours fast.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: ggrif on December 12, 2015, 06:25:01 pm
Following this with great interest! Thanks TheOtherCliff.

Lanzi, would you mind posting your most recent adjustments to the various parameters on the "System, Settings" tab? Now that OP is gone I can't go back there and look at all the suggested fixes.

I've just finished a new 480 quad.  I will see what happens with stock "Generic Quad" setup first. Then, if need be, dial in what you've come up with.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: ggrif on December 12, 2015, 06:36:22 pm
Today I went out and flew VelocityRoam with a camera on board.  Here is the video I made.  Do you see an oscillation?  What time / direction did it happen?  When the camera is facing the man (me) it is point just about straight south.

Password is:
oops

https://vimeo.com/148698129

Timestamp in video is about 2 hours fast.

The oscillations seem to start when, I'm guessing, the quad has rotated about 180 degrees from South, so North?  Very consistent through the video.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: lanzi on December 13, 2015, 10:38:31 pm
Hi TheOtherCliff,

thanks heaps for posting your video. that confirms that you have the problem as well. evnen though your quad seams to be quite a bit bigger judging from the lower rpms.
my observation regarding the oscillation in your video are the following with South facing you and North facing the trees.

Bad Oscillations
0:20-0:36
1:11-1:46
2:02-2:30
5:38-6:04
Really Bad Oscillations
2:55-3:56
Ok Stable almost No Oscillations
0:58-1:06
1:50-2:00
2:38-2:52
Ok No Oscillations (really good)
4:00-5:22
What Have you done here? There almost No Oscillation on a 360 Degrees rotation!!!
Have you changed any settings on the fly?
4:35-5:37


Regarding your assumption that the problem does not show on frames bigger than 300mm does not apply to my setup. my QAV400 is bigger than 300mm with an external mag on a long pole plus all high current twisted and running very low in the frame. the frame itself is G10 and should have no impact.

the scenario you describe above in "what sounds like is happening"
is that something that can be fixed in code?

cheers
lanzi
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: lanzi on December 13, 2015, 10:48:22 pm
hi ggrif,

these are my most recent settings. although i have to say the result regrading the oscillations with these settings is not much different to the stock settings.



Following this with great interest! Thanks TheOtherCliff.

Lanzi, would you mind posting your most recent adjustments to the various parameters on the "System, Settings" tab? Now that OP is gone I can't go back there and look at all the suggested fixes.

I've just finished a new 480 quad.  I will see what happens with stock "Generic Quad" setup first. Then, if need be, dial in what you've come up with.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: lanzi on December 18, 2015, 07:32:12 am
To keep you guys in the loop. After another few days of testing I was not able to reduce the oscillation at all. I set up a completely new frame with everything new. Frame, motors, ESC, ppm receiver and 5 V bec, op revo and V9 GPS on a mast. Nothing else. No fpv gear. Standard settings and PIDs. Oscillations show up  every time. Set home location 500 km north and 500 km south plus 500km east and west. Did not change a thing. Velocity roam and GPS assist show oscillations while hovering and with stick input especially when yawing.

Did the devs find out anything in the meantime?

Cheers
Lanzi
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on December 18, 2015, 05:26:54 pm
By the way, the quad in my video is using aux mag, but the GPS/mag board is stacked right on top of the Sparky2 FC, so it is almost as close to the wiring as the on board mag.

I didn't change anything during that flight.  I haven't bothered to tune PIDs as this is a test quad and I have always assumed that this quad was just a little bouncy.  I actually thought that the video didn't really show any direction based oscillations.

The scenario in "what sounds like is happening" is one that should be eliminated by careful twisting of high power wires and/or a mag mounted on a pole.  Code could be written for a second mag calibration that gets run with props on at full power.  That second calibration would be used to track the changes at different power settings on each motor.  A lot of work for very little gain, and it would have to be recalibrated whenever the wiring gets shifted around and you would have to be careful to always install the same brand/size of battery in the same orientation with the same number of twists and stow the battery wire in the same location each time.

I think I did a decent job twisting my wires, but as I say, the mag sensor is not on a pole, so there still may be mag issues.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on December 18, 2015, 05:49:19 pm
What type of PDB are you guys using?  This is the one I am using.  It is on the bottom side of the bottom plate and my FC and mag are a about 2cm and 3.5cm above the top board.

(https://forum.librepilot.org/index.php?action=dlattach;topic=382.0;attach=802;image)
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on December 18, 2015, 06:16:05 pm
Any of you guys tried a camera gimbal?  It would be informative to know if a gimbal makes it better or not.

(If it makes it better, the problem is probably a simple oscillation because the attitude estimation is correct.  If not, it is more probable that the attitude estimation is wrong or part of the oscillation chain (or gimbal isn't fast enough to correct the tremor)).
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on December 18, 2015, 07:01:15 pm
I wonder it it would help to tune PIDs in VelocityRoam mode rather than Attitude mode.  Maybe tune pointed in bad direction.

I forget now.  Is one of you guys the one that posted about this back in the OP days?  There was a really good video with just yawing that was clearly an issue when pointed in different compass directions from that time period.  Does that copter still exist in that state or has something been done to it and now it isn't quite so bad?

Maybe we need to try to make it worse rather than better.  I will try to make a loop in one PDB -> ESC that points in a calculated direction.  When that motor is pointing north, it should fly fine, but when pointing elsewhere there should be problems.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: lanzi on December 18, 2015, 07:14:52 pm
Yes I am the one who posted about this issue back in OP forum and I also posted the yawing video. Yes that quad still exists.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: f5soh on December 18, 2015, 11:12:28 pm
@lanzi If i remember you live in NZ ?
Can you check if mag readings on PFD matches the geographical North ?
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on December 19, 2015, 06:48:43 am
Laurent raises the question of magnetic declination (a different thing than the mag inclination I was testing with setting HomeLocation way north or south) too.

If someone that has the issue that uses aux mag sensor only (OP GPS V9/Platinum with AuxMagSettings.Usage=AuxOnly) could adjust their aux mag yaw by say +-5 +-15 +-45 degrees until they see a change in the + and - directions we could see if that helps the issue.  Of course I can try the opposite: make it worse the same way.

Aux mag yaw is set at AuxMagSettings.Orientation for 15.09 and at AuxMagSettings.BoardRotation.Yaw for next.

If everyone here that has the issue could report back the country they are in we can see if there is a common theme in location.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: lanzi on December 19, 2015, 07:25:16 am
This makes a lot of sense. I hate to mention it but back when I was using naza here in NZ I had to rotate the GPS PUC by 15 degrees clockwise to make it work and to avoid toilet bowl . I will give that's trybasap and report back.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: liftbag on December 19, 2015, 04:50:46 pm
Hi all. Late in the party  :D

I think I was among the first to discover this issue since the times of OpenPilot.

My issue was present even in motion and was only N/S related.

Here the video.

https://www.youtube.com/watch?v=hLUMXRCzdAE
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on December 19, 2015, 08:55:40 pm
That's the video I remember.
Very clear pitch oscillation pointed north.  Smaller pitch oscillation pointed south.  None when pointed east/west.
That was in Italy correct?
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: liftbag on December 19, 2015, 10:36:37 pm

That's the video I remember.
Very clear pitch oscillation pointed north.  Smaller pitch oscillation pointed south.  None when pointed east/west.
That was in Italy correct?
Yes, La Spezia Italy
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: lanzi on January 06, 2016, 11:59:02 pm
happy new year everyone.

did some extensive testing over the holidays trying to eliminate these pesky oscillations in gps flight modes.
i am out of ideas by now. tried offsetting the compass rotation value to compensate compass declination.
had absolutely no effect on the oscillations other than i got toiletbowling with values higher than -20 degrees.

also thought i got a solution by keeping the KP values of VelocityRoamHorizontalPID, BreakHorizontalVelocityPID and HorizontalVelocityPID at the same value.

but also that did not work.

i really hope the defs can fiind what is causing this bug, because these oscillations make the entire GPS functionality worthless when it comes to UAV videography.
and that really would be sad.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on January 09, 2016, 01:28:02 am
Thanks for trying anyway.   :'(
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: Wagsy on January 09, 2016, 03:11:38 am
Hey Lanzi, well done on trying all those variables.
I have not flown mine for some time, but I only need it for RTH if I loose video signal, so the small oscillations are no probs.
But it would be good to nail it down.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: gitit20 on January 15, 2016, 07:03:02 am
I've also tried all this and still can't get it to work. I'm lost now lol. I hope they figure it out soon. Have you seen my YouTube video? Of how good it worked with 14.xx?
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: lanzi on January 15, 2016, 07:13:33 am
hi gitit20,

yes i hope this will be resolve. i know for sure that it worked perfectly until 15.02. that was also the last version where before velocity roam was introduced and the last version where VtolSelfTuningStats populated in GPS assist.

I believe this is all tied together somehow.

yes i have seen your video
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on January 15, 2016, 04:14:51 pm
There was a refactoring of the flight code around that time, so it was a bad time for the fracturing of OP to happen...
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on January 15, 2016, 05:10:18 pm
Has anyone had this problem on a multicopter with well twisted wiring and that uses an OP GPS with mag that is configured to use aux mag only?
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on January 15, 2016, 05:50:58 pm
There is a scenario that would cause this, that has only to do with some random parts of the construction of the particular multicopter.  I mentioned it before.  There is also a way to test for whether this is happening.  I know that I could re-wire my GPS quad to cause an oscillation if I wanted to.

The issue is that a particular routing of a high current cable going to an ESC can cause a detectable mag field change when that ESC draws more power.  That cable routing could cause the detected mag field to change angle.  The typical mag field from the earth points north, but aIso points steeply down (60+ degrees in the mainland USA).  The mag field is used for more than just compass direction.  It actually gives a better determination of up and down than the accels do, because the mags can't be fooled by acceleration like the accels can be.

So you see that the mag sensor is also used for leveling information.  Also, the mag sensor can be fooled by running a high current wire pair in a way that happens to turn out to be bad.  Bad would have e.g. increasing the power to the front motor(s) change the mag field to make it look like the multicopter was pitching forward.  A small power increase there would then make it look to be pitching forward.  That would make the FC give even more power to the front motors and it would look to be tipping even more forward.  Now the fact that it is actually tipping backward begins to be seen.  Finally it would have pitched back enough that it was satisfied and reduced the motor power to normal.  Suddenly it sees that it is pitched way back and drastically reduces the power on the front motors.  Now the reduction in power does the opposite.  It makes the multicopter think it is even more pitched backward than it is.  You have an oscillation.

Warning:  Dangerous test procedures ahead.  Use caution if you do this.

An easy way to test whether this is causing the issue is to tie the multicopter down firmly (and move props (and invert them) all to the motor to the CW of them so they blow up, not down).  Change stabilization to manual (maybe use FlightModeSettings.DisableSanityChecks to allow you to use Manual on a quad) or rate, not Attitude, we don't want any stabilization if possible.  Decrease the logging period for which ever mag sensor you are using to 100ms.  Display the three mag sensor dimensions on a scope on the scope page.  Point the multicopter north.  I hope that the ground it is sitting on doesn't cause too much mag problem.  It shouldn't.  Use RF telemetry, or a long USB cable if you don't have RF telemetry.  "Start logging" for later analysis.  Spin the motors up to hover power or a little higher.  If you feel it is safe, rock the pitch (or which ever direction you think yours oscillates in) back and forth (it doesn't have to be fast rocking) a bit to simulate what happens during flight.  Also run the power up high and back down a few times.  Throttle to zero.  Stop the logging.  Immediately do a print screen to capture your scopes.  Post the scope pictures (and log) here.

I am betting that we will see mag scopes change.  For a pitch oscillation, I think it is the Y axis that we will probably see change a lot.

I really think this will turn out to be the cause.  The solution will be to find what wire pair is causing the issue.  I can also imagine a certain kind of circular PDB being the perfect design to cause this.  Say power in from the side.  When high power is in front, the front half circle causes a mag field "up".  When high power is in back, the back half circle causes a mag field "down".

(Note to self:  I see that it is true that for some users it does it pointing either north or south, but does not do it east-west.  I see that happen on that OP 14.10 video.  I definitely see a pitch oscillation when pointing either north or south.  I wonder if I even see/hear a smaller roll oscillation when facing east or west.)
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: gitit20 on January 16, 2016, 12:47:22 am
you could also test this using only external mag with the GPS up on a pole I tried this and still had the same problem? the pole was 8 10 and 12 in tested no notice in any changes. for me.

Do you think It still could be wires?


There is a scenario that would cause this, that has only to do with some random parts of the construction of the particular multicopter.  I mentioned it before.  There is also a way to test for whether this is happening.  I know that I could re-wire my GPS quad to cause an oscillation if I wanted to.

The issue is that a particular routing of a high current cable going to an ESC can cause a detectable mag field change when that ESC draws more power.  That cable routing could cause the detected mag field to change angle.  The typical mag field from the earth points north, but aIso points steeply down (60+ degrees in the mainland USA).  The mag field is used for more than just compass direction.  It actually gives a better determination of up and down than the accels do, because the mags can't be fooled by acceleration like the accels can be.

So you see that the mag sensor is also used for leveling information.  Also, the mag sensor can be fooled by running a high current wire pair in a way that happens to turn out to be bad.  Bad would have e.g. increasing the power to the front motor(s) change the mag field to make it look like the multicopter was pitching forward.  A small power increase there would then make it look to be pitching forward.  That would make the FC give even more power to the front motors and it would look to be tipping even more forward.  Now the fact that it is actually tipping backward begins to be seen.  Finally it would have pitched back enough that it was satisfied and reduced the motor power to normal.  Suddenly it sees that it is pitched way back and drastically reduces the power on the front motors.  Now the reduction in power does the opposite.  It makes the multicopter think it is even more pitched backward than it is.  You have an oscillation.

Warning:  Dangerous test procedures ahead.  Use caution if you do this.

An easy way to test whether this is causing the issue is to tie the multicopter down firmly (and move props (and invert them) all to the motor to the CW of them so they blow up, not down).  Change stabilization to manual (maybe use FlightModeSettings.DisableSanityChecks to allow you to use Manual on a quad) or rate, not Attitude, we don't want any stabilization if possible.  Decrease the logging period for which ever mag sensor you are using to 100ms.  Display the three mag sensor dimensions on a scope on the scope page.  Point the multicopter north.  I hope that the ground it is sitting on doesn't cause too much mag problem.  It shouldn't.  Use RF telemetry, or a long USB cable if you don't have RF telemetry.  "Start logging" for later analysis.  Spin the motors up to hover power or a little higher.  If you feel it is safe, rock the pitch (or which ever direction you think yours oscillates in) back and forth (it doesn't have to be fast rocking) a bit to simulate what happens during flight.  Also run the power up high and back down a few times.  Throttle to zero.  Stop the logging.  Immediately do a print screen to capture your scopes.  Post the scope pictures (and log) here.

I am betting that we will see mag scopes change.  For a pitch oscillation, I think it is the Y axis that we will probably see change a lot.

I really think this will turn out to be the cause.  The solution will be to find what wire pair is causing the issue.  I can also imagine a certain kind of circular PDB being the perfect design to cause this.  Say power in from the side.  When high power is in front, the front half circle causes a mag field "up".  When high power is in back, the back half circle causes a mag field "down".

(Note to self:  I see that it is true that for some users it does it pointing either north or south, but does not do it east-west.  I see that happen on that OP 14.10 video.  I definitely see a pitch oscillation when pointing either north or south.  I wonder if I even see/hear a smaller roll oscillation when facing east or west.)
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: lanzi on January 16, 2016, 02:04:32 am
Yes I think putting the GPS on a long pole has the same effect as the test described by theothercliff. Also I will do the test. Just to make sure it is not the wiring. Although I am pretty sure that it is not the wiring. My V9 is 12.5 inch above the pdb and all my wires are twisted. All of them. And my pdb is square not round. Chucked in one of my pixhawks yesterday. Using the same GPS pole. No oscillations whatsoever. It is killing me not knowing what it is.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on January 16, 2016, 03:36:01 am
If it acts the same whether using external mag or onboard mag, then the issue I described is not your issue (should be at least much better with external mag).

If it acts the same (same size oscillation) whether using 6 inch pole or 12 inch pole, then the issue I described is not your issue (should be at least much better with 12 inch pole).

If you have never flown with onboard mag, and always used the same length pole then it still could be caused by the issue I describe.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on January 16, 2016, 03:39:58 am
Are the 3 non-zero values in mag_transform (for the mag you are using) all in the range 0.85 to 1.05?

Also, I presume that everyone has tried recalibrating mags.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: gitit20 on January 17, 2016, 11:27:01 pm
HAHA you said 12 inch pole  :-X

I am not at home now traveling for work I will do some more checking and so on when I get back would a dump of my settings help if I uploaded it here?

Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on January 19, 2016, 03:49:15 am
You can post the uav file and I can check the calibrations, but those questions should be answered too.  :)
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: lanzi on January 27, 2016, 07:30:16 am
Hi Cliff,

here is my latest working UAV file. Everything is working nicely (apart from the oscillations)

lanzi
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: lanzi on February 05, 2016, 10:52:35 pm
Ok Guys, I have a solution (kind of).
I just wanted narrow down what might be causing the oscillations. I wanted to make sure that none of my power components are causing the issue (Mag interference etc, etc.)
So I went a bit brutal and ripped out the revo and v9 gps and replaced it with a pixhawk and pixhawk gps. literlay nothing else changed. all components are the same. ESCS, Motors, FPV Gear, Lipos, Props, Telemetry 915 mhz, 433 UHF.
Ran calibration on the Pix using external and internal mag in combo and voila. flies ultrasmooth in all GPS Modes (don't know if i should be happy or sad about that).
No oscillations whatsoever.

APM Planner has a pretty cool tool to measure the mag interference. did that and turns out it is less then 10 % (up to 30% is fine for good GPS/Mag performance).

So at least i now know my system is clean.

Will rip out the Pix now and plug the revo back in now knowing the issue is with the revo/gps/firmware.

TheOtherCliff, did you have a chance to check out teh UAV.file i uploaded?

cheers
lanzi

Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: gitit20 on February 17, 2016, 10:07:45 pm
I also tried a APM Mini as well and it also works just fine :) I saw your post and decided to copy what you did and it worked too...
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: lanzi on February 17, 2016, 10:19:14 pm
I plugged the revo/v9 back into the quad and went back to 15.2. (the last version before Velocity Roam got introduced) All is fine under 15.02. no oscillation in GPS assist flight modes. I will stick with 15.02 until a solid fix is available.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: f5soh on February 17, 2016, 10:37:36 pm
First time we see the issue Paolo (liftbag) was using 14.10.

Can you post your 15.02 config file working without oscillations ?
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: lanzi on February 17, 2016, 10:45:25 pm
here we go
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: f5soh on February 17, 2016, 11:02:16 pm
15.01 or 15.02 ? This config file is tagged as 15.01.

Edit: This last one you posted is calibrated in Australia and first (LP15.09)  from New Zealand
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: lanzi on February 18, 2016, 02:44:31 am
yes sorry 15.01. and yes it has been calibrated in adelaide. i just put the last config file onto my quad of which i know it worked. that shows that no hardware changed. i built teh quad in feb 2015 in adelaide and configured it with 15.01. and even though it was calibrated in adelaide it works great here in wellington
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: f5soh on February 18, 2016, 11:42:14 am
Pretty funny :)

The distance is 3200 kilometers ;)
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on February 18, 2016, 05:08:20 pm
TheOtherCliff, did you have a chance to check out teh UAV.file i uploaded?

Yes.  Mag calibration values look reasonable.

(Sorry to not respond sooner.  Forum is more active now and I was coding more.)
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on February 18, 2016, 05:19:11 pm
APM Planner has a pretty cool tool to measure the mag interference. did that and turns out it is less then 10 % (up to 30% is fine for good GPS/Mag performance).

Is that mag interference caused by motors running?  Any measurable mag interference that is caused by motor power increasing could be the cause of the LP issue.

What power level did you test for mag interference at?  I would guess that you get 10% interference at hover power.  Much more at high power.

Does APM setup include running motors up one at a time?  You can compensate for this issue if you know how much each motor affects the mag.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on February 18, 2016, 05:34:44 pm
Oh, right.  We use the 3D mag with the EKF and so mag is actually used for telling what direction down is.

APM undoubtedly just uses mag for heading and it would not have this problem.

Still using EKF, but switching to ATitude mode, does level (horizon) change if you climb perfectly straight up at high power or if you punch the throttle between 1/3 and 2/3 (assuming hover is 1/2)?  It may be more pronounced in one direction than the other, like the oscillation is.

If you have a horizon tilt that is noticeable using EKF with ATitude mode, you could then switch to Basic ATitude mode and test again.  I would bet that it doesn't happen there.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: xfce on February 24, 2016, 05:19:59 am
Hi all,
    Here are my log and fly video, 250 frame nano+gpsv9
in attitude it fly well, but in velocityroam it oscillate, some advice please, thanks.

Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on February 26, 2016, 02:09:14 pm
Is your AuxMagSetting.Usage set to AuxOnly?

Edit: Oh wait that doesn't look like a GPS V9
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: hwh on February 26, 2016, 04:11:20 pm
... Oh wait that doesn't look like a GPS V9

I think it is, sort of...   He was building a gps v9 clone, more a work alike since it doesn't use exactly the same components and layout.  https://forum.librepilot.org/index.php?topic=521.msg3973#msg3973
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: xfce on February 27, 2016, 02:50:37 pm
Is your AuxMagSetting.Usage set to AuxOnly?

Edit: Oh wait that doesn't look like a GPS V9
yes it is something like gpsv9,so i set AuxOnly.
and here is the new gpsv9, named KylinGPSV9
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on October 31, 2016, 04:19:00 pm
Yesterday I was flying 16.09RC1 and noticed a slow east west oscillation getting worse and worse.  It is different than the oscillations seen here in these videos in that it is maybe 8 times slower.

It is a slow oscillation; about 4 seconds per full cycle.
This is a fairly slow, fairly underpowered quad that hovers at perhaps 55% throttle.
It seems to be east west regardless of the direction the quad nose is pointing.  I will test more to verify this.
It slowly got worse and worse.  I turned down some PID settings in VtolPathFollower and I at least got it so it was decreasing, and not increasing.
I also saw this several months ago with the 'next' of that time, so it is not just an RC issue.
I don't know if this happens with 15.09.

This one I suspect is caused by the compression of east west coordinates as you get close to the Earth's north or south pole.  If that is the case (and assuming it is not handled already), then the fix would be to mathematically stretch/compress the local (xyz in meters) coordinates to adjust for this.  It would probably be acceptable to just calculate and store a stretch factor when setting home location, and use that.  For someone familiar with the code, this is an easy change.

The first few seconds of the video are a good example of the issue.  I switched from VelocityRoam to Attitude for about the last 40 seconds of the flight.  I think I had the wrong channel selected on the video receiver...

(password is: oops)
https://vimeo.com/189638568
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: jdl on November 02, 2016, 04:53:19 pm
+1.
I observed today and the last few days the same oscillations. East-West direction. I suppose but I'm not sure that windy weather contributes the manifestation of the problem (winds today were about 40km/h). I was doing mags calibrations in different configurations (with/without HD cam, with 2250mAh and with 5200mAh battery) because GPS/MAG is mounted directly on the upper plate of the frame between HD cam and battery, no mast at all. Later telemetry playback showed no mag alarms during the oscillations. The forecast for friday is for much calmer winds so I'll retest the same configurations to see is oscillation is so pronounced with no or small wind gusts.

Edit: Further testing showed that wind gusts don't affect the oscillations. It's just the same even if no wind at all.
Mag alarms are rarely yellow during flight, and often mag is entirely green during oscillations. But I should mount back the GPS mast and redo the tests to check if some minor mag disturbanced below alarm threshold don't cause oscillations in my case.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on November 03, 2016, 01:54:30 am
Another fact:  I tuned the PIDs with AutoTune, so it is "tighter" than it was.  That may be why it was not obvious earlier.

I suspect the issue is with LP not handling the compression of east west GPS position correctly, or a similar issue with GPS velocity (which could either be an LP or a GPS manufacturer issue).
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: jdl on November 07, 2016, 02:48:59 pm
Sorry for the misleading information!
I cannot reproduce the same oscillations that TheOtherCliff talks of. I tracked back the cause for my problem back to stupidly high value for HorisontalPosP in VTOLPathFollowerSettings. I'd set it to 1 (m/s)/m some months ago when it seemed to be a workaround for slower-than-desired RTB problem and forgot about it. Now I returned it to its default value of 0.25 and RTB works just fine, the problem seems to be fixed in RC1. Also, these slow and increasing oscillations do not happen anymore.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on January 18, 2017, 07:25:27 pm
If you have an east west oscillation in GPS modes and are using a DJI GPS/mag and 16.09, here is some firmware to try.

I thought that re-calibrating my mags had fixed this issue, but I discovered that the oscillation happens worse when pointed in one direction than another.

I tried rotating the GPS/mag mount (physically twist the GPS into another direction) 10 degrees or so in either direction and all it did was change the east west linear oscillation into a slight east west elliptical oscillation (CW and CCW).

I re-calibrated Board Level, did Attitude mode hover test and rotate virtual (in Basic) to get non-drifting hover, re-calibrated mags, did Attitude mode hover test and trimmed mag Board Rotation (in INS13) to get non-drifting hover in INS13.  I tested at each stage.  It still does it.  The only thing I did not do is move the GPS/mag higher than it is, but since I did the GPS mount rotations and Attitude mode hover in INS13 I believe the mag is not the issue.

The only thing that fixed it is this code change that modifies the reported longitudinal GPS velocity according to the latitude.

Let me know if you have this problem and try this firmware.


Problem still not fixed.

Attachments removed.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: hwh on January 18, 2017, 10:38:02 pm
The switch to INS14 didn't affect this at all?
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on January 19, 2017, 01:46:22 am
I want to understand the issue, not just make it go away to cause issues elsewhere.  I'm using 16.09 (as are most other users) which still has INS13.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on January 19, 2017, 01:46:49 am
Prior to posting this firmware, I test flew it.  The issue did not happen, and I know that I tested it in directions that had issues before.  I test flew it again today and the issue is back though.  I will move the GPS/mag higher and test again.

Mag issues at more than hover power, and DJI delays (due to DJI using more smoothing than we do) are about the only things remaining.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on October 05, 2017, 02:13:25 am
In VelocityRoam mode, when the quad is pointing either east or west it gets a small roll oscillation (no pitch component) with a frequency of several oscillations per second.  The amplitude is enough to see in near by LOS hover, but not enough to affect flight.  When pointing either north or south it does not oscillate.  At headings in between the amplitude is in between.  The oscillation frequency seems to remain the same.

I had this issue today with a quad I haven't flown in a while but IIRC it did not have this issue before (at least not noticeably).

The quad is symmetrical.  It uses an authentic DJI Naza GPS/mag, a Sparky2, and 16.09 release+dirty.  The dirty part is probably the DJI/Naza GPS fix firmware.

I notice that if I yaw around slowly that the quad moves about 2 meters but comes back to the original location when I get back to the original heading.  It is acting as if the compass heading changes the coordinates that the GPS gives the FC.  I logged a flight and found that the GPS log does draw lines exactly straight north south (with expected variation) when yawing very slowly all the way around, so the FC is actually directing it to be offset for some reason!!!  PositionHoldOffset is 30,15 (default).  IIRC the N/S motion happens mainly when facing north or south.  I.e. when facing east 30 degrees of yaw produces almost no motion but when facing north 30 degrees of yaw produces a lot of motion.

The issue that the unofficial DJI Naza fix firmware fixes is a much slower oscillation that is seen as the quad moving back and forth (always east and west) several meters.

This quad has been tuned with AutoTune.  It does not exhibit any oscillation or even ringing in plain Attitude mode (still INS13).

I have a nearly identical quad that does not have either the oscillation or the N/S drift at all.  The only hardware difference is the motors are 750KV and battery is 4S instead of 1100KV and 3S.

I'll research this.  Recreate.  Determine exact firmware in both cases and eliminate that as a cause.  Examine differences in settings.  Determine if the oscillation is always left/right roll so that when facing east/west it is a north/south oscillation and when facing northwest it does a southwest/northeast oscillation OR whether when facing northwest it does an east/west oscillation (which includes pitch).  Is mag calibration part of the issue?  Calibrating in one place but flying in another?  Moving HomeLocation (42km SSW) but not recalibrating?
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: xrxpercy on November 26, 2017, 02:23:05 am
All,
Here are 2 pictures showing bad east west oscillation.  My quad is stationary and not armed on the work bench while this was photographed.  It also swings about 10 degrees on the compass and shows a gentle rolling on the horizon.  The GPS is a NEMA protocol 9600 baud 1 hertz rate model with a built in compass on I2C that was designed for APM use.  It flies fine in Attitude mode but goes crazy in position hold or velocity roam.  If I run the GPS connected via a FTDI to U-Center the oscillation is gone and the deviation is ok.  I removed a NAZA clone GPS for east west oscillation problems but this slow one is way worse.  Aux and internal raw magnetometer scope shows almost overlapping traces.  I have a better GPS on order but I wonder what causes this.
Title: Re: Oscillation in GPS Modes that is Sensitive to Compass Direction
Post by: TheOtherCliff on November 26, 2017, 05:09:02 am
I have seen this issue when using NMEA GPSs and more often by badly aligned or badly calibrated mags.  There are a certain set of NMEA sentences that need to be enabled in the GPS.  Also, you should be running much faster than 9600 baud.  Probably at least 38400.  Most modern GPS solutions that we use actually even talk at 57600.

It is all around better to use the Ublox (or DJI/Naza) protocol if your GPS supports it.