PID setup with low P
« on: December 25, 2019, 10:06:36 pm »
The planes I fly have a very broad speed range, and therefore need much more deflection and higher PID settings at lower speeds.  For the most part I'm flying in the same area, just at varied speeds.  My problem arises when the speed starts increasing, and P is low enough to help but not oscillate, I start losing elevator authority.  To combat this, as well as deal with the rapid pitch rates needed with very aggressive turns, I've turned the max rate up to 1440 deg/s.  This rate isn't far off from what the plane is actually pitching at to make the turn, so I'm comfortable with it set there.  At the higher speeds and in these turns is when I start seeing the reduction of authority.  Is there another setting that I need to be looking at to get this working correctly?

Additionally, I like to run triple rates on elevator and aileron and use them independently.  Is there any reason that this wouldn't work well with the setup as I just described?  Thanks in advance.

utoedter

  • ***
  • 168
    • Frickeln und mehr
Re: PID setup with low P
« Reply #1 on: December 25, 2019, 10:33:08 pm »
Search the documentation for thrust PID scaling, it may help.


Gesendet von iPhone mit Tapatalk Pro

Re: PID setup with low P
« Reply #2 on: December 26, 2019, 03:48:11 am »
You can climb slowly at high throttle or dive quickly at low throttle, so thrust PID scaling isn't the ideal solution.  :)  :(

The ideal solution uses an airspeed sensor (or GPS to synthesize airspeed from groundspeed) and has you enabling StabilizationSettings -> ScaleToAirspeed(*).  This adjusts PIDs based on airspeed as you fly.  Here is a thread where it was discussed.
https://forum.librepilot.org/index.php?topic=4411.msg30041;topicseen#msg30041

and a forum search for that term
https://forum.librepilot.org/index.php?action=search2;params=eJwtjsEKgzAQRP-ll17m4K6xxq-RmCxoSY0ktqWQj-8q3mYew2Nc-LjVS6j3SvVWp3wmMFoYdHigh8UAakAEYlALMqAOZEEDuAHrmsEt2IB7sFVNmdN39Om1RdnlUpf39BS_j2mNP0UHSXkfw5K1BSn-ItqyRDlvHUhc9rPC4p3aklty2UTCH8wmPMA.

Re: PID setup with low P
« Reply #3 on: December 26, 2019, 04:13:22 am »
Thanks for the reply.  My planes have no motors.  I do have an airspeed sensor installed that will scale PIDs.  The problem is that I'm losing elevator authority when the P (due to scaling or me dialing it down with TxPID) gets low and I'm going fast.
« Last Edit: December 26, 2019, 04:48:28 am by ufoDziner »

Re: PID setup with low P
« Reply #4 on: December 26, 2019, 05:50:14 pm »
Correctly configured/managed PIDs don't actually change the amount of throw at a given speed.  Rotation rate setup ("Rate Mode Response") does though.  So this first statement is only about your rotation rate setup.  As an example about Rate mode:  You may have your pitch rate set to 360 degrees per second, that means that it will do a loop in one second at full up elevator...  When flying very slowly, your one second loop will be very small.  When flying very fast, your one second loop will be very large and thus you will be getting much less elevator throw.

One issue with high speed is that the servo must push a lot harder to move the surface and either the servo can stall or the control linkage can flex, so you should test it in Manual mode.  If you get reduced throw in Manual mode at high speed, then fix your servo / linkage.

System -> Settings -> StabilizationSettings -> ScaleToAirspeed is the right way to adjust PIDs according to airspeed.  :)  But you must use a Revo class FC.  CC3D doesn't do this.  Information: "Next" has some new F3 based FC's in it and there is at least one developer branch that has some new F4 FC's in it.  I would guess that any FC that has more memory than the CC3D, is coded to do ScaleToAirspeed.
« Last Edit: December 26, 2019, 06:02:27 pm by TheOtherCliff »

Re: PID setup with low P
« Reply #5 on: December 26, 2019, 06:00:43 pm »
Thanks for the reply.  I have the rate for pitch set to 1440 deg/s (the max setting is 2000 deg/s) so that I don't have any reductions based on that setting.  I'll  record a video of the throw decreasing as P is lowered way down (low enough to stop the oscillations at high speed).  There is no reduction of authority in manual mode.  This is one of the indicators that helped me figure out that it's the low P causing the issue.

Re: PID setup with low P
« Reply #6 on: December 26, 2019, 06:08:57 pm »
Generally you want to change the whole PID, not just P.  Are your I and D terms set to zero?

I generally recommend that you start with default PIDs and for instance if you need to reduce them, you divide each number by say 2 so you reduce P, I, and D.  In your case, I don't know how well the defaults will work, so you may just need to start from scratch.  Something like zero I and D, increase P till oscillation, cut P in half.  Increase I till oscillation, then reduce to remove oscillation.  You can leave D set to zero.  D is a somewhat complex topic.

