You are here : Control System Design - Index | Simulations | Ball & Plate | Part 1 Ball and Plate Tutorial - Part 1Before continuing, make sure you have read Chapter 14. System ModelThe modelling of the ball and plate system comes straight from simple Newtonian physics. The equation for acceleration of the ball down the plate is given by
This simplistic model ignores the forces on the ball due to the motion of the plate, but we will see later that there are stronger influences on the system than this modelling error. The measurement of the ball position is made by a camera directly above the plate. The camera will thus project the ball's position onto a two-dimensional plane, meaning that the observed position of the ball is given by
Since is small (we will only be tilting the plate by a small amount), and assuming that g = 9.8, the transfer function can be linearised to
remembering that and for small . We immediately recognise the double integrator as a possible source of difficulty for control. A simple lead compensator was selected for the ball position control. The angle of the plate is controlled by a motor connected to an arm which is connected to the plate (as shown in the diagram above). This arrangement is such that the plate angle moves at half the rate of the angular movement of the motor. The motor is controlled via pulse width modulation, allowing integer speed commands in the range -127 to 127 to be given to the motor. The motor's maximum speed is 30 rpm. The major obstacle to control is the several sources of non-linearity in the motor. Firstly, there is the obvious speed limit in the motor (which is an actuator saturation). Secondly, the motors appear to have a dead zone, which means that the motor speed must be larger than 20 before the motor will move. Finally, there is a reasonable amount of backlash in the gears of the motor. (Read this page for an explanation of backlash and the effect it has.) There is also a physical limit on the angle that the plate can tilt, but this is not really a problem, since the control system will be designed so as to not approach this limit. Assuming that the motor has no dynamics (i.e. the output angle is the integral of the input speed), the resulting model of the angle control mechanism (including a proportional controller with gain 2000) is
Overcoming the dead-zone is simple (and is described in chapter 15): simply add 20 to the motor speed if it is positive, or subtract 20 if the desired speed is negative. Overcoming the backlash is somewhat more difficult. We closely monitor the desired motor speed, and if it changes direction, we drive the motor at maximum speed for a small period of time to overcome the backlash. The applet below will show that this compensation is not very effective. If the motor was able to rotate faster, then the backlash could be overcome more quickly. As it stands, the motors cannot move fast enough to allow any significant compensation. The fact that the backlash is after the integrator is what makes the backlash so difficult to overcome. If the backlash were before the integrator, we could easily compensate for it by estimating the position of the output in the deadzone, and driving the input to overcome the dead zone, as described in the previous discussion of backlash. The backlash occurs after the integrator because the backlash affects the position of the motor output, not its speed. The block diagram below shows the system if the backlash were before the integrator.
Java Applet SimulationThe JAVA applet below is a simulation of the ball and plate system in one dimension. The graph has a vertical scale of 10cm per division and a horizontal scale of 2 seconds per division. It shows the position set-point (the blue trace), the plate angle (the green trace) and the ball position (the red trace). Pressing the "Change Parameters" button allows you to change the set point type, the position controller C1, the angle controller C2 and the amount of measurement noise in the angle position measurement. (It is assumed that the vision system provides a noise free measurement of the ball position.) Also, backlash can be included in the model by selecting the check box, and compensation can be similarly enabled. Although the model has the backlash appearing after the integrator, the applet will allow you to change the position of the backlash in the simulation (this also changes the method of compensation). Try experimenting with these parameters. Note that if the ball falls off the plate, the simulation will stop automatically. If you then press start, the simulation will reset itself.
The system's response is not too good, but the ball manages to stay on the plate (which is 0.4m wide in the simulation). This was the main objective of the project, but the presence of backlash severely inhibits the system's performance, meaning that the control is not as good as was desired. |