LibrePilot Forum

Users => Vehicles - MultiRotors => Topic started by: Bill on May 09, 2016, 12:05:03 am

Title: GPS mode stabilization problems
Post by: Bill 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...
Title: Re: GPS mode stabilization problems
Post by: f5soh 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 ?
Title: Re: GPS mode stabilization problems
Post by: Bill 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.

Title: Re: GPS mode stabilization problems
Post by: Mateusz 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.
Title: Re: GPS mode stabilization problems
Post by: Bill 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!
Title: Re: GPS mode stabilization problems
Post by: Mateusz 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.
Title: Re: GPS mode stabilization problems
Post by: Bill 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?
Title: Re: GPS mode stabilization problems
Post by: hwh 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.
Title: Re: GPS mode stabilization problems
Post by: Bill 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!

Title: Re: GPS mode stabilization problems
Post by: hwh 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

Title: Re: GPS mode stabilization problems
Post by: Bill 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!
Title: Re: GPS mode stabilization problems
Post by: hwh 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
Title: Re: GPS mode stabilization problems
Post by: Roypw 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
Title: Re: GPS mode stabilization problems
Post by: hwh 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: https://www.youtube.com/watch?v=qLsd4O75N9o
Title: Re: GPS mode stabilization problems
Post by: Roypw 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
Title: Re: GPS mode stabilization problems
Post by: hwh on May 13, 2016, 08:44:43 pm
Playing with a compass as a child gives us the wrong impression of the Earth's magnetic field.  We think of it as running North - South parallel to the ground.   Most places on the planet it doesn't, it points up (or down) at an angle.  GCS has the tables to calculate what that angle should be at any point on the Earth.  The gyro/accelerometers tell what angle the FC is at and the mag should match that adjusted for the mag angle calculated.  The display is how far off it is.

Once it's calibrated the FC uses the angle the mag reads (adjusted for your location) as another input to the calcs to get a better idea of the orientation of the quad in the air.

The green/orange/red colors are based on the percentage.

There's a post somewhere that explains this in more detail but I can't find it right now.
Title: Re: GPS mode stabilization problems
Post by: Roypw on May 13, 2016, 09:43:59 pm
Thanks, hwh . Got it now on the %. I will check again but I recall red with 10% or less and green at high numbers.  Watching then seemed to indicate they were 2 different things.
Title: Re: GPS mode stabilization problems
Post by: f5soh on May 14, 2016, 11:02:21 am
Warning / error levels are defined here :

(https://forum.librepilot.org/index.php?action=dlattach;topic=1555.0;attach=3021)

This means 5% and 15% error.
Title: Re: GPS mode stabilization problems
Post by: Bill on May 15, 2016, 12:31:36 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
okay so I've done all of this and now have the "next" version running.  the first thing that I see is update available to 15.09.  the version that compiled was a71fb623.  do I want to upgrade to 15.09? 
Also, do I need to start over and run the vehicle setup wizard with this updated version?

thanks!
Title: Re: GPS mode stabilization problems
Post by: hwh on May 15, 2016, 01:02:31 am
okay so I've done all of this and now have the "next" version running.  the first thing that I see is update available to 15.09.  the version that compiled was a71fb623.  do I want to upgrade to 15.09?
No, the check is wrong.  It checks for exactly 15.09 instead of less than 15.09.  You're actually running 15.09 plus the changes since then.   Just ignore that message.

Also, do I need to start over and run the vehicle setup wizard with this updated version?
That's a less clear cut question.  Because some upgrades have problems if you don't "upgrade and erase" and then redo the wizard I do it every time.  It may or may not be necessary but it never hurts unless you don't like going through the wizard.  Also I think the wizard in next has the aux mag setup in it.
Title: Re: GPS mode stabilization problems
Post by: Bill on May 15, 2016, 02:31:27 am
okay thanks.  I'll run the wizard.

the other thing is, when I click on the flight data tab it only shows the OPMap and the system health.  I don't have the option to show the model and even though the upper left screen shows PFD as being selected it is blank.

wondering if it didn't compile correctly (didn't see any errors though...) or if those options aren't available in this version???  the screen shot is without the quad connected but it looks the same either way...

