Re: GPS drop and Mag drift
« Reply #30 on: December 06, 2020, 09:46:14 pm »
On the Vehicle page is your Vehicle a Custom or a FixedWing or a MultiRotor?  I had assumed that you are using MultiRotor, or if using Custom that VtolPF->TreatCustomCraftAs is set to MultiRotor.

I would get it hovering well first.  That probably means you should use MultiRotor.  I think that your slow oscillations can be tuned out by then adjusting the VtolPFS PIDs.  @Karla says to drastically reduce VtolPathFollowerSettings->HorizontalPosP
https://forum.librepilot.org/index.php?topic=3999.msg32548;topicseen#msg32548

He reduced it by like a factor of 7 or so (.25 to .035) and that sounds drastic to me, so I think that looking into the other PIDs there (VelocityRoamHorizontalVelPID for VR) is warranted.

trust

  • ****
  • 261
Re: GPS drop and Mag drift
« Reply #31 on: December 07, 2020, 01:48:35 am »
I am using Custom aircraft type VTOL.
I have both yaw on the motors and elevons move to effect yaw. They effectively sum power in yaw.
I tried cutting the HorizontalPosP .25 value down to 0.035, and cut the VelocityRoamHorizontalVelPID  Kp value in 1/2 to 6 m/s

I tried a test in poor conditions, bit windy and turbulent. But I had it hovering in place somewhat.
As soon as I flipped it to VR mode, it flipped over and crashed.

trust

  • ****
  • 261
Re: GPS drop and Mag drift
« Reply #32 on: December 08, 2020, 10:52:12 pm »
I'm going to try cutting the 4 VR Pid values to 20% of their default values. What is beta?
Do the VtolPathFollower settings (besides the ones above) affect Velocity Roam? Or are they only for waypoints?

Re: GPS drop and Mag drift
« Reply #33 on: December 09, 2020, 06:30:49 am »
Beta.  Really stretching my memory here.  :)

Executive summary:  Don't bother to mess with it.  It is only a stick feel / flight smoothness thing, not a stability thing (unless you need help keeping your stick motions smooth to avoid problems with a marginally stable aircraft ;) ).

There are several forms of PIDs.  We use two for historical reasons shall I say...  This form of PID has a setpoint weight called beta.  Setpoint is like "my throttle stick is at 70%" vs. 60 or 80 which says it is calling for a multirotor climb at say 1 meter per second instead of 0 or 2 (yes GPS mode throttle stick from 40 to 60 is zero, for the deadband).

Beta is usually less than 1.0 and is a multiplicative factor, so 1.0 is basically 100%

If it is set to zero, then when you change the climb rate suddenly it ignores your P setting and only responds slowly, as the I term determines over time that the climb rate is wrong and winds up to adjust it.  Note though that if the environment changes the climb rate (imagine a sudden downdraft) that it responds with both the P and I terms.  As you can see with it almost 1.0, it has very little of this effect.

Now I will try to imagine a use for it.  I have VtolPFS velocities set above stock and I notice that when I try to start slowly from a fixed hover, that it jumps into forward flight fairly hard.  If I adjusted my HorizontalVel PID Beta to a lower value, I imagine it would be smoother.

trust

  • ****
  • 261
Re: GPS drop and Mag drift
« Reply #34 on: December 09, 2020, 08:34:08 am »
Under VtolPathFollowerSettings are HorizontalVelMax VerticalVelMax CourseFeedForward HorizontalPosP VerticalPosP then HorizontalVelPID - also with 4 parms Kp Ki Kd and Beta.
Do these affect VR mode or are the only related to Path Follow mode?

Re: GPS drop and Mag drift
« Reply #35 on: December 09, 2020, 08:57:42 am »
My guess without combing the code is that the generic PIDs affect any generic GPS flight mode.  The ones with a GPS flight mode as part of their name are specific to that flight mode.  If I were going to be playing with PIDs anyway, I would find it just as easy to flight test for as to grok from the code.  Just cut any P in half to see if that PID is active in that flight mode.

trust

  • ****
  • 261
Re: GPS drop and Mag drift
« Reply #36 on: December 11, 2020, 04:59:32 am »
I turned the VR mode PID values to 20% of their defaults, left Beta alone.
Tested in light winds - climbed to 30 feet, hovered, switched to VR mode. It began to rock side to side (vehicle facing south, east west roll, lite wind <4 from north), did about 3 full cycles with amplitude increasing to 20 degrees of roll (from saved video OSD data), before I stopped it.
After landing, I switched batteries and tried again. For some reason the mag would not allow arming - mag alarm on the OSD. Unplugged and replugged twice, GPS was working fine 13-15 sats - so I know mag was getting power. Took it home, tried again in the house later, it worked fine. As we say, more mystery meat.