LibrePilot Forum

Users => Applications - Autonomous Flight => Topic started by: Fireflyer on April 04, 2017, 01:32:40 am

Title: Gps Help
Post by: Fireflyer on April 04, 2017, 01:32:40 am
Hello!
I have a problem. I built a 450mm quad with a Revolution FC, and it flies beautifully in normal attitude and rate flight modes. However, when I try Position Hold, The quad drops several meters, then flies right past the starting altitude, then drops again. At the same time, it oscillates from side to side and forward and back (going right past the starting position) and after about 10 seconds, I Have to switch back to attitude to avoid a crash.
Specs:
-Ripafire F450 frame
-Emax 2213 935Kv motors
-1045 props
-Arris 30A opto simonK escs
-2700 mAh lipo
-Revolution FC (from Banggood... maybe bad baro?)
-OCDAY Neo-m8n gps for dji naza (very cheap; 30$)
I think the problem might be a bad barometer (up and down oscillation), low quality gps receiver, or bad magnetometer (in gps).
Any help would be greatly appreciated.
Thanks!
Title: Re: Gps Help
Post by: Mateusz on April 04, 2017, 05:05:41 am
Did you test altitude hold with Complementary and thrust mode altitude hold/altitude vario ? Check scopes how baro behaves. +-0.5m so 1m from lowest to highest peak is normal noise. If you have like 5m jumps or just not changing line then baro is not doing g the right job. For magnetometer, did you set AuxMag rotation (orientation) correctly in GCS and in scopes both internal mag and external mag behave the same way ?

Title: Re: Gps Help
Post by: startrek66 on April 04, 2017, 08:07:17 am
As Mateusz said to my knowledge the only problem is the barometer. Try the barometer exclusively Altitude hold and in any case already upon examination of the scope you can make the accurate account without flying. If you can, check if on the pcb of the Revolution  is present a dark sponge.

Inviato dal mio SM-G800F utilizzando Tapatalk

Title: Re: Gps Help
Post by: TheOtherCliff on April 04, 2017, 07:38:56 pm
Up and down is barometer.  it must be covered with open cell foam and maybe even shielded from prop blast.  test this with attitude mode with altitude vario thrust mode.  Get this working before trying GPS modes.

side to side is probably a bad mag setup (mag calibration and location, ALL high power wires (battery, PDB, ESC, motor) twisted properly)

I have never seen a working mag that was bad.
Title: Re: Gps Help
Post by: Fireflyer on April 04, 2017, 09:40:11 pm
Thank you for the quick response!
I have tried the altitude hold before and the vertical variation is about 2-3 m; I don't know if that is good or bad. Also, just to clarify, what does it mean to twist power wires? I have not found an explanation for that.  :)
Title: Re: Gps Help
Post by: Fireflyer on April 04, 2017, 09:52:44 pm
Also, there is a pdb running right beneath the revolution, so the internal mag is practically useless under any throttle. But at 0% throttle, the internal and external mags both say the same thing. I will still re-calibrate the mags. The baro has foam covering it, but I think it might be a bad one, as I got the revo very cheaply from banggood.
Title: Re: Gps Help
Post by: TheOtherCliff on April 04, 2017, 10:34:36 pm
Short term (1 second to 30 seconds) vertical variation should be very small, almost not visible, maybe 4cm.  When flying baro altitude (but not GPS) If you have long term (minutes) variation of 1 meter or more you need to do thermal calibration.

Also be aware that you must keep sunlight off the baro chip.  Giving or taking away sunlight will make it move several meters.

If it is oscillating 2-3 meters it is not right.  Either the thrust is blowing on the baro or the foam is too thick.

Look at baro altitude with the scopes when it is sitting on the bench.  Total short term (one second) variation of about 1 meter is OK.  Total variation of 2 meters or more is bad.

Twisting ALL the high current power cables decreases the electromagnet effect.  Without doing that, the compass could be useless when motors are running with a load.  Without compass, the FC can't know what direction the quad is facing.  Without that it thinks it needs to fly north when it really needs to fly south, and it instantly flies away faster and faster (or "toilet bowls" if it is not so bad).
Title: Re: Gps Help
Post by: Mateusz on April 04, 2017, 10:54:41 pm
Thank you for the quick response!
I have tried the altitude hold before and the vertical variation is about 2-3 m; I don't know if that is good or bad. Also, just to clarify, what does it mean to twist power wires? I have not found an explanation for that.  :)

See attached picture, how magnetic field gets "flattened" and redirected. When wires are twisted you get weaker field in the direction perpendicular to wire.
Title: Re: Gps Help
Post by: Fireflyer on April 05, 2017, 08:50:25 pm
Thank you for the quick response!
I have tried the altitude hold before and the vertical variation is about 2-3 m; I don't know if that is good or bad. Also, just to clarify, what does it mean to twist power wires? I have not found an explanation for that.  :)

See attached picture, how magnetic field gets "flattened" and redirected. When wires are twisted you get weaker field in the direction perpendicular to wire.


