Once we have the error signal we can decide how to move the Zumo Robot so that it stays on the black line. The signal sent to the motors to ensure that the Zumo Robot stays on the black line is called the 'control' signal. The function or component which generates the control signal is known as the controller.
The simplest controller is illustrated in the figures above. The logic being: if the Zumo Robot center is to the left of the black line, then turn right by a fixed amount so that it eventually returns to the black line. Similarly, if the Zumo Robot center is to the right of the black line, turn left so that it returns to the black line. This controller is known as the Bang Bang Controller.
For this tutorial however, we will be using a more sophisticated controller known as a PID Controller, specifically a PD controller. Let us look at what a PID Contoller is all about:
PID Controller
In the Bang Bang controller, we made the robot turn a fixed amount in a particular direction. However if we extrapolate the logic used, then it makes sense that the amount by which the robot turns should be proportional to the amount by which it has deviated from the black line. The further the center of the robot is from the black line, greater should be the amount by which the robot should turn to return its center on the black line.
Such a control logic is employed in a Proportional Controller, in which the control signal is proportional to the error signal. The Proportional Controller corresponds to the 'P' part of the PID Controller.
Depending upon the proportionality constant, the amount by which the robot turns for a particular value of the error signal will vary. This constant of proportionality 'P' is a parameter of the model which has to be tuned as per the application.
One limitation of the Proportional Controller is that the robot can continue oscillating about the black line due to inertia. In this situation, the robot will continually oscillate about the black line while moving forward and will not be able to accurately follow the black line.
One way to dampen the oscillations so that the robot returns to the black line quickly is to add a derivative component to the control signal. In this case we compute the instantaneous derivative of the error signal which would serve to dampen the oscillations. A constant is multiplied to this derivative and the product is added to the control signal. This constant is known as the derivative gain and corresponds to the 'D' part of the PID Controller.
For this tutorial however, we will be using a more sophisticated controller known as a PID Controller, specifically a PD controller. Let us look at what a PID Contoller is all about:
PID Controller
In the Bang Bang controller, we made the robot turn a fixed amount in a particular direction. However if we extrapolate the logic used, then it makes sense that the amount by which the robot turns should be proportional to the amount by which it has deviated from the black line. The further the center of the robot is from the black line, greater should be the amount by which the robot should turn to return its center on the black line.
Such a control logic is employed in a Proportional Controller, in which the control signal is proportional to the error signal. The Proportional Controller corresponds to the 'P' part of the PID Controller.
Depending upon the proportionality constant, the amount by which the robot turns for a particular value of the error signal will vary. This constant of proportionality 'P' is a parameter of the model which has to be tuned as per the application.
One limitation of the Proportional Controller is that the robot can continue oscillating about the black line due to inertia. In this situation, the robot will continually oscillate about the black line while moving forward and will not be able to accurately follow the black line.
One way to dampen the oscillations so that the robot returns to the black line quickly is to add a derivative component to the control signal. In this case we compute the instantaneous derivative of the error signal which would serve to dampen the oscillations. A constant is multiplied to this derivative and the product is added to the control signal. This constant is known as the derivative gain and corresponds to the 'D' part of the PID Controller.
The 'I' part of the PID controller is not used for this particular application. Thus specifically, this controller is known as a PD Controller.
In the model, the block labelled 'PID Controller' represents the controller described above. You can view the values for 'P','I','D' by double clicking on the block.The example model already has some default values for 'P' and 'D' while 'I' is equated to 0. For an alternate explanation for the PID Controller, check out this blog post which provides a great analogy to explain the PID Controller using pendulums.
In the model, the block labelled 'PID Controller' represents the controller described above. You can view the values for 'P','I','D' by double clicking on the block.The example model already has some default values for 'P' and 'D' while 'I' is equated to 0. For an alternate explanation for the PID Controller, check out this blog post which provides a great analogy to explain the PID Controller using pendulums.
Tuning the PD Controller
One method to tune the PD Controller without using a mathematical model of the robot is listed below:
One method to tune the PD Controller without using a mathematical model of the robot is listed below:
- Adjust the proportional gain of the controller till you obtain a suitable response.
- As a thumb rule, set the value of the derivative gain to be equal to 1/10th of the proportional gain.
- Now adjust the derivative gain and observe the change in the robot behavior, till a suitable behavior is obtained.
- Increasing the proportional gain will increase the amount by which the robot turns.
- Increase the derivative gain will dampen the magnitude of oscillations by the robot.
Page last edited April 27, 2014
Text editor powered by tinymce.