Lowest flyable PID and problems with tuning

This is a neat feature I also didn’t know about ;), but at the moment I can’t get the craft in the air at all, without risking major damage. That’s why I found the idea CrashCup proposed (using a knob on the controller to vary the values) sensible, because it should allow me to start with a very low PID, lets me increase it rapidly if necessary and find a good upper boundary.

P applies an output proportional to the error.
Think of a teeter totter fulcrum. If it’s placed exactly in the middle of the teeter totter, if you press one side down it raises the other side exactly the same amount.
But now move the fulcrum 25% more and pressing one side down raises the other side twice as much.
One side represents the error and the other is the output. P let’s you choose the amount of action (servo) to a given error. Too much P and it slams that output too much. Your yaws can be wild. Start tuning by reducing P.
The effect of P on an output is immediate. It doesn’t keep changing the output. But using I does.

I allows you to incrementally move the output closer to the setpoint if it doesn’t get there over time. The larger the I the more often over time it applies a correction to close the error.

D is activated by noise or sudden upsets. It sort of throttles the I effect. Sudden spikes can get cancelled out by using D. It keeps the output from jittering like crazy. Start tuning with it real low.

Great, thank you for that handy summary! I read the Wikipedia article on this topic, but it seems I got some things wrong. In that case, I can disregard I and D for now and focus on getting a proper P value. That’s something to work with.

I think there may be a little struggle with this build because the rear motors are running from a different voltage from the main motors, so the motor voltage thrust scaling may be a bit inappropriate for the rear motors. This may only be a problem at the end of a mission where the main battery is fairly depleted but the rear battery is not, and the VTOL is going to land. OR it might not be a big issue at all - just something I thought of.

That rear motors will also have a different thrust expo, but maybe this wont be a big issue either, and is probably typical of a VTOL.

Just looking at the non-autotune log…
ARMING_CHECK,1
Essential!

What are all the ESCs? In the video there are ESCs visible that are clearly not T-Motor Alphas or Flames.
You might need to find a happy medium for the thrust expo given you’ve got different sized props.
Q_M_THST_EXPO,0.2 might be better at 0.6 or so
but let us know the ESC details and prop sizes first.

I’m not decided on making any PID recommendations yet - I’m not normally a VTOL or Plane person.
The working Nimbus VTOLs I’ve seen have vastly different values than what you are starting with.
Also I notice they didnt have the Q_MOT_BAT values set (for thrust scaling) but this could just be an oversight.
Usually something like this, but maybe dont jump straight to using these without careful consideration.

Q_A_ANG_PIT_P,6
Q_A_ANG_RLL_P,4.5
Q_A_ANG_YAW_P,3
Q_A_RAT_PIT_D,0.015
Q_A_RAT_PIT_I,0.4
Q_A_RAT_PIT_P,0.25
Q_A_RAT_RLL_D,0.015
Q_A_RAT_RLL_I,0.25
Q_A_RAT_RLL_P,0.25
Q_A_RAT_YAW_D,0.01
Q_A_RAT_YAW_I,0.05
Q_A_RAT_YAW_P,1
Q_M_THST_EXPO,0.65

Yes, you are right, the thrust scaling is a bit off. We noticed this issue in earlier iterations of the design. However, we concluded that it is a fine-tuning problem and decided to focus on the PID tuning to get this aircraft in the air. For basic flyability, a good(ish) PID should be sufficient - at least, that’s what I think, because we got it flying stably with a similar motor configuration in Autotune some time ago. But, of course, a proper scaling value is key to getting a good response, even from a aircraft with well-tuned PID.

Until now, I have not noticed any change in behavior during flight. We did have a problem with the dual battery system, but it originated from us installing only one PDB and thus only monitoring the front batteries (the bigger ones at the time), which led to the rear motors dying on us at 30m and resulting in the dumbest, most avoidable, and most expensive crash. :see_no_evil: :sweat_smile:

Regarding the specs: The front motors drive 22" props and are controlled by 80A Flame ESCs (I included this information in the initial setup parameters). The rear ones are also powered by T-Motor ESCs, but they are standard 55A UBEC ones, and drive 7" props.

Lowering the thrust expo is a good suggestion. I have noticed that the throttle response is quite sensitive when the drone is lighter.

Hi Y’all!

