Bill

  • *
  • 13
GPS mode stabilization problems
« on: May 09, 2016, 12:05:03 am »
Hello,

I've been trying to get the gps mode to work but I can't seem to get it stabilized.  I am new to this, I am sure that it is something simple but I've reached a point where I'm completely stumped.
in normal mode it flies great, stable really no issues.  when I change to gps no go.
so, flight data: all green 10 - 13 satellites
flight mode 1 is stabilized the quad wants to go forward and right pretty strongly, and it varies, sometimes I just have enough stick to keep it level
flight mode 2 stabilized with gps assist, thrust is set at altitude hold, which when I do get it in this mode, I can see it's trying to do something but it still goes forward and right.
flight mode 3 velocity roam.  I have yaw set to axis lock.  thrust manual, immediately goes hard right and forward no stopping it. well, it stopped when it hit the side of my house so I guess that could work...

again, none of this when not in gps mode.

there is foam on the board. it is mounted on foam. it's balanced.

here is a screen shot of the stabilization basic tab and the altitude hold tab.  sorry it's a bit blurry but hopefully enough to see what's going on.

hopefully it's something simple... 

I appreciate any and all inputs.

just added in the config file as well...
« Last Edit: May 09, 2016, 12:16:37 am by Bill »

f5soh

  • *****
  • 4572
    • LibrePilot
Re: GPS mode stabilization problems
« Reply #1 on: May 09, 2016, 12:15:17 am »
Hi, welcome.

Double check your Mag alarm in SystemHealth panel while motor are running. Should be green all time.

If the Mag is disturbed you cannot safely use all GPS modes.
Start with a basic Poshold, what happens ?

Bill

  • *
  • 13
Re: GPS mode stabilization problems
« Reply #2 on: May 09, 2016, 12:21:31 am »
thanks for the reply.

I tried position hold as my first attempt with gps.  it shot up 30 - 40 feet and forward.  I killed the throttle and let it drop.

It is now no longer doing this...  no reason why, other than maybe the mag is going in and out?  I was actually hoping for no foam but it's there.


Mateusz

  • *
  • 808
Re: GPS mode stabilization problems
« Reply #3 on: May 09, 2016, 08:11:36 am »
Most of issues here are with 3D magnetometer. How is magnetometer mounted? Is it always green ? Was it calibrated outdoors ? Try pressing 5 times save and last time rotating your copter in all directions yaw,roll,pitch and diagonals to sample as much as possible. Don't ignore it but calibrate outdoors over oplinks far from metalic items. Use 14-16cm mast for AugMag and twist horizontally running power wires. Check if model reacts correctly to movement with hand in gcs model view with INS31 or Comp+Mag. Check if lines are flat in attitude state when copter is not moving and INS31. Check if altitude hold or Vario on Thrust works with just Complementary. You should have stable flight there before attempting even GPS modes. Remember GPS flight mode does not just use GPS.

Bill

  • *
  • 13
Re: GPS mode stabilization problems
« Reply #4 on: May 10, 2016, 02:10:12 am »
Thanks Mateusz.

so I just flew it in complementary.  very stable, no problems.  I set it up to have altitude hold and vario.  altitude hold doesn't "hold" it doesn't maintain enough altitude and drops when mildly turning.  I'm sure there is an adjustment for this?
Vario, responded a bit better in holding an altitude but not much.  again, an adjustment?
so I have very stable flight in complementary.
the magnetometer is the one on the board.  it is mounted centrally on the quad on an 1/8" piece of foam.  I calibrated in the house.  when I set it in the center of the room the magnetometer is always green.  I will take your advice and use the oplink to calibrate it outdoors.

I am not quite sure what you mean by pressing save 5 times? at the end of the calibration? and then moving the copter in all directions?
wires are tightly twisted, it responds in gcs model view (complementary) exactly as it should but in ins31 it isn't as stable and is evident on the model view.
the lines for the gyro are not flat whether It's sitting still or I'm moving it by hand.

any other suggestions?

thanks!

Mateusz

  • *
  • 808
Re: GPS mode stabilization problems
« Reply #5 on: May 10, 2016, 08:51:55 am »
so I just flew it in complementary.  very stable, no problems.  I set it up to have altitude hold and vario.  altitude hold doesn't "hold" it doesn't maintain enough altitude and drops when mildly turning.  I'm sure there is an adjustment for this?
Vario, responded a bit better in holding an altitude but not much.  again, an adjustment?
Yes by adjusting Stabilization->Altitude Hold settings. What I am using now is Proportional Altitude 70, Proportional Vertical Velocity 30, Integral Vertical Velocity 70, Derivative Vertical Velocity 20 and Beta Vert Velocity 90. You have to tune those settings.
Please check here https://librepilot.atlassian.net/wiki/display/LPDOC/Altitude+Hold