Is this a dynamic soarer?  :)
« Last Edit: December 26, 2019, 06:27:44 pm by TheOtherCliff »

Re: PID setup with low P
« Reply #7 on: December 26, 2019, 06:31:10 pm »
To make it clear:  Fixed wing PID oscillation at high speed is a real issue that cannot be fixed just by setting correct PIDs.  The PIDs need to change automatically during flight when airspeed changes.  The way to set that up is to use ScaleToAirspeed.

"Then how does it work if we are not using this?"  You use compromise PIDs.  Generally you set the PIDs has high as you can without oscillation at the highest speed you will fly.
« Last Edit: December 26, 2019, 07:02:44 pm by TheOtherCliff »

Re: PID setup with low P
« Reply #8 on: December 26, 2019, 06:56:39 pm »
Thanks again for the reply.  I started with the defaults, but they were much too high.  The I and D are not 0, but are very low, as I was just trying to get the P term set.  Yep, I have a number of DS planes setup with LP  :-) .  Just trying to get them all tuned up now.  It seems that the transition through the shear is very tough for the FC to deal with.

I've taken a short video.  The setup is as follows:
  • Transmitter is Mode 2
  • Throttle is connected to Thrust PID Scaling for demonstration purposes
  • Dial above the right stick is TxPID Pitch Rate.Kp
  • Integral set to 0.00150 and Derivative is 0.000333

You can clearly see the throw reduction when I either dial down the P via TxPID, or use the Scaling away from the current Max (0.00100).  Let me know if you have any further thoughts.
Video:

Re: PID setup with low P
« Reply #9 on: December 26, 2019, 07:14:49 pm »
Have you tried ScaleToAirspeed?  It does require Revo class FC, but $35 shouldn't hurt too bad if you are playing with DS.  :)

Look at the thread I posted a while back.  He had bad oscillation at high speed and after using ScaleToAirspeed it was perfect at high and low speeds.

Steps:
- Install / modlfy / configure some kind of airspeed sensor that can handle the whole range of speed.  This can be as simple as using the GPS calculated airspeed (probably not in your case) or an analog airspeed sensor that goes high enough for you.
- Set ScaleToAirspeed to some middle range airspeed.
- THEN: Tune the PID at any speed.
- Test the PID at all speeds.

Re: PID setup with low P
« Reply #10 on: December 26, 2019, 07:35:16 pm »
Remember that (without an I limit) the I term alone will add more and more throw until it sees the airframe respond or the servo is maxed out, so I wonder if you effectively have no I term.  With any close to reasonable PID (say a factor of 2 in either direction) and no I limit, any amount of stick will cause the surface to max out, slow for small stick, quickly for large stick.

The default I limit is 0.3  I believe that means the I term windup is limited to +-30% of travel.

P is proportional to error and without I, then yes, reducing P will reduce throw, but watching what the surface does on the ground isn't the way to set it up.  :)  Also, even setting the P to almost zero the I term by default can wind up to 30% so you may even be seeing the I term.

Re: PID setup with low P
« Reply #11 on: December 26, 2019, 08:04:08 pm »
Thanks for the replies.  I'll try messing with the I term next time out.

Yeah, I realize that watching the control on the ground is not a "good" representation of what will happen in the air, but in this case it's pretty dang close.  I KNOW I'm losing pitch authority in the air.  I only investigated this on the ground because I found it in the air first.

I have 2 models that have analog airspeed in and are scaling (most of the models have revolution minis).  There is a definite loss of authority with them.  So, it's happening in the air as represented on the ground.  I'll see if higher I term can help.  On my 3D foamy, the I term is crazy high comparatively speaking, so maybe this needs the same.

Re: PID setup with low P
« Reply #12 on: December 26, 2019, 08:10:38 pm »
Here is a pic of one with airspeed.


Re: PID setup with low P
« Reply #13 on: December 29, 2019, 01:34:47 am »
Sensor limitations is another issue.  For instance, the accel sensors in the compatible FC's have several range settings and the highest level only goes up to 16G's.  Auto leveling modes use the accels, but Rate mode (in general, non auto-leveiing modes) does not.

An area you may want to research is how many G's the gyro sensor (used in ALL flight modes) can take.  I know that unbalanced props can make the gyros go crazy.

You still haven't discussed the suggested ScaleToAirspeed or whether you are using CC3D.

Re: PID setup with low P
« Reply #14 on: December 29, 2019, 03:23:14 am »
In post #11 I stated "I have 2 models that have analog airspeed in and are scaling (most of the models have revolution minis)."  I can see how that might have not been clear enough.  I'm using a C C 3 D Revolution mini in this model with ScaleToAirspeed.
« Last Edit: December 29, 2019, 03:27:50 am by ufoDziner »