I think its about time that I give the promised update. There were a lot of good suggestions here, but the main problem was elsewhere. First of all, the initial Setup-Tab did not do what it was supposed to. Seemingly, after restarting the FC none of the supposedly saved parameters persisted. The solution was to put in all the parameters ourselves. So xfacta was totally right with these

(At least with the non PID related params)
This probably solved a bunch of underlying issues.
Refer to this page with similar issues
https://ardupilot.org/copter/docs/setting-up-for-tuning.html

The main problem though, was the PID (suprise surprise). The documentation (Initial Tuning Flight — Copter documentation) states that you should lower the P,I&D terms when oscillations occur. Then I figured,we have a big plane, oscillations will be solower and consequently lowered the terms during manual tuning. If I would have looked a bit deeper than the ArduPilot documentation I would have quickly found out that oscillations actually means oscillations (very small, fast movements) upon reaching the desired position. What we had, and believed to be a sign of overcorrection, was actually a far too low P and thus the P-I and P-D ratios were off as well.

Starting Point for me was this video

Now, we got a proper tune which would be

Setup
Q_FRAME_CLASS = 1
Q_FRAME_TYPE = 1
Q_TILT_ENABLE = 1
Q_TILT_MASK = 5 = Motor 1 & Motor 3 in Bitmask
Q_TILT_TYPE = 2
Q_TILT_MAX = 30 (subject to change)
Q_TILT_FIX_ANGLE = 25
Q_TILT_RATE_UP = 15
Q_TILT_RATE_DN = 30
Q_ASSIST_SPEED = 20
ARSPD_FBW_MIN = 20

Advanced
Q_M_THST_HOVER = 0,5
Q_M_THST_EXPO = 0,65
Pitch Rate P = 0,35
Pitch Rate I = 0,25
Pitch Rate D = 0,005
Autotune Achsen: Pitch = 2
Autotune Aggr = 0,05

I’d like to take a moment and tell my understanding of PID which ultimately brought me to tune the craft properly:

  • The P gets bigger the greater the error is and helps correct an error by measuring its size and thus changing the motor speeds (or whatever you control) by an amount proportional to the size of the error.
  • The I term gets bigger with time. The longer the error exists, the bigger the correcting input of the controller gets.
  • The D term can basically be ignored as long as the craft is not flying properly. If you have tiny oscillations but everything else is working properly, then you can increase D. Keep it very low until then.

If your vehicle has slow oscillations, increase P until they are gone or fast, and then use D to dampen the rest. Otherwise, with fast oscillations, decrease P or increase I until they are smoothed out.
As far as I know, the absolute values of the term dont matter as much as the size relative to one another.

Just to make things clear:

This Video shows the initial tune with P = 0.25, I = 0.25, D = 0.0036

Here we tried to improve the situation by reducing all terms by 50% (wrong!) P = 0.125, I = 0.125, D = 0.0018

And here we did do some research and increased the terms to P = 0.35, I = 0.25, D = 0.005 wich made a great deal of difference

I hope i can help some people that have the same trouble we’ve been through but wanted to at least give an update.

Kind Regards!

1 Like

Nice write up - I encountered similar challenges in tuning a large (~14kg) VTOL, where I interpreted big swings as “oscillations” (as described by the documentation) but found lowering gains only made things worse. I actually needed to raise gains, which helped a lot. I also found benefit in setting I lower than P, similar to you, which I believe is required due to the inertia of larger aircraft.

1 Like

Oh, wow! This sounds very similar. Without payload our vehicle also ways in at 14kg and I mistook the tuning instructions too which made things even more wobbly and worse. Did you find a good page with a step by step instruction for PID-Tuning all kinds of vehicles? Because there is a lot of input from the FPV Community, but these guys usually have the luxury of using four identical motors and props. Besides this video and some stuff on wikipedia, I did not find a general guide.

Great feedback for everyone - thanks.
Good work with the PIDs. Unfortunately there’s no sound in those videos so we miss out on all the clapping and cheering that would have taken place in that last video :slight_smile:

It would be interesting to see what the VTOL Quicktune script would have done if there was stable enough flight.

The Initial Parameters section in MissionPlanner only works for ordinary copters, not VTOLs with the Q_ parameters.

Unfortunately I didn’t find any good instructions for tuning larger vehicles specifically. I did find that SITL with RealFlight was a good tool to experiment with the effects of VTOL tuning and it helped me to recognize some behaviors I was seeing