the magnetometer is the one on the board.  it is mounted centrally on the quad on an 1/8" piece of foam.
First mistake, get mast, check my photo in attachment.
Indeed looks wired on a racer, but it seems to be the only way on my quad.

I calibrated in the house.  when I set it in the center of the room the magnetometer is always green.
Second mistake, never in house, believe me or not, Mag is enough sensitive for any calibration indoors to be useless.

I will take your advice and use the oplink to calibrate it outdoors.
Good :)

I am not quite sure what you mean by pressing save 5 times? at the end of the calibration? and then moving the copter in all directions?
When you are in the calibration tab, there is Start button and then you click Save when bar completes. Among other sensors there is a bar for Mag.
Calibration of Mag is a bit different, when you start calibration actually magnetometer samples ALL the time, not just when you press Save. So if you put your quad on the car between calibration steps for Mag, it will be wrong. Best is to start, keep it in the air, click 5 times save, and then rotate it in all directions to cover sphere (Mag measurements are x,y,z points which lay on a sphere). Then when you press 6-th time Save, it saves calibration and you're done.

wires are tightly twisted
Good, here I pasted pictures found on Google how twisting wires affects magnetic field https://forum.librepilot.org/index.php?topic=396.msg10422#msg10422
There is not such thing as isolating magnetic field, you can only redirect it, and hence make it weaker in one direction.

it responds in gcs model view (complementary) exactly as it should but in ins31 it isn't as stable and is evident on the model view.
the lines for the gyro are not flat whether It's sitting still or I'm moving it by hand.

any other suggestions?

Correct, that is most likely Mag problem. Use AuxMag on a 14-16cm mast and calibrate it outdoors. After calibration mast must not rotate. Also you have to make sure that AuxMag is in the same orientation as one on Revo, or use GCS to rotate Mag virtually. Each GPS can have that mag oriented differently.

Also fix your altitude hold/altitude vario such that it is able to maintain altitude when you let the sticks for 1-2 sec. The INS31 (EKF) required for GPS uses ALL sensors.

Bill

  • *
  • 13
Re: GPS mode stabilization problems
« Reply #6 on: May 11, 2016, 12:27:37 am »
Hello Mateusz,

Thank you for your detailed reply.  I appreciate you taking the time to help.

so, just did a couple of flights after making the recommended adjustments.  It worked! 
I've got it in complimentary mode, very stable, I switched to altitude hold and flew it around.  it wants to slowly sink down in fast forward flight but I will keep tweaking.  I hovered it right beside me and I pushed down on it to see how it would react and it responded immediately pushing up but didn't shoot up when I stopped.

the vario mode seems to hold a bit better.

I then put it back in manual and flew it to see the difference...  very big difference, especially when making sharp turns.

thanks for the excellent advice!!!

I will get the oplink up and running on the weekend and recalibrate the mag.

the question I have is, you indicate running an auxiliary mag.  but from what I'm reading, there is only one aux mag that works with the revo?
I've got the M8N gps with compass, so there is a mag on the board but it's not separately wired. 

any suggestions there?

hwh

  • *
  • 1018
Re: GPS mode stabilization problems
« Reply #7 on: May 11, 2016, 02:56:02 am »
...the question I have is, you indicate running an auxiliary mag.  but from what I'm reading, there is only one aux mag that works with the revo?
I've got the M8N gps with compass, so there is a mag on the board but it's not separately wired...

There are three but only two are still made, the I2C external mag and the DJI Naza GPS and it's clones.   The I2C requires two cables, one 4 pin connector with 4 wires for the GPS part and a 4 pin connector with two wires for the mag sensor.   The NAZA type just use one 4 pin connector and are easier to get going but they come with the wrong connector so you have to replace it.

If your GPS only has one connector but says it has a compass it's probably one of the ones that has an I2C mag sensor but for some reason they didn't run the wires to it.  If you plug it into the revo and the GPS part works with the port set to GPS/57600/UBX then it's one of them.   The NAZA ones wouldn't work as a GPS if it's set to UBX protocol.

If you open the GPS case and post a picture of the board inside we can tell you for sure what type it is and whether or not it actually has a mag sensor.  Some of the ones sold as "with compass" don't even have the chip inside, others just lack the wires.  No one knows why.  If it does have the chip inside we can tell you where to solder wires on to get the mag hooked up.

Bill

  • *
  • 13