Sorry, I'm not being clear.
I understand how it works, I just don't know how to do it.
Title: Re: Gps Help
Post by: Fireflyer on April 05, 2017, 09:02:35 pm
Do you mean literally twisting the wires like this?
(See attachment below.)
Title: Re: Gps Help
Post by: Mateusz on April 05, 2017, 09:08:27 pm
Do you mean literally twisting the wires like this?
(See attachment below.)

Exactly :)
Title: Re: Gps Help
Post by: Fireflyer on April 05, 2017, 09:23:09 pm
Thank you!
Title: Re: Gps Help
Post by: Fireflyer on August 19, 2017, 05:02:01 pm
I have done multiple mag calibrations, and PositionHold works better than before, but there are still some oscillations. What is the best way to calibrate the mag? I stand outside well away from cars (and other large metal objects) and have someone else press the "save position" button and tell me which way to orient the quad. However, I am holding it in my hands, so there is some wobble and inaccuracy. Should I use a nonmetal table to help me orient the quad accurately? Is there some better way to do it?
Also, my Revolution does not have any vibration dampening. Do I need it for a good PositionHold?
In the Flight Mode settings, I can set the flight mode to PositionHold, but I can also set the settings bank. If I set this to a more aggressive settings bank, will PositionHold also be more aggressive? If so, how aggressive should I make it?
Title: Re: Gps Help
Post by: TheOtherCliff on August 19, 2017, 05:31:35 pm
Do you have the Attitude -> Magnetometer -> Type (not sure about exact names) set to "aux only"?

Did you know that once you press go for mag calibration that it is constantly gathering data and you must not set it down on the ground or get close to metal from before then to after it is finished?  Also remember to press the Save button at lower right when done.
Title: Re: Gps Help
Post by: Fireflyer on August 19, 2017, 05:38:00 pm
Yes and yes.  :)
Title: Re: Gps Help
Post by: Fireflyer on August 19, 2017, 05:40:42 pm
I have someone else push the "save position" button so that I do not have to set the quad down.
Because it is a continuous operation, could I just start the calibration and spin the quad in every direction (like with ArduCopter) and then skip through the rest of the calibration?
Title: Re: Gps Help
Post by: f5soh on August 19, 2017, 06:27:22 pm
The answer is yes, just cover all the 3D space in "blind mode" while rotating the quad in all directions.
Search for "arducopter dance" in Youtube.
Just skip the 5 steps at start and keep last step for calibration before saving.
Title: Re: Gps Help
Post by: Fireflyer on August 19, 2017, 06:47:36 pm
Thanks!

What about vibration damping and PositionHold Settings Bank (see reply 12)?
Title: Re: Gps Help
Post by: TheOtherCliff on August 20, 2017, 07:06:27 am
I have had quads where a vibration damping FC mount helped and some where it actually hurt and flew better after removing it.

You can adjust GPS flight mode PIDs in VtolPathFollowerSettings.

Normal PIDs in Stabilization page should be as good as possible and not changed from there for any reason.  You can change rotation rates there.
Title: Re: Gps Help
Post by: Fireflyer on August 20, 2017, 04:55:44 pm
I will try to get PositionHold working before tuning it a bit better.

Just wondering, if GPS only has 2-3m accuracy, how can the FC keep a quad from straying more than 1m in PositionHold (like a DJI phantom)?

Also, is there a preferred method of calibrating the mag? That is, should I just do it the normal way or should I do what f5soh suggested?
Title: Re: Gps Help
Post by: TheOtherCliff on August 20, 2017, 05:20:21 pm
I do it the way f5soh said, but whatever is easiest to do correctly.  Easiest may be to follow directions exactly.
Title: Re: Gps Help
Post by: Fireflyer on August 20, 2017, 06:08:40 pm
How does PositionHold keep a quad in one place without straying more than half a meter? I thought GPS only had 2-3m accuracy, but I have seen DJI phantoms and such do it.
Title: Re: Gps Help
Post by: TheOtherCliff on August 20, 2017, 08:37:39 pm
Any brand of FC firmware that does GPS PH can hold very accurate PH for a short time (minutes), but the GPS itself drifts.  On the GCS, watch the GPS wander over the course of an hour when the quad is on the ground in one place.  DJI GPS unit filters it's coordinates for less drift, but it also doesn't respond as quickly as raw GPS coordinates.  By my testing with stock settings for all, DJI NAZA-M FC probably holds a smoother PH in zero wind, but LibrePilot FC can be flown at higher speeds; also in high turbulent wind that would ground a DJI.

The main issue is that over longer time periods, GPS is less accurate than over short time periods.  That is why it is best to capture a home / base location with each battery.  That is why with advanced firmwares (such as LibrePilot) that allow you to store waypoints in a flight plan for use another day, the corridor the waypoint flight flies in must be at least 6 meters wide (2+ meter horizontal deviation) and at least 4 meters off the ground (3+ meter vertical deviation).  These are my own trial and error deviations that I found work.

Vertical PH is greatly helped by the use of a barometer that is accurate to 4cm (all GPS capable FC firmwares and hardwares), but baro altitude of one day doesn't work the next day when a storm front approaches and the local barometer has changed a lot.