1
$\begingroup$

Question: A PID controller has three parameters Kp, Ki and Kd which could affect the output performance. A differential driving robot is controlled by a PID controller. The heading information is sensed by a compass sensor. The moving forward speed is kept constant. The PID controller is able to control the heading information to follow a given direction. Explain the outcome on the differential driving robot performance when the three parameters are increased individually.

This is a question that has come up in a past paper but most likely won't show up this year but it still worries me. It's the only question that has me thinking for quite some time. I'd love an answer in simple terms. Most stuff i've read on the internet don't make much sense to me as it goes heavy into the detail and off topic for my case.

My take on this:

I know that the proportional term, Kp, is entirely based on the error and that, let's say, double the error would mean doubling Kp (applying proportional force). This therefore implies that increasing Kp is a result of the robot heading in the wrong direction so Kp is increased to ensure the robot goes on the right direction or at least tries to reduce the error as time passes so an increase in Kp would affect the robot in such a way to adjust the heading of the robot so it stays on the right path.

The derivative term, Kd, is based on the rate of change of the error so an increase in Kd implies that the rate of change of error has increased over time so double the error would result in double the force. An increase by double the change in the robot's heading would take place if the robot's heading is doubled in error from the previous feedback result. Kd causes the robot to react faster as the error increases.

An increase in the integral term, Ki, means that the error is increased over time. The integral accounts for the sum of error over time. Even a small increase in the error would increase the integral so the robot would have to head in the right direction for an equal amount of time for the integral to balance to zero.

I would appreciate a much better answer and it would be great to be confident for a similar upcoming question in the finals.

$\endgroup$
7
$\begingroup$

Proportional term: this controls how quickly to turn the steering when the heading is not at the set value.

  • A low P will lead to sluggish steering, reacting only slowly to set heading changes. It may never reach the commanded value.
  • A higher P will give a snappier response, ideally with the steering turning rapidly and smoothly to follow commanded heading changes.
  • Too high a P is an important case. If off course by a small amount to the left, a large right turn command will be issued. The turn rate will still be high when it's back on course, so it will overshoot. Too much P will give steering that weaves alternately left and right, overshooting the required heading; though it may eventually settle if the commanded course remains straight.
  • An even higher P will lead to exaggerated oscillations and possibly shaking/vibration depending on the dynamics of the system, how heavy it is, how flexible the tyres and carpet are...

Derivative term: this can be used to limit the speed of the steering response.

  • Assuming you already have a P term coarsely set in a sensible range, this will serve to reduce the speed of the steering response when the error is changing rapidly.
  • If your P term is set high and overshoot or oscillation is occurring, adding Derivative action will limit the amount of hard turning done for large steering commands.
  • In other words increasing the D term will reduce the maximum "sway" performed by the steering. Ideally this will serve to reduce overshoot so if the P controller is tuned too high, the right amount of Derivative action should stop oscillation.
  • Too much Derivative action will probably become sluggish in steering again.
  • Extreme example: I tried a very high Derivative value in a motor position controller. When I grabbed the gear and tried to turn it by hand, it resisted my movement. It was like trying to stir very thick treacle. Rotating it by hand very slowly was easy, but rotating fast caused a very high resistance, like a damper.

Integral term: this adds more steering action if the error persists for too long.

  • If the existing P+D control terms lead to an overall response that settles short of the required heading, an I term will slowly add a steering command to edge closer (we hope).
  • Too much Integral action can again cause overshoot/weaving, as the added Integral action turns in the correct way to get onto the commanded heading, but continues to steer because the large I term effectively has a long memory of steering in that direction... it will take a while for the integrated error to reduce and straighten up again.

The common advice often given for most systems is to increase the Proportional setting, until you get good performance. If you have to increase it so far that overshoot occurs (weaving, in the steering example) then start to add a little Derivative to stop the overshoot. Then add more P+D to get better performance. If you notice a state where it steers towards the centre but slows before getting there, start to add some I... but not so much that weaving begins again.

And bear in mind with the vehicle case, getting it all nicely tuned then putting some weight on the back might affect the system dynamics and require more retuning...

$\endgroup$
  • 3
    $\begingroup$ I would add that, since the derivative term is responding to the change in error, it can create significant output variability if the system suffers from noisy inputs. Kudos to @Andy for describing Zeigler-Nichols (okay, a simplified version) in only four sentences! $\endgroup$ – SteveO May 9 '16 at 21:42
0
$\begingroup$

Andy's response is good, and he hits all of the important points but to fully understand PID control in the context of a differential drive robot, it might be useful to take a step back and consider the dynamics of the system. This may seem like a digression from your specific question, but if you take the time to read through, I am confident that this will lend context to PID control and improve your understanding.

Differential drive robots can be modeled with unicycle dynamics of the form: $$\left[\begin{matrix}\dot{x}\\ \dot{y} \\ \dot{\theta} \end{matrix}\right] = \left[\begin{matrix}cos(\theta)&0\\sin(\theta)&0\\0&1\end{matrix}\right] \left[\begin{matrix}v\\\omega\end{matrix}\right],$$ where $x$ and $y$ are Cartesian coordinates of the robot, and $\theta \in (-\pi,\pi]$ is the angle between the heading and the $x$-axis. The input vector $\left[v, \omega \right]^T$ consists of linear and angular velocity inputs.

Because the objective is to head in a desired direction, so the error can be written as $$e=\theta-\theta_d,$$ and the error dynamics are given by $$\dot{e}=\dot{\theta}=\omega.$$ The relative degree of the system is $\gamma=1$, so by driving the error to 0, the $x$ and $y$ position will not be controlled, which makes sense.

The question is, what angular velocity should be applied to drive the error to zero? Because the error dynamics are a single integrator, linear system, they can be exponentially stabilized by correctly choosing $\omega$; this is where PID control comes in. Recall the definition of PID control and putting it in the context of the system: $$\omega=K_p e+K_i \int_0^t{e dt} + K_d \frac{de}{dt}.$$ As it turns out, because there is no drift term (e.g. the system is given by $x=f(x)+g(x)u=g(x)u \implies f(x)=0$), you can set $K_d=K_i=0$ and simply choose $K_p<0$ to accomplish the objective. On a real system, where the unicycle model is not accurate, there may be cause to include the integral and derivative terms. Knowing the process to get to this point, in addition to your existing intuition about what PID does, will definitely help on your test.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.