Does Arpupilot use Anti-Windup in PID loops - Does PX4?

Hi, does anyone know if ArduPilot uses Anti-Windup algorithms in their PID loops? The Motor signals in my vehicle are switching off and on shortly after the motors hit their limits. Here is a link that discusses the phenomena and typical Anti-Windup solutions:

Does anyone know if PX4 works any better? Thanks. For more details on my problem see:

Yes, Ardupilot does, and PX4 most certainly does too.

1 Like

Can you explain why my motor signals are switching off an on shortly after the motors hit their limits? This is usually due to Windup behavior of the PID loops, and should be fixed with proper Anti-Windup algorithms. Reference the end of the above project discussion link to see the motor signals switching off and on after they hit their limits.

Your copter is underpowered, you should fix that. There is no headroom for maneuvering if the motors saturate. This is an hardware issue. Fix that first.

Your avoiding the question. Motors can hit their max limit in extreme maneuvers in any drone and this behavior I am observing would cause a done to crash. It is not desirable behavior in a PID loop. If it is the PID loop algorithm then it needs to be fixed.

Transport type drones typically hover at 70% throttle, which is what mine is hovering at. This is acceptable if the drone just uses VTOL to take off and land and then quickly transition to forward flight. Ref following VTOL expert discussion 11.33min into following video:

If you have a VTOL, you posted in the wrong section.
If you have a copter, hovering at 70% is just bad and wrong

The question pertains to any type of drone, so this is a valid area to discuss it.

If the motors saturate during hover, you have a design problem.

You can easily determine whether the integrator is winding up by examining its value in the log. However, I don’t think anti-windup will fix your root cause issue.

Hi Yuri,
Here is the front motor signal. When the Motor hits its limits at the end, the Integrator winds up and then the motor signal starts turning off and on uncontrollably causing the vehicle to crash.

The vehicle is going through a radical maneuver when the motor rails here, which will normally not be the case when the vehicle is properly operated, but unfortunately cant be avoided during the learning phase. My concern is that the PID loop should not be behaving this way with proper Aiti-Windup algorithms implemented. My question if this behavior is due to the PID loop or something else. If so, can this behavior be fixed? Perhaps I could try PX4 instead of Ardupilot and see if the PID loops behave differently.

@William_Walker I saw the link to your other thread and looked through it. I currently can review your logs as I am away from home. So I can’t see what your parameters are. To answer your question regarding how ardupilot manages the integrator, it is done through integrator limits and motor limit flags that stop integrator windup when the motor reaches a limit or max control request. In your case I am not sure why it is not limiting the integrator as it reaches the motor limit. It may be that it limits integrator for a max control request. It would take a little digging into your logs and looking at parameters. However seeing the values that your integrator is achieving tells me that you have a very large value for ATC_RAT_PIT_IMAX. I think I read in your other thread that this vehicle has a pretty big CG offset which I am assuming is driving the large integrator values.
I will close by saying that I am a helicopter guy and have a descent knowledge of the flight control code but don’t play with tuning multicopters or Quadplanes. Good luck with your issue.

1 Like

Hi Bill, Thanks for the interesting suggestion. The Pitch I_Max parameter is set 1.0, and both I and P are 1.0 in our setup. Based on what you see in the above motor signal plot what should I_Max be set to?

By the way, here are our parameters:
IeqP.param (22.2 KB)

and here is a link to our log file of the test posted above:


Something is not right. It is showing the integrator (PIDP.I) exceeding ATC_RAT_PIT_IMAX. @Leonardthall why is the integrator being allowed to exceed the IMAX value

The other thing I noticed is that you have the time to 63% steady state attitude (ATC_INPUT_TC) as 0.2 and the max accels set for vehicles that are more nimble than what I expect your vehicle to be given its size. So you have a rate P gain that is really large and a rate D gain that is disproportionately small. From looking at your set up, IMHO I believe you are over driving the response. The shaping of the desired response is done through the input_tc and max accels and max rates. The input_tc is probably the most important as it adjusts the requested rates and accelerations according to the requested attitude. I would make this more like 0.3 seconds. So the only other thing I would think could be an issue is that you don’t have enough control power which also can cause high rate P values.

These are my thoughts based on only looking at your parameters and the size of your vehicle. Hopefully Leonard can chime in as to why the integrator is not being limited per the IMAX value.

Hi Bill, Thank you for your insight and suggestions.

Can you explain a bit more by what you mean by “Over driving the response”?

What values do you suggest for Accel_P_Max and Rate_P_Max?


Overdriving the response is just saying that the control feed back in response to the rate error is very large. Mainly due to the high rate P gain. The aircraft cant respond quick enough and you will get this behavior where the motor alternates between max and min.

At a minimum, accel P max should be specified based on your aircraft design. You need to estimate what max acceleration is possible based on your aircraft inertia and moment the thrusting motors can produce. You can estimate it from flight by looking at the actual angular rate versus the target angular rate. If the actual change in angular rate (angular acceleration) can’t keep up with the target then you will want to lower the max accel. Max rates are harder to judge. You really need to do full control input roll or pitch rates to see what is the max attainable rate.

Obligatory reminder to update, 4.2 is the latest stable release.

PIDP are the plane gains, PIQP are the “copter” ones.

1 Like

Here is PIQP_I

So then Peter, what do you think is causing my motor signals to turn off and on after the motor signals hit their limit?