# what are imax and imin in pid

I was trying to use the pid controller of the control toolbox ros package in my hardware interface of diff drive controller. Here when i was studing this api i didn't got what imax and imin means and what it does. What i'm trying to do it use this in the hardware interface of the diff drive robot i'm making where their is presence of velocity feedback sensors like wheel encoders which is sending the actual angular velocity and use this to calculate the velocity differnece i.e error and send appropirate pwm singnals to the motor.

edit retag close merge delete

Sort by » oldest newest most voted

As noted in the link you posted:

i_max   The max integral windup.
i_min   The min integral windup.


, this is the cap for integrator windup. These limits prevent the system from generating huge values in the I term of the PID, which can take an excessive amount of time to "unwind", leading to oscillating and poor control of the system.

If you're not familiar with how PID control works, then the concept will be hard to get from this forum and I suggest searching for an online simulator, but having a windup limiter allows you to set your I term high enough to get good response (when it's required) but provides a means to mitigate the oscillation risk created by an unrestricted integrator that is free to accumulate unlimited error history.

A motor circuit for driving a robot should not really need such a feature once well tuned except in extreme situations, so in your case the limits will assist you keeping the robot under control while you are tuning, but unlikely will have an impact beyond that.

EXAMPLE OF INTEGRATOR WIND UP: Lets say you have a robot working on an un-even surface. ROS sends the robot on a path that is up-hill and the robot is commanded to move at a speed it is not physically able to up the hill. There will be a static error, "too slow", in the velocity target vs actual and every iteration of the PID loop, the integrator will take the error, "too slow", from the most recent PID loop and add it to the accumulated error history, and the error history will get huge = 10000 * "too slow". Once the robot summits the peak and is on flat ground it will speed up, but not just to the commanded speed, but to much faster than the commanded speed, because of the huge accumulation of error history in the integrator. The (I* integrator) term of the PID is large due to the error history. With the robot now moving much faster than commanded, the error history in the integrator will start to get smaller as the error is now "too fast" instead of "too slow". But if there was 10 seconds of "too slow" saved into the integrator, there could now be 10 seconds of "too fast" required to unwind it. Your robot is out-of-control because of integrator windup.

PURPOSE OF LIMIT ON WINDUP: At some point the integrator will become large enough that the (I*integrator) term will saturate the output of the controls. There is no value to having the integrator getting larger than that. Larger than that cannot help control the system and leads to the unwinding issue from our robot example. So a good PID implementation will implement a max/min value to cap the integrator to limit the amount of "too slow" that can be stored. It means that at the top of the hill, only a short period of "too fast" is required to unwind the ...

more