attached a screen shot.
Title: Re: GPS mode stabilization problems
Post by: hwh on May 15, 2016, 03:00:38 am
When you switch gcs versions it tries to use the preferences from the previous version and they're incorrect.

If you're starting it from the command line with a command like librepilot-gcs   then start it one time as librepilot-gcs -reset

Or you can do file -> GCS settings import/export and choose reset config and then quit the program.  When you start up again all the GCS settings will go to defaults and the displays should be back.
Title: Re: GPS mode stabilization problems
Post by: Bill on May 15, 2016, 03:19:39 am
awesome!  it worked.

now I just have to connect the quad and get it all setup. 

I'll let you know how it progresses.

thank you for all of your help.
Title: Re: GPS mode stabilization problems
Post by: milogi on May 15, 2016, 11:15:47 am
Hello
I have been following this thread and I have a m8n GPS with mag chip. I have added the two wires and plugged it to the flexi port of my revo. I have compiled the next branch of gcs and upgraded and ereased my board. After going through the setup wizard I was expecting to see both mags in the settings tab but I only see the on-board mag. I believe all my connections are good and I have power to the gps so it should find the aux mag, right ?
What could be my problem ?
Title: Re: GPS mode stabilization problems
Post by: f5soh on May 15, 2016, 11:18:12 am
You need to power the board with +5V first and next connect the USB.

This allow powering the external Mag chip and I2C initialization.
Title: Re: GPS mode stabilization problems
Post by: milogi on May 15, 2016, 12:42:38 pm
Thx
I will try that later totay :)
Title: Re: GPS mode stabilization problems
Post by: Bill on May 21, 2016, 12:33:36 am
hello hwh,

so, I was in the process of going through the Aux mag orientation, comparing the onboard to the aux.  I watched the video that was posted on what to do.  I decided to setup the gcs in the same way as shown on the video, I split the screen, clicked on the window>edit gadget mode and selected the view I wanted.
the software crashed.  okay.  I waited, disconnected the quad and battery.  restarted gcs, connected the battery then the usb and it no longer can see the aux mag.  I tried multiple times.  let it set for a few days.  Just retried with the same effect.  no aux mag.  I can see both the green light and the flashing blue light on the gps.  I have 10 satellites at the moment, make that 14.  everything is green. 

can you help?
Title: Re: GPS mode stabilization problems
Post by: Bill on May 22, 2016, 05:34:22 pm
You need to power the board with +5V first and next connect the USB.

This allow powering the external Mag chip and I2C initialization.

Hi f5soh,

I have this same issue.  see my previous post.  everything was going along fine, got to the point of having to adjust the aux. mag settings and the gcs crashed.  since then It doesn't see the aux mag no matter what I do.

I am going to reinstall the software to see if that will fix it.

any suggestions?

thanks.
Title: Re: GPS mode stabilization problems
Post by: Bill on May 22, 2016, 05:49:03 pm
okay I fixed it.

I reinstalled the software and it now "see's" the aux. mag.

Title: Re: GPS mode stabilization problems
Post by: milogi on May 22, 2016, 08:51:44 pm
I have been trying to get this setup working as well. In my case I have to go into the firmware tab and press "Halt" and then "Boot" to get the GCS to see the AuxMag. This seems to work every time, so I don't worry about that. My concern is that after calibrating the mags the aux mag is giving me higher % than the onboard mag, but it is more stable and doesn't go into the red with the motors spinning. I have all the wiring twisted and the ublox-neo-m8n on a mast. The hex does fly and maintain position okay. I have to do more tests in less windy conditions. What might be causing the aux mag to be giving out more errors than the onboard on at a stand still with no motors running ?
Title: Re: GPS mode stabilization problems
Post by: Bill on May 22, 2016, 09:03:30 pm
I have now calibrated the aux mag as per the video shown earlier.  It worked really well.  I was then able to calibrate the aux mag with the  onboard mag. 

just did a flight test.  very windy day...  but, it seemed to work well, when I put it into altitude hold it slowly rolls one way or the other and keeps going.  It won't stop unless I stop it. 

I noticed in the video explaining how to calibrate the aux mag that he used a setting of ins13 indoor.  it was in french I believe so I didn't really get why?

now that I have the mags calibrated I'm thinking it's a matter of getting things tuned properly. 

Any suggestions?

thanks!