Re: GPS mode stabilization problems
« Reply #8 on: May 12, 2016, 03:38:04 am »
Hello hwh,

thanks for the reply.  I've attached a couple of photos... one of the quad and one of the M8N gps board.

I looked online and found the same gps with two cables...  but it said it was for the pixhawk.  Probably won't work with the Revo?

anyway, let me know what I need to do and I'll give it a shot.

I appreciate the advice!


hwh

  • *
  • 1018
Re: GPS mode stabilization problems
« Reply #9 on: May 12, 2016, 05:18:15 am »
The picture you posted has the mag chip in it, it's the tiny square one labeled A983.

The two cable pixhawk ones would probably work too, you'd just have to change the two connectors to the smaller ones we use.

For the one you have you need to connect two wires, SCL and SDA.  They actually go to the two missing wires in the connector and if you had a way to hook wires to them it would be very neat.  If not you can solder the two wires onto the two circular gold pads next to the connector labeled SCL and SDA.  Not the ones at the other edge of the GPS, they're for the EEPROM next to them.  The other end of the wires go to a connector matching the sockets on the revo.  The revo probably came with wires you an use, if not they're available on eBay and the Chinese sites already attached to short wires, they're 4 pin JST SH connectors.  Neither option is probably long enough to reach the top of the mast and most people just solder wires to extend them onto the wires on the connectors.  Buying the connectors and wire to make your own cable the correct length doesn't work well.  The connector pins are really, really tiny and require a crimper that most people would have to buy just for this.   And the connectors only take very small 0.8 mm OD wire.

What wire goes to what pin on the revo is in the picture at https://librepilot.atlassian.net/wiki/display/LPDOC/GPS+setup


Bill

  • *
  • 13
Re: GPS mode stabilization problems
« Reply #10 on: May 13, 2016, 02:47:52 am »
hello hwh,

so I created the cable, plugged it in...  I've got the main port with the gps and the flexi port set to I2c.  I went into systems settings to see if I had a live external mag but it's not sending any numbers.  mag is currently green on the flight data along with everything else.  I now have 15 satellites.  It must be using the onboard mag?  Anyway, any advice on how to setup the external mag?  I've read through the documentation and followed it, but still doesn't seem like there's power.

thanks!

hwh

  • *
  • 1018
Re: GPS mode stabilization problems
« Reply #11 on: May 13, 2016, 03:17:19 am »
I wasn't in this thread at the beginning so I just skimmed over all the posts in this thread and I don't see anywhere what version of GCS you're running.  External mag requires compiling and running the next branch of the software.  If you are then the configuration -> attitude tab has a sub-tab that shows both the internal and external mags compared.

The external mags in gps get their power from the gps cable.

There's a lot of info on aux mag setup in the wiki at https://librepilot.atlassian.net/wiki/display/LPDOC/Aux+Mag+Setup+and+Calibration  probably a little too much info actually.  There are also a fair number of threads in the forum on both the aux mag and compiling next.

And if you're not running next the instructions for compiling and running it are in the developer manual at https://librepilot.atlassian.net/wiki/display/LPDOC/Developer+Manual

Roypw

  • *
  • 45
Re: GPS mode stabilization problems
« Reply #12 on: May 13, 2016, 06:01:53 pm »
On the Next new magnatometer tab could someone please explain what the indications mean.  I get the rotation but above that what do the 2 rectangles indicate both the color and the percentages in them?  Also a brief explaination of the other items on this page would help.

Thanks

hwh

  • *
  • 1018
Re: GPS mode stabilization problems
« Reply #13 on: May 13, 2016, 06:50:29 pm »
...what do the 2 rectangles indicate both the color and the percentages in them?...
The rectangles are the error between what that mag is reading and what it should be calculated from your location set on the previous tab.  Red bad, green good.  :)

...Also a brief explaination of the other items on this page would help...
The three bars are the difference between the internal and external mag readings.  They should normally be centered and go back to center after you move the board.

Both depend on the mag calibration having been done.

There's a good video on orientation of aux mag by f5soh:

Roypw

  • *
  • 45
Re: GPS mode stabilization problems
« Reply #14 on: May 13, 2016, 08:08:14 pm »
A little confused, you said what the mag is reading and what it should be based on calculation?  Calculation of what? Sorry, I am sure it's a simple answer but I wouldn't think it can calculate 3 axis mag readings, if so why do we need the magnetometer? 

I know red is bad but was wondering what is bad?  Just the difference you mention, however the color doesn't seem to change with % , sometimes low % is green etc.  looked like the % and color were indicating 2 different things?

Thanks

Roy


Roy