trim of alt. hold/gps hold
« on: June 28, 2017, 08:56:12 am »
Hello all

Thanks to this fantastic forum I now have a GPS enabled quad (F450) which actually fly ok. BUT not fantastic...

All alarms green 100% of flight. GPS hold works +/- 0,5 meter to the sides with slow movements. But sometimes it begins to have some oscillations up and down getting bigger and bigger. I have tried to adjust a bit (70 +/- 5-10) up and down on "Altitude Proportional" but the problem doesn't really seem to go away. Also I experienced a small crash last night when it was in GPS Hold and I turned it around (Yaw stick). It more or less fell out of the sky (a BIG thanks to cliff for his advice with double stick tape to hold GPS/ext. mag - saved me a new pole and some potential damage to the quad).

My own theory: I have some adjustment to do in altitude hold. When the quad fell out of the sky it also had something to do with the altitude regulation. Yaw slows down 2 of the motors causing it to fall and the altitude regulation is not fast enough to catch it... I think  :) But I need some guidance on where to start.

Also when I just fly "stabilised" without Alt. Hold or GPS Hold the quad hovers fine but constantly have very small tilts/jitters (the same is of cause the case with GPS Hold) - any connection?

Re: trim of alt. hold/gps hold
« Reply #1 on: June 28, 2017, 09:12:47 am »
If you used AutoTune to set the PIDs, sometimes it makes D term too high and you get tiny high speed oscillations.  I sometimes set up a smoothquick knob and move it closer to smooth.  Also there is a SystemIdentSettings setting called DerivativeFactor.  Try setting that to 0.5 and reexporting the new PIDs.
https://librepilot.atlassian.net/wiki/display/LPDOC/AutoTune

I have very good results from AltitudeHold/Vario, but I spent some time tuning my baro with ZN method.

You mentioned an oscillation.  If you are using a DJI/Naza GPS, there is known issue because these GPSs smooth the data more than simple uBlox GPS does.  The issue causes a growing east-west oscillation.  Here is some 1609 firmware with a fix I coded for that.
https://forum.librepilot.org/index.php?topic=3012.msg21154#msg21154

Re: trim of alt. hold/gps hold
« Reply #2 on: June 28, 2017, 09:35:49 am »
thanks

My GPS is a Ublox M8N. I think the problem is with the baro or the alt. tuning. On my next flight I'll try getting a baro graph and an altitude graph to see the actual values. I think that would give me an idea if its something physical or some math that gives problems.

What do you think about the issue where it fell from the sky when I used the yaw stick?

Mateusz

  • *
  • 808
Re: trim of alt. hold/gps hold
« Reply #3 on: June 28, 2017, 10:04:16 am »
What do you think about the issue where it fell from the sky when I used the yaw stick?

What LP version are you using ? Can you post UAV config so devs can look at it ? Config file usually answers a lot of question what features are enabled/used.
Oscillations might not be related, unless they're side effect of something more serious. Would be good to record telemetry, system alarms, I2C state, GPS state and whatever you might think is useful. What modules are enabled ? I don't think it would really drop out of the sky and free-fall even if PIDs are off, unless one sensor stops giving valid samples (i.e disconnects/loses power/loses signal).

You mentioned an oscillation.  If you are using a DJI/Naza GPS, there is known issue because these GPSs smooth the data more than simple uBlox GPS does.  The issue causes a growing east-west oscillation.  Here is some 1609 firmware with a fix I coded for that.
https://forum.librepilot.org/index.php?topic=3012.msg21154#msg21154

Hi Cliff, would be great to make a PR for review and get it into next or have a JIRA for it, unless there is one already ?


Re: trim of alt. hold/gps hold
« Reply #4 on: June 28, 2017, 10:11:39 am »
Here's my UAV config.

How do I record telemetry? I guess you don't mean a video of my screen :)

f5soh

  • *****
  • 4572
    • LibrePilot
Re: trim of alt. hold/gps hold
« Reply #5 on: June 28, 2017, 11:51:24 am »
- Rate mode response (Yaw) is increased from 220 to 300deg/s
- negative expo for Yaw axis
- Yaw PID are very high

All the above give a very reactive / too sensitive Yaw axis

Re: trim of alt. hold/gps hold
« Reply #6 on: June 28, 2017, 03:42:39 pm »
Hi Cliff, would be great to make a PR for review and get it into next or have a JIRA for it, unless there is one already ?

I just posted the following at the end of that forum thread.

I do wonder if this (firmware change) is the best way to fix this problem.  The fix doesn't seem to be needed for at least some versions of DJI/Naza GPS clone, so some testing needs to be done to see if it hurts those versions.  Or we could put a switch in the UAVO to turn it on/off.  There doesn't seem to be a way to detect whether the GPS is authentic or clone.

Also, it would seem that this is a simple delay that could be fixed by adjusting some PID, yet I haven't been very successful adjusting VTOLPF horizontal PIDs in place of using this code fix.  Maybe there is even an interaction between horizontal and vertical PIDs.

Also, it is possible that this GPS has an issue such that when you just tilt it, it reports a different location even though you didn't move it horizontally.  This seems unlikely though because you can recreate the issue or a similar one with a Ublox GPS set to Pedestrian.  Also, I forget whether the Ublox recreation is just east west.  I suspect it is not, and thus may not be the same issue.

I remember doing experiments to mount a GPS higher to make sure it is not a local electro-magnetic field affect where the extra field causes a request for attitude change that makes that motor work harder that makes the field stronger... and finally reverses making the field change weaker and weaker as the motor is slower and slower.  This needs to be recreated/retested.

Re: trim of alt. hold/gps hold
« Reply #7 on: July 14, 2017, 10:39:28 pm »
Ok. I worked with the Yaw trim and I think my problems was due to too aggresive PIDs. Now I see another potential problem: When in Position Hold its very stable - but when I gently turn around the Yaw axis the quad moves 3-4 meters to one side. Not fast or out of control - gently but quite a distance. When moved to the new position it stays there.

Could it be something with the compasses (both on board and ext. compass enabled)? All alarms green during flight.

Re: trim of alt. hold/gps hold
« Reply #8 on: July 15, 2017, 12:27:04 am »
It's a good idea to re-adjust "rotate virtual" after switching to INS13.  Adjust it so that hover doesn't drift in INS13 Attitude mode.

Also, disable "pirouette compensation" in Stabilization (Bank#) -> Expert